Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lua Scripts/Questions/Help

6,770 replies
Page
To the start Previous 1 2171 172 173338 339 Next To the start

old Re: Lua Scripts/Questions/Help

Sleepin
User Off Offline

Quote
well,this will be hard(for me) since i'm a "novice" lua scripter,can't help you much but it has to be something like
ms100() updating it.

old Re: Lua Scripts/Questions/Help

Yorty
User Off Offline

Quote
Argh, this is a simple thing I've never been able to overcome. I can't seem to find a way to save "variables".
E.G.:

1
2
3
4
addhook("join","rp.join") 
function join(id) 
     rp.job[id]=1
end

1
2
3
4
5
6
7
8
9
function jobhud(id)
local i = 1,32 do
	if(player(i,"exists")) then
	jobn = rp.job[id]
		[b]hudtxt(i,2,'255255255','Job: '..jobn,5,420)
[/b] (Intentional)
	end
end
end
Won't work. This is incredibly stupid, but seriously...

old Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Quote
Spoiler >


1
jobn = rp.job[[b]id[/b]]

"id"? no "i"?

old Re: Lua Scripts/Questions/Help

Yorty
User Off Offline

Quote
Flacko has written
Did you actually initiate your table?
rp.job = {}
or
rp.job = initArray(32)
Oy, did that for my money table but forgot it for my Job one. Thanks.
Edit: Still doesn't want to work.
Double edit: Some fooling, got it to work.
edited 2×, last 07.03.10 03:15:29 am

old Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Quote
1
2
3
4
5
- itemtype(type,"value")	Return a value of an item type:
				name, dmg, dmz_z1, dmg_z2,
				rate, reload, ammo, ammoin,
				price, range, dispersion,
				slot, recoil

How i can work with it? Can someone write sample for me?

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
1.
1
print(itemtype(1,"name")) --> USP
2.
1
2
3
for i = 1, 88, 1 do
	print(itemtype(i,"name"))
end

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
dofile("sys/lua/wrapper.lua")

function msg2(id,msg)
	parse("sv_msg2 "..id.." \""..msg.."\"")

addhook("buy","_buy_")
function _buy_(id,iid)
	msg2("Congratulations!")
	msg2("You have successfully bought a: "..itemtype(iid,"name"))
	msg2("This weapons features a "..itemtype(iid,"damage").."Hp Damage")
	msg2("A rate of fire of "..itemtype(iid,"rate").." RPM")
	msg2("And a dispersion of "..itemtype(iid,"dispersion"))
	msg2("Please come back soon ^^")
end

old Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Quote
I was thinking i'll can create my custom weapon
omg ... So, i can't do my custom weapon?

like custom dmg,rate,ammo,range ...
edited 1×, last 07.03.10 08:44:00 pm

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
You can't just add weapon so simply.

There are few ways to make own weapons, bullets, ect...
But it's not so simple as you thought.

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
Yeah, otherwise I wouldn't say that.

I'm making tutorial for this stuff.
Or maybe I will post it sooner.

old Re: Lua Scripts/Questions/Help

Yorty
User Off Offline

Quote
Blazzingxx has written
Yeah, otherwise I wouldn't say that.

I'm making tutorial for this stuff.
Or maybe I will post it sooner.

Oho. Im listening.

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
Try join there:
Classic SuperHero 82.135.231.192:36970

I'm going to be there for 10 mins, so I can show high leveled heroes with objects...

old Table value?

Fasttt
User Off Offline

Quote
1
2
3
4
5
6
primary_weapons = {10,11,20,21,22,23,24}

addhook('minute','dm_minute')
function dm_minute()
msg('Primary Weapons is: '..primary_weapons)
end

LUA ERROR: Attempt to call a table value

/// is it possible to fix it?

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
primary_weapons = {10,11,20,21,22,23,24}

addhook('minute','dm_minute')
function dm_minute()
	local weapons = ''
	for i = 1 , #primary_weapons, 1 do
		weapons = weapons..primary_weapons[i]..' '
	end
	msg('Primary Weapons is: '..weapons)
end
To the start Previous 1 2171 172 173338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview