Admin Say
#1

Hey guys fisrt Happy Orthodox New Year !

i have this code:
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '#')
    {
        if(IsPlayerAdmin(playerid))
        {
            new string[128];
            format(string, sizeof(string), ""SVETLOSMEDJA"[Admin]"BELA" %s: %s", imeigraca(playerid), text[1]);
            SendClientMessageToAll(-1, string);
            return 0;
        }
    }
    return 1;
}
and when an admin type # it sends an empty message and if he writes a message it shows the message but the problem is how to make it so he cant send an emtpy message i was trying to do it like
pawn Код:
if(sscanf(bla,bla,la)
but i made it wrong and its again sending empy messages
PS: Sorry for by bad english xD
Reply
#2

Use strlen:
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '#')
    {
        if(IsPlayerAdmin(playerid) && strlen(text) > 1)
        {
            new string[128];
            format(string, sizeof(string), ""SVETLOSMEDJA"[Admin]"BELA" %s: %s", imeigraca(playerid), text[1]);
            SendClientMessageToAll(-1, string);
            return 0;
        }
    }
    return 1;
}
Reply
#3

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)