06.06.2010, 09:10
I prefer strtok.
Eg: The sethealth command in dcmd
Above is a very basic sethealth command using dcmd and strtok.
Eg: The sethealth command in dcmd
Код:
dcmd_sethealth(playerid,params[]) { if(!IsPlayerAdmin(playerid) return SendClientMessage(playerid,oxffffffaa, "You are not authorised to use this command"); new tmp[128],tmp2[128],health,targetid,Index; tmp=strtok(params,Index); tmp2=strtok(params,Index); if(!strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid, oxffffffaa, " Usage: /sethealth playerid health"); if(strval(tmp2)>100) return SendClientMessage(playerid, oxffffffaa, " Invalid health amount."); targetid=strval(tmp); health=strval(tmp2); SetPlayerHealth(targetid,health); return 1; }