24.11.2012, 19:55
Do you want create commands with Parameters?
It's simple, if you use sscanf.
Here's an example again, but now with string and without sscanf.
It's simple, if you use sscanf.
pawn Код:
CMD:akill(playerid,params[])
{
new id; // We create a variable, to save target players ID.
// Player has used the command /akill, but without params.
if(sscanf(params, "u", id)) return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /akill (playerid)");
// We check is the target player connected or not.
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "Player is not connected.");
SetPlayerHealth(id, 0);
return 1;
}
pawn Код:
CMD:announce(playerid, params[])
{
if(!strlen(params)) return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /announce (text)");
GameTextForAll(params, 4000, 3);
return 1;
}