OnPlayerText Error!
#1

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!
Reply
#2

Up!!
Please it is very important to me!!
Reply
#3

Up Up Up Up Up!!
Is important to me!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!
Please Help!!
Reply
#4

Can anyone help me please?
Reply
#5

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?
Reply
#6

pawn Код:
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: https://sampwiki.blast.hk/wiki/OnPlayerText
Reply
#7

Thank you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)