English I don't know how to make auto zombie script.

15 replies
Goto Page
To the start Previous 1 Next To the start
Up
Wozny333
User
Offline Off
I don't know how to make auto ZM script like this:
Code:
1
if (player(id,'team')==1 and sv_gamemode==4) then zombie[id]=1 end

That script don't work (i don't know why?)
Help me plz
27.03.11 09:48:49 am
Up
Fiz
User
Offline Off
If you just want it to be the zombies gamemode every round, copy this into the lua notepad:

parse("sv_gm 5")

Or, go to settings > more settings > autogamemode > on <
Then all you have to do is run a map with zm_ at the start and it will run it on zombies.
hope this helped :).
27.03.11 11:58:54 am
Up
Wozny333
User
Offline Off
But i want to check the game mode
if gamemode=zombies and player_team=1 then zombie[id]=1 else zombie[id]=0
27.03.11 01:13:45 pm
Up
DannyDeth
User
Offline Off
Here:
Code:
1
2
3
4
5
6
7
8
9
zombie = {}
addhook("team","zombie_check")
function zombie_check(team,id)
     if team==1 then
          zombie[id]=1
     else
          return 0
     end
end

that should work
And you must not do this:
Code:
1
zombie[id]=0

As all the elements of an array/table start out as 0, so you will make no difference!
27.03.11 02:39:24 pm
Up
Wozny333
User
Offline Off
Ok, but how to check game mode with lua script?
27.03.11 02:49:48 pm
Up
Yasday
User
Offline Off
Code:
1
game("sv_gamemode")
27.03.11 03:03:52 pm
Up
Wozny333
User
Offline Off
This should work:?
Code:
1
if game("sv_gamemode")==4 then msg("©255255000Testing gamemode, 4") end


Where is error?
27.03.11 03:05:41 pm
Up
DannyDeth
User
Offline Off
There is no error in that code.
27.03.11 03:12:54 pm
Up
Wozny333
User
Offline Off
But that doesn't work.
I test this:
Code:
1
msg("©255255000Testing.GM."..game("sv_gamemode"))

and this:
Code:
1
if game("sv_gamemode")==2 then msg("©255255000Testing.If.GM.2") end

on Team Deathmach
In first it say Testing.GM.2 but in second doesn't say Testing.If.GM.2
27.03.11 03:36:53 pm
Up
Yasday
User
Offline Off
I think it returns a string, use tonumber.
27.03.11 04:26:00 pm
Up
Wozny333
User
Offline Off
I tried to use tonumber but i can't. Can you make example?
27.03.11 04:27:43 pm
Up
DannyDeth
User
Offline Off
Code:
1
if game("sv_gamemode")=="Zombies!" then msg("©255255000Testing gamemode, 4") end
27.03.11 04:27:59 pm
Up
Yasday
User
Offline Off
Code:
1
2
print(type(game("sv_gamemode"))) -- string (I think)
print(type(tonumber(game("sv_gamemode")))) -- number
27.03.11 05:21:41 pm
Up
Wozny333
User
Offline Off
Doesn't work.
edited 1×, last 28.03.11 09:47:19 am
29.03.11 06:53:04 am
Up
Robotic-Brain
User
Offline Off
Code:
1
if game("sv_gamemode")=="4" then msg("©255255000Testing gamemode, 4") end


or:

Code:
1
if tonumber(game("sv_gamemode"))==4 then msg("©255255000Testing gamemode, 4") end


should work..
29.03.11 04:59:44 pm
Up
Wozny333
User
Offline Off
>>THANKS, it works!<<
To the start Previous 1 Next To the start