30.05.2010, 13:54
Quote:
Originally Posted by Conroy
I personally prefer using strtok to get the command parameters.
|
Example:
Код:
dcmd_sethealth(playerid,params) { If(IsPlayerAdmin(playerid) { new Index; new tmp[256]; tmp = strtok(params,Index); new tmp2[256]; tmp2 = strtok(params,Index); if(!strlen(tmp) || !strlen(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playerid, LIGHTBLUE2, "Usage: /sethealth [PlayerID] [Value]") && if(strval(tmp2) < 0 || strval(tmp2) > 100 && AccInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid, red, "ERROR: Invaild Health amount!"); new player1 = strval(tmp); new health = strval(tmp2); new string[128]; //and blablbla