I plan on switching all my commands over to zcmd, but I just one little question.. what exatly are params? Like; Command_buyvehicle(playerid,params[]) Can someone define params? I don't understand exactly what they are and how they're used. Thanks!
then the params[] will be "sultan 1 1", and that can be parsed with f.ex. sscanf inside your command to split it into the name, and the 2 colors.
Код:
new id,health;
if (sscanf(params,"ui",id,health))
{
SendClientMessage(playerid,MSGCOMM_COLOR, "Usage: \"/Heal <PlayerID / Name> <Percentage (1-100)>\"");
}
else if(id==INVALID_PLAYER_ID)
{
new string[256];
format(string,sizeof(string),"Player [%d] not found",id);
SendClientMessage(playerid,MSGFAIL_COLOR,string);
}
else
{ //here the parameters are ok, and are processed
SetPlayerHealth(id, health);
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid,Name,sizeof(Name));
new string[256];
format(string,sizeof(string),"[%d] %s healed you to %d\%",playerid,Name,health);
SendClientMessage(id,MSGSUCC_COLOR,string);
GetPlayerName(id,Name,sizeof(Name));
format(string,sizeof(string),"You healed [%d] %s to %d percent\"",id,Name,health);
SendClientMessage(playerid,MSGSUCC_COLOR,string);
}