16.01.2010, 09:18
the params[] consists the string (text) after your command - if you type:
/buyvehicle sultan 1 1
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.
coz iam too lazy now, heres a heal command:
/buyvehicle sultan 1 1
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.
coz iam too lazy now, heres a heal command:
Код:
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); }