GetPVarInt Error.
#1

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;
Reply
#2

Another equal sign is missing. ==.
Reply
#3

i recommend you using variables instead of pvars.
Reply
#4

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.
Reply
#5

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;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)