SA-MP Forums Archive
GetPVarInt Error. - 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: GetPVarInt Error. (/showthread.php?tid=650594)



GetPVarInt Error. - MarioKamani - 02.03.2018

What's wrong? The error is marked.



Код:
CMD:duty(playerid, params[])
	{
		if(IsPlayerAdmin(playerid))
			{
					if(GetPVarInt(playerid, "Duty") = 0) - Here is the error
					{
						SendClientMessage(playerid, COL_SERVER, "You are now on FBI duty!");
						SetPlayerColor(playerid, COL_BLUE);
						SetPVarInt(playerid, "Duty", 1);
					}
						else if(GetPVarInt(playerid, "Duty") == 1)
					{
						SendClientMessage(playerid, COL_SERVER, "You are now off FBI duty!");
						SetPlayerColor(playerid, -1)
						SetPVarInt(playerid, "Duty", 0;
					}
		}
}		return 1;



Re: GetPVarInt Error. - ISmokezU - 02.03.2018

Another equal sign is missing. ==.


Re: GetPVarInt Error. - PepsiCola23 - 02.03.2018

i recommend you using variables instead of pvars.


Re: GetPVarInt Error. - Sew_Sumi - 03.03.2018

Quote:
Originally Posted by PepsiCola23
Посмотреть сообщение
i recommend you using variables instead of pvars.
Totally, not having any clue on what he's using them for...

Especially being an ADMIN flag, which is highly likely to need to be shared to other scripts, hence the reason for PVars.


Re: GetPVarInt Error. - AstroPoid - 03.03.2018

possibly unintended assignment
Код:
CMD:duty(playerid, params[])
	{
		if(IsPlayerAdmin(playerid))
			{
					if(GetPVarInt(playerid, "Duty") == 0) // (==) instead of (=) in conditinal if
					{
						SendClientMessage(playerid, COL_SERVER, "You are now on FBI duty!");
						SetPlayerColor(playerid, COL_BLUE);
						SetPVarInt(playerid, "Duty", 1);
					}
						else if(GetPVarInt(playerid, "Duty") == 1)
					{
						SendClientMessage(playerid, COL_SERVER, "You are now off FBI duty!");
						SetPlayerColor(playerid, -1)
						SetPVarInt(playerid, "Duty", 0;
					}
		}
}		return 1;