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



OnPlayerText - ChristianIvann09 - 03.04.2014

How can i script.. when player type this "OMG" when they send that text it will automatically "Oh my god"

Thanks in advance!


Re: OnPlayerText - forgottenkings - 03.04.2014

Here it is

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(!strcmp(text, "OMG", true))
    {
        SendPlayerMessageToAll(playerid, "Oh My God");
        return 0;
    }
    return 1;
}



Re: OnPlayerText - Bingo - 03.04.2014

Quote:
Originally Posted by forgottenkings
Посмотреть сообщение
Here it is

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(!strcmp(text, "OMG", true))
    {
        SendPlayerMessageToAll(playerid, "Oh My God");
        return 0;
    }
    return 1;
}
This wont show which player had typed "OMG" And support if you don't have anti spam player may do "OMG" again and again and your full server chat is wrecked.

Just use SendClientMessage.


Re: OnPlayerText - LocMax - 03.04.2014

pawn Код:
if(strfind("OMG", "OMG", true) != -1)
{
    new str[80], name[24];
    GetPlayerName(playerid, name, sizeof(name));
    format(str,sizeof(str), "%s(%d): Oh my god!", name, playerid);
    SendClientMessageToAll(str, -1);
}
Not sure if it'll work tho.


Re: OnPlayerText - forgottenkings - 03.04.2014

well Patrool my script does work and it will display the name of the one who types it....

just test before you say something :P


Re: OnPlayerText - Vince - 03.04.2014

Quote:
Originally Posted by [vTc]Patroool
Посмотреть сообщение
This wont show which player had typed "OMG" And support if you don't have anti spam player may do "OMG" again and again and your full server chat is wrecked.

Just use SendClientMessage.
Uh, yes it will. Please read how this function actually works.


Re: OnPlayerText - forgottenkings - 03.04.2014

i used sendplayermessagetoall not sendclientmessagetoall