OnPlayerText
#1

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

Thanks in advance!
Reply
#2

Here it is

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

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.
Reply
#4

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.
Reply
#5

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

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.
Reply
#7

i used sendplayermessagetoall not sendclientmessagetoall
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)