SA-MP Forums Archive
possibly unintended assignment - 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)
+--- Thread: possibly unintended assignment (/showthread.php?tid=475641)



possibly unintended assignment - Beckett - 14.11.2013

Код:
C:\Users\ABC\Desktop\0.3x Package\gamemodes\Prison.pwn(1566) : warning 211: possibly unintended assignment
C:\Users\ABC\Desktop\0.3x Package\gamemodes\Prison.pwn(1599) : warning 204: symbol is assigned a value that is never used: "prison"
What I am doing is when a player registers an ID will be assigned to him and will appear as a textlabel on spawn, I've assigned a random number from 0 to 100 and then it worked successfully, now I turned into the label creation, variables etc, I've used the variable prison and prisontext, OnPlayerSpawn it checks if the variable "PRISON" = 0? then it creates the label if not, do nothing the error is above ^^ also why it's saying that's the variable is never used? I am confused lol.

Код:
	if(prison = 0)
	{
		prisontext = Create3DTextLabel(PlayerInfo[playerid][pPrison],LIGHTGREEN, 30.0, 40.0, 50.0, 40.0, 0);
		Attach3DTextLabelToPlayer(prisontext, playerid, 0.0, 0.0, 0.7);
		prison = 1;
	}
	else
	{
	    // nothing
	}



Re: possibly unintended assignment - Konstantinos - 14.11.2013

You do not want to assign, but check if it's equal; therebefore you need to use ==

Either:
pawn Код:
if(prison == 0)
or:
pawn Код:
if(!prison)



Re: possibly unintended assignment - Beckett - 14.11.2013

Ooh! my bad lol, thank you x_x