SA-MP Forums Archive
Problem with sscanf or what? - 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: Problem with sscanf or what? (/showthread.php?tid=489826)



Problem with sscanf or what? - Problems - 24.01.2014

I got a problem that when i use any command that i must write the full usage of the command
Example
pawn Код:
dcmd_adkill(playerid,params[])
{
    new string[128];
    new ID;
    new cmdreason[100];
    if(sscanf(params,"us[100]",ID,cmdreason))
    {
        SendClientMessage(playerid,COLOR_ERROR,"**USAGE: /adkill (Player Name/ID) (Reason)");
        SendClientMessage(playerid,COLOR_LIME,"It will Kill the player");
        return 1;
    }
    if(!IsPlayerConnected(ID))
    {
        format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot kill them.",ID);
        SendClientMessage(playerid,COLOR_ERROR,string);
        return 1;
    }
    if(IsKidnapped[playerid] != 0)
    {
        SendClientMessage(playerid,COLOR_ERROR,"**You are Kidnaped you can't use this command");
        return 1;
    }
    format(string,sizeof(string),"%s has killed %s(%d) for reason: %s.",PlayerName(playerid),PlayerName(ID),ID,cmdreason);
    SendClientMessageToAll(COLOR_ADMIN,string);
   
    format(string,sizeof(string),"[ADMIN-COMMAND] %s(%d) has used /adkill on %s(%d)",PlayerName(playerid),playerid,PlayerName(ID),ID);
    SendClientMessageToAllAdmins(string);
    SetPlayerHealth(ID,0);
    return 1;
}
It tells me **USAGE: /adkill (Player Name/ID) (Reason)


Re: Problem with sscanf or what? - Shetch - 24.01.2014

Код:
if(sscanf(params,"rs[100]",ID,cmdreason))



Re: Problem with sscanf or what? - Problems - 24.01.2014

Quote:
Originally Posted by Shetch
Посмотреть сообщение
Код:
if(sscanf(params,"rs[100]",ID,cmdreason))
Same Problem.


Re: Problem with sscanf or what? - Shetch - 24.01.2014

Wait, so you want to /adkill without writing the reason?


Re: Problem with sscanf or what? - sDAAw - 24.01.2014

Код:
if(sscanf(params,"us[100]",ID,cmdreason)) return SendClientMessage(playerid,COLOR_ERROR,"**USAGE: /adkill (Player Name/ID) (Reason)");



Re: Problem with sscanf or what? - Problems - 24.01.2014

Not that command , all commands were working but i stopped scripting for a while then tried to test it and found that all commands don't work , this command is just an example of many.


Re: Problem with sscanf or what? - Brandon_More - 24.01.2014

pawn Код:
if(sscanf(params,"us",ID,cmdreason))



Re: Problem with sscanf or what? - Problems - 24.01.2014

Quote:
Originally Posted by Brandon_More
Посмотреть сообщение
pawn Код:
if(sscanf(params,"us",ID,cmdreason))
Quote:
Originally Posted by Problems
Посмотреть сообщение
Not that command , all commands were working but i stopped scripting for a while then tried to test it and found that all commands don't work , this command is just an example of many.
^^^^


Re: Problem with sscanf or what? - Problems - 24.01.2014

Anyone?


Re: Problem with sscanf or what? - Problems - 25.01.2014

Bump!