GameTextForAll - announcing
#1

i want to announce a message to everyone on my server my doing
/an [message] and have it go on there screen like the GameTextForAll function but i cant figure out how to do it, can anyone plz help!
Reply
#2

Search for strtok/sscanf
Reply
#3

i just need the pwn code plz
Reply
#4

pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if((strcmp(cmdtext, "/an", true, 3) == 0) && IsPlayerAdmin(playerid))
    {
        strdel(cmdtext, 0, 4);
        GameTextForAll(cmdtext, 2000, 3);
        return 1;
    }
    return 0;
}
There. You'll have to be logged into rcon to use it.
Reply
#5

Learn to code or ask in Scripting Request.
Reply
#6

thankyou Ghett0!
Reply
#7

Quote:
Originally Posted by ssǝן‾ʎ
Err, what happens if you type "/an" (nothing after)?
It'll just send " ". Though, if it bothers you that much...

pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if((strcmp(cmdtext, "/an", true, 3) == 0) && (strlen(cmdtext) => 5) && IsPlayerAdmin(playerid))
    {
        strdel(cmdtext, 0, 4);
        GameTextForAll(cmdtext, 2000, 3);
        return 1;
    }
    return 0;
}
Reply
#8

If GameTextFor** get an empty string to send, it will crash the server. I tested it
Reply
#9

Quote:
Originally Posted by Monti|spearrow
If GameTextFor** get an empty string to send, it will crash the server. I tested it
Yeah, I reposted the function with a fix.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)