Compiler stopped working - 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: Compiler stopped working (
/showthread.php?tid=623308)
Compiler stopped working -
POL_george - 30.11.2016
Код:
CMD:a(playerid, params[])
{
new AdminName[MAX_PLAYER_NAME), string[128];
GetPlayerName(playerid, AdminName, sizeof(AdminName));
if(sizeof(params) == 0)) return ""COL_WHITE"Sintaxa corecta este: /"COL_RED"a "COL_WHITE"["COL_RED"message"COL_WHITE"]");
if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, - 1, ""COL_WHITE"Tu nu ai previlegii de "COL_RED" Admin!");
format(string, sizeof(string), ""COL_WHITE"[Admin LV%i]"COL_ORANGE"%s"COL_WHITE": %s", PlayerInfo[playerid][pAdmin], AdminName, params);
for(new i; i < 400; i++)
{
if(IsPlayerConnected(i)) SendClientMessage(i, - 1, string);
}
}
what I did wrong? The compiler is stopped working...
Re: Compiler stopped working -
TheRohlikar - 30.11.2016
Код:
if(sizeof(params) == 0)) return ""COL_WHITE"Sintaxa corecta este: /"COL_RED"a "COL_WHITE"["COL_RED"message"COL_WHITE"]");
You don't have "SendClientMessage" there.
->
Код:
if(sizeof(params) == 0)) return SendClientMessage(playerid, -1,""COL_WHITE"Sintaxa corecta este: /"COL_RED"a "COL_WHITE"["COL_RED"message"COL_WHITE"]");
Re: Compiler stopped working -
POL_george - 30.11.2016
thanks, pal! I dont get why I missed that
Re: Compiler stopped working -
RaZVaN ^ xD - 30.11.2016
Also,
sizeof operator (which btw gets evaluated at compile-time) returns the
size of an array, not the length of a string, so the proper line would be:
Код:
if(strlen(params) == 0) { /* code */ }
// or isnull()