There is better no reload function on SH 1.2
Forum
CS2D Scripts Lua Scripts/Questions/HelpThere is better no reload function on SH 1.2
Then set position randomly (from table) of player when he spawn.
But that's not what you need.
There is other way,
You have to make tile() function in that case...
anyways thanks a lot
Something like this ?
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
addhook("hit","god") function god(id) 	if (player(id,"usgn") == Your Usgn) then 		return 1 	else 		return 0 	end end
I'm going to need help with that random spawning...
i'm getting this error :
LUA ERROR: dir: attempt to concatenate local 'y' (a nil value)
the line is this:
parse("spawnplayer "..id.." "..x.." "..y)
parse("spawnplayer "..id.." "..x.." "..y")
Edit:
Tested it, no change,same error..
You will need some pathfinding algorithms to spawn players inside the map and make sure they can reach certain spots, like bombspots, hogstages, etc.
However, your error is here
1
2
2
if (map == "de_dust") then 	spawning(id,rndmap())
1
2
2
if (map == "de_dust") then 	spawning(id,unpack(rndmap()))
LUA ERROR: dir: bad argument to 'unpack' (table expected, got number)
hmm i think i'll forget this, as you said
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
maptable = { 	de_dust={{1,2},{3,4},{5,6},{7,8},{9,10}}, 	de_dust2={{11,12},{13,14},{15,16},{17,18},{19,20}} } function rndmap(whatmap) local rnd = math.random(1,#maptable[whatmap]) return maptable[whatmap][rnd] end map = game("sv_map") function spawning(id,x,y) 	parse("setpos "..id.." "..x.." "..y) end addhook("spawn","spawns") function spawns(id) 	if map == "de_dust" then 		spawning(id, unpack(rndmap("de_dust")) ) 	elseif map == "de_dust2" then 		spawning(id, unpack(rndmap("de_dust2")) ) 	end end
Notice that the spawning function doesn't spawn a player, it just sets it's position, otherwise you might provoke an infinite loop.
Edit:
Now i get other error ... D:!
LUA ERROR: dir: attempt to call a nil value
i checked if i was using an incorrect hook's name, and i wasn't using a wrong function
anyways LOTS of thanks Flacko
edited 1×, last 17.12.09 10:11:03 pm
Try to restart your CS2D, the script works properly for me.
-WiLSoN- has written
still not working... could the problem be in other part of the script ?
If you have any other running scripts deactivate them, the snippet that I gave you should work with no console error.
At least it does for me...