Need help with sscanf in cmd
#5

Quote:
Originally Posted by MikeEd
Посмотреть сообщение
I dont think this code works in any way, i've tried countless solutions and results are the same. So i'd suggest using a different method for this command. you could do something like this

pawn Код:
CMD:test1(playerid,params[])
{
    new item[10];
    if(sscanf(params,"s[10]", item)) return SendClientMessage(playerid, -1, "USE: /test1");
    if(!strcmp(params, "drugs"))
    {
        SendClientMessage(playerid,-1,"drugs OK");
    }
    return 1;
}
pawn Код:
CMD:mats(playerid,params[])
{
    new slot;
    if(sscanf(params,"i", slot)) return SendClientMessage(playerid, -1, "USE: /mats [1-2]");
    if(!strcmp(params, "1"))
    {
        SendClientMessage(playerid,-1,"mats 1 OK");
    }
    if(!strcmp(params, "2"))
    {
        SendClientMessage(playerid,-1,"mats 2 OK");
    }
    return 1;
}
Thank you, but this is not an option

without sscanf it work, but i need with sscanf

PHP код:
if(!strcmp(cmdtext,"/irc",true))

    new 
x_nr[256];
    
x_nr strtok(cmdtextidx);
    if(!
strlen(x_nr)) return SCM(playerid,-1,"USE: /test1"); 
    if(!
strcmp(x_nr,"drugs",true)) 
    { 
        
SCM(playerid,-1,"drugs OK"); 
        return 
true
    } 
    else if(!
strcmp(x_nr,"mats",true)) 
    { 
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp)) return SCM(playerid,-1,"USE: /test1 mats [1-2] 1"); 
        if(
slot || slot 1) return SCM(playerid,-1,"USE: /test1 mats [1-2] 2"); 
        
SCM(playerid,-1,"mats OK"); 
        return 
true
    } 
    return 
true

Reply


Messages In This Thread
Need help with sscanf in cmd - by Reim - 12.09.2014, 01:59
Re: Need help with sscanf in cmd - by krytans - 12.09.2014, 02:35
Re: Need help with sscanf in cmd - by Reim - 12.09.2014, 02:48
Re: Need help with sscanf in cmd - by MikeEd - 12.09.2014, 03:57
Re: Need help with sscanf in cmd - by Reim - 12.09.2014, 04:05
Re: Need help with sscanf in cmd - by MikeEd - 12.09.2014, 04:12
Re: Need help with sscanf in cmd - by Reim - 12.09.2014, 15:23

Forum Jump:


Users browsing this thread: 1 Guest(s)