31.07.2014, 22:53
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;
}