21.12.2010, 12:49
Everyone should know that on dcmd you basically do it for 1 parament:
And with 2 or more paraments, you have to do it:
And on strtok/strcmp, for 1 parament:
But the question is: how do I do with over 1 parament using strcmp?
pawn Код:
dcmd_kick(playerid,params[])
{
new id = strval(params); // Basic example
if(IsPlayerConnected(id)) Kick(id);
return 1;
}
pawn Код:
dcmd_kick(playerid,params[])
{
new id, reason,tmp[256],tmp2[256],Index;
tmp = strtok(params,Index);
tmp2 = strtok(params, Index);
if(!strval(tmp) && !strval(tmp2)) return false;
else return Kick(id);
return 1;
}
And on strtok/strcmp, for 1 parament:
pawn Код:
if(strcmp("/kick",cmdtext,true,10) == 0)
{
new tmp[256],idx; tmp = strtok(cmdtext, idx);
new id = strval(tmp);
Kick(id);
return 1;
}