SA-MP Forums Archive
/asay not working - 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: /asay not working (/showthread.php?tid=641982)



/asay not working - DeStRoY232 - 23.09.2017

i made /asay cmd but when i type any message it doesn't work, it only show me Usage: /asay [message]




CODE :
PHP код:
COMMAND:asay(playeridparams[])
{
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playeridCOLOR_RED"You're not allowed to use this command");
    {
        new 
input[100], message[250];
        if(
sscanf(params"s[100]"input)) return SendClientMessage(playeridCOLOR_WHITE"{FF6600}Usage: {FFFFFF}/asay [message]");
        else
        {
            
format(messagesizeof(message), "{3604FF}[ADMIN] {FFFFFF}%s"input);
            
SendClientMessageToAll(COLOR_WHITEmessage);        
        }
    }
    return 
1;




Re: /asay not working - whadez - 23.09.2017

Update your sscanf, and learn how to write quality code, I can see tons of useless brackets, and that else is useless since if you cant fit for the requirements, the command will return.

Make the input string 128 characters long, and the message string 144 characters long.


Re: /asay not working - Kinta - 23.09.2017

Код:
COMMAND:asay(playerid, params[]) 
{ 
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You're not allowed to use this command"); 
    new input[100], message[250]; 
    if(sscanf(params, "s[100]", input)) return SendClientMessage(playerid, COLOR_WHITE, "{FF6600}Usage: {FFFFFF}/asay [message]"); 
    format(message, sizeof(message), "{3604FF}[ADMIN] {FFFFFF}%s", input); 
    SendClientMessageToAll(COLOR_WHITE, message);         
    return 1; 
}
Try this


Re: /asay not working - DeStRoY232 - 23.09.2017

where i can find updated sscanf?

EDITED:

i #include <sscanf2> and removed <sscanf>


Re: /asay not working - DeStRoY232 - 23.09.2017

FIXED! thanks all it was just about sscanf2 i was including sscanf before