English Where is my mistake? (lua)

5 replies
Goto Page
To the start Previous 1 Next To the start
06.06.13 07:44:45 pm
Up
limonata
User
Offline Off
Hello, may you tell me where is my mistake in this script?

Code:
1
2
3
4
5
6
7
8
9
10
addhook("startround","s")
function s(id)
     if player(id,"score") > 2 then
          if player(id,"health") > 0 then
          parse("equip "..id.. "47")
     else
          msg2(id,"You will get your RPG next round!")
          end
     end
end
06.06.13 07:46:33 pm
Up
DarkBooy
User
Offline Off
user limonata has written:
Hello, may you tell me where is my mistake in this script?

Code:
1
parse("equip "..id.. "47")

it should be . ==>
Code:
1
parse("equip "..id.." 47")
Vote for you'r favorite server [2012/2013] thread cs2d your Favourite Server & Enjoy on these maps file File does not exist (13871) & file cs2d de_fun_snow (3)
06.06.13 09:20:29 pm
Up
Kirby7
User
Offline Off
You also forgot an 'end' ( after line 5 ) for the 'if' in line 4 and you don't need the 'end' in line 8.

Fixed code :
Spoiler >


Also i would recommend using the spawnhook to equip weapons at the round start ( see spawn ). Just personal preference though.
edited 1×, last 06.06.13 09:31:50 pm
06.06.13 10:46:47 pm
Up
limonata
User
Offline Off
Thank you Kirby i was trying to select right hook. It was spawn i will use it okay
--------------------------

Edit: No error but doesnt working.

Code:
1
2
3
4
5
6
7
8
addhook("spawn","give_stf")
function give_stf(id)
     if player(id,"score") > 2 and player(id,"health") > 0  then
                parse("equip "..id.. " 47")
     elseif  player(id,"score") > 2 and player(id,"health") < 0  then
          msg2(id,"You will get your RPG next round!")
          end
end


When player reach the 2 score he will get rpg next spawn. For example in the game i killed three player then i died. I will get rpg next spawn.
edited 1×, last 06.06.13 11:25:03 pm
07.06.13 01:37:56 am
Up
tonton2d
User
Offline Off
Code:
1
2
3
4
5
6
7
8
9
10
11
12
addhook("spawn","give_stf")
function give_stf(id)

for id=1,32 do
     if player(id,"score") > 2 and player(id,"health") > 0  then
                parse("equip "..id.. " 47")
     elseif  player(id,"score") > 2 and player(id,"health") < 0  then
          msg2(id,"You will get your RPG next round!")
          end
      end

end

give a value to id.
"Akounamatata"
07.06.13 12:39:27 pm
Up
Conscience
User
Offline Off
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
round = 1
maxround = 3

addhook("spawn","_spawn")
addhook("endround","_endround")

function _spawn(id)
     if round == 1 then -- Checks if it is round 1 (RPG Launcher round)
          return 47
     elseif round == 2 then -- Your next round, for example laser round
          return 45
     end
end

function _endround(mode)
     round = round + 1
     if round == maxround then -- This will loop the rounds, making the rounds never stop
          round = 1
     end
end
Remember to learn to forget. Whiskey shots and cheap cigarettes.
To the start Previous 1 Next To the start