SA-MP Forums Archive
Admin Say - 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: Admin Say (/showthread.php?tid=487537)



Admin Say - MatriXgaMer - 13.01.2014

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


Re: Admin Say - IstuntmanI - 13.01.2014

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;
}



Re: Admin Say - MatriXgaMer - 13.01.2014

Thanks