SA-MP Forums Archive
Simple problem with sscanf - 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: Simple problem with sscanf (/showthread.php?tid=348372)



Simple problem with sscanf - mrcoolballs - 05.06.2012

Hello,
I have returned to scripting after about 6 months and I'm having trouble with this one code,

pawn Код:
dcmd_setlevel(playerid,params[])
{
    new str[128],level; new name[24], id;

    if(sscanf(params,"ui",id,level))
        return SendClientMessage(playerid,WHITE,"Error.");

    GetPlayerName(id,name,24);
    PlayerInfo[id][Level] = level;
    UpdatePlayerFile(playerid);
    format(str,sizeof(str),"Admin %s has set your level to %d",name,level);
    SendClientMessage(id,WHITE,str);
    return 1;
}
The problem is, is that it is returning "SERVER: Unknown Command".

If I type /setlevel, I will get the message "Error", it is just when I fill out the id and level parameters I get the Unknown Command error.

Any help would be appreciated, thanks.


Re: Simple problem with sscanf - mrcoolballs - 05.06.2012

bump


Re: Simple problem with sscanf - Vince - 05.06.2012

Do not bump so soon! Wait at least 12 hours before bumping.

That code looks absolutely fine to me, though. Unless UpdatePlayerFile is returning 0.