what's wrong with that code? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: what's wrong with that code? (
/showthread.php?tid=187920)
what's wrong with that code? -
Christian_Bojic - 05.11.2010
what's wrong with that code
Код:
public OnPlayerSpawn(playerid)
{
case 0: PlayerInfo[playerid][pJob] == 1
case 1: PlayerInfo[playerid][pJob] == 2
case 2: PlayerInfo[playerid][pJob] == 3
case 3: PlayerInfo[playerid][pJob] == 4
case 4: PlayerInfo[playerid][pJob] == 5

?
Re: what's wrong with that code? -
iJumbo - 05.11.2010
errors problems ...
Re: what's wrong with that code? -
Christian_Bojic - 05.11.2010
i want to when player spawned to randomly selected job and to kill other guys with other job
and i now want to randomly selected job when he spawned
and errors is:
Код:
D:\Djordje\MYDOCU~1\GTA\GTASER~1\GTA0~1.3BR\GAMEMO~1\FinalDM.pwn(147) : error 014: invalid statement; not in switch
D:\Djordje\MYDOCU~1\GTA\GTASER~1\GTA0~1.3BR\GAMEMO~1\FinalDM.pwn(147) : warning 215: expression has no effect
D:\Djordje\MYDOCU~1\GTA\GTASER~1\GTA0~1.3BR\GAMEMO~1\FinalDM.pwn(147) : error 001: expected token: ";", but found ":"
D:\Djordje\MYDOCU~1\GTA\GTASER~1\GTA0~1.3BR\GAMEMO~1\FinalDM.pwn(147) : error 029: invalid expression, assumed zero
D:\Djordje\MYDOCU~1\GTA\GTASER~1\GTA0~1.3BR\GAMEMO~1\FinalDM.pwn(147) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
Re: what's wrong with that code? -
gamer931215 - 05.11.2010
shouldnt this be on OnPlayerRequestClass ?
Also you need to use an switch then:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
switch(classid)
{
case 0: PlayerInfo[playerid][pJob] = 1;
case 1: PlayerInfo[playerid][pJob] = 2;
case 2: PlayerInfo[playerid][pJob] = 3;
case 3: PlayerInfo[playerid][pJob] = 4;
case 4: PlayerInfo[playerid][pJob] = 5;
}
return 1;
}
Re: what's wrong with that code? -
Christian_Bojic - 05.11.2010
thank you gamer
and you give me example for other code
Re: what's wrong with that code? -
Miguel - 05.11.2010
You could have also done something like this:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
if(classid < 5) PlayerInfo[playerid][pJob] = classid + 1;
return 1;
}