SA-MP Forums Archive
OnPlayerText Error! - 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: OnPlayerText Error! (/showthread.php?tid=524467)



OnPlayerText Error! - ilay65 - 06.07.2014

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!


Re: OnPlayerText Error! - ilay65 - 06.07.2014

Up!!
Please it is very important to me!!


Re: OnPlayerText Error! - ilay65 - 06.07.2014

Up Up Up Up Up!!
Is important to me!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!
Please Help!!


Re: OnPlayerText Error! - ilay65 - 06.07.2014

Can anyone help me please?


Re: OnPlayerText Error! - Abagail - 07.07.2014

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?


Re: OnPlayerText Error! - Threshold - 07.07.2014

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


Re: OnPlayerText Error! - ilay65 - 07.07.2014

Thank you!