23.10.2015, 14:37
hi guys, i have problem with sscanf, i have this command:
and when i type: /setstats its okay, and when i type setstats MYID Level, then set me lvl to 0, thats okay too but when i type /setstats MYID Level 15 then i get a message Unknow type!
i want to code be like that cuz in some cases i have more parameters like: /setstats MYID Skill Driving 5
PHP код:
CMD:setstats(playerid, params[]) {
new id, sta[126], string[256];
if(sscanf(params, "us[126]", id, sta)) {
SCM(playerid, -1, "{07C1F5}/setstat {FFFFFF}[ID/name] [Type]");
SCM(playerid, -1, "{07C1F5}Vrste: {FFFFFF} Level");
return 1;
}
if(strcmp(sta,"Level", true) == 0) {
new lvl;
if(sscanf(params, "us[126]i", id, sta, lvl)) return SCMF(playerid,-1,"{07C1F5}/setstat {FFFFFF}%d %s [Amount]",id,sta);
PI[id][Level] = lvl;
SetPlayerScore(id, lvl);
}
else return SCM(playerid,GRAD2,"Unknow type!");
i want to code be like that cuz in some cases i have more parameters like: /setstats MYID Skill Driving 5