Help me pleasee
#1

Hello
I have a code but i have some warnings
Who will fix it for me i will rep

Код:
public SendHelperMessage(color, string[])
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
			if(MAX_PLAYERS[i][pHelper] >= 1)
			{
				SendClientMessageEx(i, color, string);
			}
	}
}
Warn's

PHP код:
C:\Documents and Settings\tit\Desktop\Newb-Per-helperatAdminat.pwn(120) : error 029invalid expressionassumed zero
C
:\Documents and Settings\tit\Desktop\Newb-Per-helperatAdminat.pwn(120) : error 029invalid expressionassumed zero
C
:\Documents and Settings\titi\Desktop\Newb-Per-helperatAdminat.pwn(120) : warning 215expression has no effect
C
:\Documents and Settings\titi\Desktop\Newb-Per-helperatAdminat.pwn(120) : error 001expected token";"but found "]"
C:\Documents and Settings\tit\Desktop\Newb-Per-helperatAdminat.pwn(120) : fatal error 107too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664 
Reply
#2

Anyone please i need it fast please
Reply
#3

This check probably is not correct. It shouldn't be MAX_PLAYERS, show the enum where you defined pHelper.
Код:
if(MAX_PLAYERS[i][pHelper] >= 1)
Also show the SendClientMessageEx function.

Where is the error line anyways?
Reply
#4

Код:
CMD:newb(playerid, params[])
{
	if(PlayerInfo[playerid][pNMute] == 1) {
		SendClientMessageEx(playerid, COLOR_RED, "You are muted from using /newb!");
		return 1;
	}
	if(nonewbie == 1)
	{
	    SendClientMessageEx(playerid, COLOR_GRAD2, "  The /newb chat has been turned off if you need help use /report.");
	    return 1;
	}
	if(IsHelper(playerid))
	{
		new toid, message[128];
		if(sscanf(params, "is[128]", toid, message)) return Syntax(playerid, "[newb]ie", "[playerid] [message]");
		if(strlen(message) > 128) return Error(playerid, "Your message cannot be longer than 128 characters.");
		if(!IsPlayerConnected(toid)) return Error(playerid, "That player is not connected!");
		new string[128];
		format(STRING, "Helper %s: %s", GetPlayerNameEx(playerid), message);
		SendClientMessageEx(toid, COLOR_NEWBIE, string);
		format(STRING, "Helper %s [%d] > %s [%d]: %s", GetPlayerNameEx(playerid), playerid, GetPlayerNameEx(toid), toid, message);
		SendAdminMessage(COLOR_NEWBIE,string);
		Log("logs/adminmessage.log", string);
		PlayerInfo[playerid][pAMSSent] ++;
	}
	else if(IsAdmin(playerid))
	{
		new toid, message[128];
		if(sscanf(params, "is[128]", toid, message)) return Syntax(playerid, "[newb]ie", "[playerid] [message]");
		if(strlen(message) > 128) return Error(playerid, "Your message cannot be longer than 128 characters.");
		if(!IsPlayerConnected(toid)) return Error(playerid, "That player is not connected!");
		new string[128];
		format(STRING, "Admin %s: %s", GetPlayerNameEx(playerid), message);
		SendClientMessageEx(toid, COLOR_NEWBIE, string);
		format(STRING, "Admin %s [%d] > %s [%d]: %s", GetPlayerNameEx(playerid), playerid, GetPlayerNameEx(toid), toid, message);
		SendAdminMessage(COLOR_NEWBIE,string);
		Log("logs/adminmessage.log", string);
		PlayerInfo[playerid][pAMSSent] ++;
	}
	else
	{
		new message[80];
		if(sscanf(params, "s[80]", message)) return Syntax(playerid, "[newb]ie", "[message]");
		if(strlen(message) > 80) return Error(playerid, "Your message cannot be longer than 80 characters.");
		//if(strfind(message, "Falling", true) != -1) return Error(playerid, "Type (/falling) and a administrative person will be there to assist you right away!");
		new string[128];
		format(STRING, "Pyetje nga %s [%d]: %s", GetPlayerNameEx(playerid), playerid, message);
		SendAdminMessage(COLOR_NEWBIE,string);
		format(STRING, "Pyetja juaj, %s, eshte derguar tek helperat..", message);
		SendClientMessageEx(playerid, COLOR_NEWBIE, string);
		format(STRING, "Player %s [%d] > Helper: %s", GetPlayerNameEx(playerid), playerid, message);
		Log("logs/adminmessage.log", string);
	}
	return 1;
}
Reply
#5

The error pretty much tells you where it is.
C:\Documents and Settings\titi\Desktop\Newb-Per-helperatAdminat.pwn(120) : error 001: expected token: ";", but found "]"

Search your script for a pHelper definition in a enum, that is probably like PlayerInfo or pInfo

EDIT:
Just use IsHelper(i)
Reply
#6

Chances are you have to be so, and you can use simply "SendClientMessage":

Код:
public SendHelperMessage(color, string[])
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
			if(PlayerInfo[i][pHelper] >= 1)
			{
				SendClientMessage(i, color, string);
			}
	}
}
"PlayerInfo" - is a enum name
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)