SA-MP Forums Archive
scripting help! - 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: scripting help! (/showthread.php?tid=590745)



scripting help! - ahameed4755 - 03.10.2015

hi im testing a /freeze command but it dosent work it gives me error [ERROR]:YOU are not rcon admin (im already logged in rcon)

code:
Код:
CMD:freeze0(playerid,params[])
{
if(IsPlayerAdmin(playerid))return SendClientMessage(playerid, COLOR_ERROR,"[ERROR]:you are not rcon admin");
new targetid, str[75], reason[84] , pname[MAX_PLAYER_NAME];
if(sscanf(params,"ui",targetid)) return SendClientMessage(playerid,COLOR_ERROR,"[ERROR]:Usage(playerid/reason)");
if(playerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_ERROR, "[ERROR]:Player is not connected.");
TogglePlayerControllable(targetid,0);
format(str, sizeof(str), "admin %s has freezed you",pname);
SendClientMessage(playerid,-1,"Player Has Been Freezed");
SendClientMessage(targetid, COLOR_ADMIN,str);
return 1;
}



Re: scripting help! - dh240473 - 03.10.2015

PHP код:
if(IsPlayerAdmin(playerid))return SendClientMessage(playeridCOLOR_ERROR,"[ERROR]:you are not rcon admin"); 
Change To
PHP код:
if(!IsPlayerAdmin(playerid))return SendClientMessage(playeridCOLOR_ERROR,"[ERROR]:you are not rcon admin"); 



Re: scripting help! - Lordzy - 03.10.2015

Your code currently works for normal players but not for RCON administrators. Send the error message if "IsPlayerAdmin" returned false (Add "!" before IsPlayerAdmin).


Re: scripting help! - ahameed4755 - 03.10.2015

ops i forgot (!) thanks for reminding

rep to both!