Z does not exists?
#1

Код:
if(new z=0; z<ZOMBIES_TOTAL; z++) {
		if(IsPlayerNPC(playerid)) {
		  if(z == 0) {
				SetPlayerPos(playerid, 2057.3208, 1339.8979, 10.9259);
				SetPlayerFacingAngle(playerid, 90);
			}
			if(z == 1) {
				SetPlayerPos(playerid, 2057.3208, 1337.8979, 10.9259);
				SetPlayerFacingAngle(playerid, 90);
			}
			if(z == 2) {
				SetPlayerPos(playerid, 2057.3208, 1335.8979, 10.9259);
				SetPlayerFacingAngle(playerid, 90);
			}
		}
	}
I have this piece of code but i got errors saying that the variable Z does not exists?

Код:
C:\Documents and Settings\Usuario\Desktop\SAMP\gamemodes\npc.pwn(138) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Usuario\Desktop\SAMP\gamemodes\npc.pwn(138) : error 017: undefined symbol "z"
C:\Documents and Settings\Usuario\Desktop\SAMP\gamemodes\npc.pwn(138) : warning 215: expression has no effect
C:\Documents and Settings\Usuario\Desktop\SAMP\gamemodes\npc.pwn(138) : error 017: undefined symbol "z"
C:\Documents and Settings\Usuario\Desktop\SAMP\gamemodes\npc.pwn(138) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#2

I think this: if(new z=0; z<ZOMBIES_TOTAL; z++) should be: for(new z=0; z<ZOMBIES_TOTAL; z++) ?:P
Reply
#3

OMG, i'm so noob. Sorry for that. Thanks (:
Reply
#4

And also use switch/case instead of if/else if, switch is faster.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)