PDA

View Full Version : OnPlayerText Error!


ilay65
06/07/2014, 10:32 PM
public OnPlayerText(playerid,text[])
{
if(text[0] == '&')
{
new str[256];

if(AdminLevel(playerid) < 1)
{
format(str,sizeof(str),"{00FFFF}Police Chat: [Name: %s] [ID:%d]: %s [Level: %s]", GetName(playerid), playerid, text[1], AdminLevel(playerid));
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && AdminLevel(playerid) > 0)
{
SendClientMessage(i, 0x00FFFFFF, str);
}
}
}
}
return 0;
}

The Error: I am writing this code I can not record anything general chat.
Please Help!

ilay65
06/07/2014, 10:42 PM
Up!!
Please it is very important to me!!

ilay65
06/07/2014, 11:22 PM
Up Up Up Up Up!!
Is important to me!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!
Please Help!!

ilay65
06/07/2014, 11:59 PM
Can anyone help me please?

Abagail
07/07/2014, 12:01 AM
I don't get this?

if(AdminLevel(playerid) < 1)
{
format(str,sizeof(str),"{00FFFF}Police Chat: [Name: %s] [ID:%d]: %s [Level: %s]", GetName(playerid), playerid, text[1], AdminLevel(playerid));
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && AdminLevel(playerid) > 0)
{
SendClientMessage(i, 0x00FFFFFF, str);
}
}
}
}
return 0;
}

You check if they are NOT an admin, but then you send it like they are to all admins?

Threshold
07/07/2014, 12:52 AM
public OnPlayerText(playerid,text[])
{
if(text[0] == '&')
{
if(AdminLevel(playerid))
{
new str[128];
format(str, sizeof(str), "{00FFFF}Police Chat: [Name: %s] [ID:%d]: %s [Level: %d]", GetName(playerid), playerid, text[1], AdminLevel(playerid));
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
if(AdminLevel(i)) SendClientMessage(i, 0x00FFFFFF, str);
}
return 0;
}
}
return 1;
}

Messages are not sent when OnPlayerText returns 0.
Read here: http://wiki.sa-mp.com/wiki/OnPlayerText

ilay65
07/07/2014, 03:54 PM
Thank you!