invalid expression, assumed zero
#1

COMMAND:cmdspy(playerid, params[])
{
if(playerData[playerid][playerLevel] >= 6)
{
if(playerData[playerid][playercspy])
{
playerData[playerid][playercspy] = false;
SendClientMessage(playerid, COLOR_WHITE, "{FFFF00} You are now spying on commands.");
}
else
{
playerData[playerid][playercspy] = true;
SendClientMessage(playerid, COLOR_WHITE, "{FFFF00} You are no longer spying on commands.");
}
else
{
SendClientMessage(playerid, COLOR_RED, "You do not have correct permissions to use this command.");
}
}
return 1;
}



I created this command but whats wrong with this? plz help me

This is the error:

C:\Users\BladeGamingYT\Desktop\BG Cops And Robbers\pawno\include\cnr/cnr_admincommands.inc(7230) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#2

Replace;
Код:
COMMAND:cmdspy(playerid, params[])
{
	if(playerData[playerid][playerLevel] >= 6)
	{
		if(playerData[playerid][playercspy])
		{
			playerData[playerid][playercspy] = false;
			SendClientMessage(playerid, COLOR_WHITE, "{FFFF00}	You are now spying on commands.");
		}
		else
		{
			playerData[playerid][playercspy] = true;
			SendClientMessage(playerid, COLOR_WHITE, "{FFFF00}	You are no longer spying on commands.");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_RED, "You do not have correct permissions to use this command.");
	}
	return 1;
}
Reply
#3

thanks, btw what was the problem?
Reply
#4

Quote:
Originally Posted by BladeGamingYT
Посмотреть сообщение
thanks, btw what was the problem?
Because you used the wrong if-else;

Код:
COMMAND:cmdspy(playerid, params[])
{
	if(playerData[playerid][playerLevel] >= 6)
	{
		if(playerData[playerid][playercspy])
		{
			playerData[playerid][playercspy] = false;
			SendClientMessage(playerid, COLOR_WHITE, "{FFFF00}	You are now spying on commands.");
		}
		else
		{
			playerData[playerid][playercspy] = true;
			SendClientMessage(playerid, COLOR_WHITE, "{FFFF00}	You are no longer spying on commands.");
		}
		else
		{
			SendClientMessage(playerid, COLOR_RED, "You do not have correct permissions to use this command.");
		}
	}
	return 1;
}
Код:
COMMAND:cmdspy(playerid, params[])
{
	if(playerData[playerid][playerLevel] >= 6)
	{
		if(playerData[playerid][playercspy])
		{
			playerData[playerid][playercspy] = false;
			SendClientMessage(playerid, COLOR_WHITE, "{FFFF00}	You are now spying on commands.");
		}
		else
		{
			playerData[playerid][playercspy] = true;
			SendClientMessage(playerid, COLOR_WHITE, "{FFFF00}	You are no longer spying on commands.");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_RED, "You do not have correct permissions to use this command.");
	}
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)