subcmd in zcmd.
#8

Exactly, even if you use sscanf, you STILL need to use strcmp to find out if they typed 'LSPD' or another place for example. SSCANF isn't a miracle, it won't suddenly make functions like 'strcmp' more efficient or faster. You're literally assigning 'params' to a variable and reusing that variable when you can just be using params the whole way through.

pawn Код:
CMD:tp(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, -1, "Usage: /tp [place]");
    if(!strcmp(params, "lspd", true))
    {
        //Player wants to teleport to LSPD
    }
    else if(!strcmp(params, "los santos", true))
    {
        //Player wants to teleport to Los Santos
    }
    else SendClientMessage(playerid, -1, "You have entered an invalid location, try again.");
    return 1;
}
Reply


Messages In This Thread
subcmd in zcmd. - by Baltimore - 31.07.2014, 14:49
Re: subcmd in zcmd. - by Stinged - 31.07.2014, 14:50
Re : subcmd in zcmd. - by Baltimore - 31.07.2014, 15:01
Re: subcmd in zcmd. - by Stinged - 31.07.2014, 15:05
Re : subcmd in zcmd. - by Baltimore - 31.07.2014, 17:35
Re: subcmd in zcmd. - by BlackM - 31.07.2014, 17:40
Re: subcmd in zcmd. - by Stinged - 31.07.2014, 18:00
Re: subcmd in zcmd. - by Threshold - 31.07.2014, 22:53
Re: subcmd in zcmd. - by Baltimore - 30.08.2014, 11:26
Re: subcmd in zcmd. - by JacobEdwards - 31.08.2014, 01:35

Forum Jump:


Users browsing this thread: 1 Guest(s)