SA-MP Forums Archive
/slap error/warning +rep - 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: /slap error/warning +rep (/showthread.php?tid=578765)



/slap error/warning +rep - ItzRbj - 22.06.2015

Script
Код:
ocmd:slap(playerid,params[])
{
	if(!IsPlayerAnAdmin(playerid,2))return SendClientMessage(playerid,COLOR_BLUE,"You're not allowed to use this command");
 	new string[128], string2[128];
  	format(string,sizeof(string),"You've slapped %s", PlayerName);//Line 589
   	format(string2,sizeof(string2),"You've been slapped by Adminstrator");
   	for(new i=0;i<GetMaxPlayers();i++)
	{
	if(IsPlayerConnected(i))
	{
	if(IsPlayerAnAdmin(i,1))
	{
    format(string2,sizeof(string2),"A: %s [LEVEL %i] used the SLAP command.",PlayerName(playerid),GetPVarInt(playerid,"Admin"));
	SendClientMessage(i,COLOR_ORANGE,string2);
	}
	}
	}
	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid,x,y,z);
	SetPlayerPos(playerid,x,y,z+10);
	return 1;
}
error/warning

Код:
(589) : error 076: syntax error in the expression, or invalid function call
          (872) : warning 209: function "IsPlayerAnAdmin" should return a value



Respuesta: /slap error/warning +rep - pabloalber84 - 22.06.2015

*if(IsPlayerAnAdmin(i))


Re: Respuesta: /slap error/warning +rep - ItzRbj - 22.06.2015

Quote:
Originally Posted by pabloalber84
Посмотреть сообщение
*if(IsPlayerAnAdmin(i))
the (playerid,2) after it means i dont want admins less than lvl 2 to use this cmd


Respuesta: /slap error/warning +rep - pabloalber84 - 22.06.2015

The IsPlayerAnAdmin, send the code to view.


Re: Respuesta: /slap error/warning +rep - ItzRbj - 22.06.2015

Quote:
Originally Posted by pabloalber84
Посмотреть сообщение
The IsPlayerAnAdmin, send the code to view.
Код:
stock IsPlayerAnAdmin(playerid,Rang)
{
	if(GetPVarInt(playerid,"Admins")>=Rang)
	return 1;
}



Re: /slap error/warning +rep - Neos07 - 22.06.2015

Try this :/
Quote:

stock IsPlayerAnAdmin(playerid,Rang)
{
if(GetPVarInt(playerid,"Admins")>=Rang){return 1;}
else{return 0;}
}




Re: /slap error/warning +rep - ItzRbj - 22.06.2015

Quote:
Originally Posted by Neos07
Посмотреть сообщение
Try this :/
The warning is solved but the error is still there

Код:
(589) : error 076: syntax error in the expression, or invalid function call



Re: /slap error/warning +rep - Neos07 - 22.06.2015

Please show me the line 589.


Re: /slap error/warning +rep - ItzRbj - 22.06.2015

Quote:
Originally Posted by Neos07
Посмотреть сообщение
Please show me the line 589.
Код:
  	format(string,sizeof(string),"You've slapped %s", PlayerName);
btw the whole cmd is up there on the thread


Re: /slap error/warning +rep - Neos07 - 22.06.2015

new name[MAX_PLAYER_NAME];
name = GetPLayerName(playerid);
format(string,sizeof(string),"You've slapped %s", name);