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



sscanf - iBots - 31.08.2015

I have made a main command called /item, which can do few things, if i do like /item id, it works, if i type /item put it says /item put [id], but when i put an id, it doesnt say anything, it doesnt even send the text that says that command works, i tried two ways and nothing worked, the problem is here but i dont know where, in the main command i use sscanf and check if types the tmp which is a string
pawn Код:
if(strcmp(tmp, "put", true) == 0)
    {
        new id;
        SendClientMessage(playerid, -1, "Command before sscanf.");
        if(sscanf(params, "d", id)) return SendClientMessage(playerid, COLOR_GREY, "/item put [id]");
        SendClientMessage(playerid, -1, "Command works.");
    }
I also tried:
pawn Код:
if(strcmp(tmp, "put", true) == 0)
    {
        new id;
        SendClientMessage(playerid, -1, "Command before sscanf.");
        if(sscanf(params, "s[24]d", tmp, id)) return SendClientMessage(playerid, COLOR_GREY, "/item put [id]");
        SendClientMessage(playerid, -1, "Command works.");
    }
They both didnt


Re: sscanf - MarvinPWN - 31.08.2015

PHP код:
if(strcmp(tmp,"put",true) == 0)
{
    new 
id;
    
SendClientMessage(playerid,-1,"Command before sscanf.");
    if(
sscanf(tmp,"d",id))return SendClientMessage(playerid,COLOR_GREY,"/item put [id]");
    
SendClientMessage(playerid,-1,"Command works.");




Re: sscanf - iBots - 31.08.2015

anyone?doesnt work


Re: sscanf - iBots - 01.09.2015

bump


AW: sscanf - Nero_3D - 01.09.2015

I think the problem lies before that in the main command

if you use zcmd it could look like that
pawn Код:
CMD:item(playerid, params[]) {
    new
        command[32]
    ;
    sscanf(params, "s[32]S()[128]", command, params);

    if(strcmp(command, "put", true) == 0) {
        new
            id
        ;
        if(sscanf(params, "d", id)) {
            return SendClientMessage(playerid,COLOR_GREY,"/item put [id]");
        }
        return true
    }
    return SendClientMessage(playerid, COLOR_GREY, "/item [put|...]");
}