Compiler stopped working
#1

Код:
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...
Reply
#2

Код:
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"]");
Reply
#3

thanks, pal! I dont get why I missed that
Reply
#4

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()
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)