YCMD:set(playerid, params[], help) { if(playerVariables[playerid][pAdmin] <= 4) return AdminOnly(playerid, 5); if (isnull(params)) { Syntax(playerid, "/set <option> <playerid> <value>"); SCM(playerid, COLOR_SERVER, "Options: {FFFFFF}money, level"); return 1; } new toplayerid, value; if (!strcmp(params, "money", true, 5)) { if(sscanf(params[5], "ui", toplayerid, value)) return Syntax(playerid, "/set money <playerid> <value>"); if(toplayerid == INVALID_PLAYER_ID) return Syntax(playerid, "/set money <playerid> <value>"); SetMoney(toplayerid, value); return 1; } if (!strcmp(params, "level", true, 5)) { if(sscanf(params[5], "ui", toplayerid, value)) return Syntax(playerid, "/set level <playerid> <value>"); if(toplayerid == INVALID_PLAYER_ID) return Syntax(playerid, "/set level <playerid> <value>"); UpdateVar(playerid, "Level", value); return 1; } return 1; }
CMD:set(pid,p[]){
if(sscanf(p,"us[30]d",id,p,val)){
scm(pid,-1,"/set <playerid> <option> <value>");
return scm(pid,-1,"options: money, level";
}
if(!IsPlayerConnected(id))return scm(pid,-1,"player isn't connected.");
if(!strcmp(p,"money")){
SetMoney(id, val);
}else if(!strcmp(p,"level")){
if(lvl < 0)return scm(pid,-1,"Level can't be lower then 0!");
UpdateVar(id, "Level", val);
}
return 1;
}
well in php you can switch between strings, but pwn doesn't allow it.
|
switch(var[playerid])
{
case 0: // when var[playerid] is 0
case 1: // when var[playerid] is 1
}
switch(p){
case "level":{}
case "money":{}
}
jaspers why are you arguing with me you already failed why are you trying again?
|
YCMD:set(playerid, params[], help) { if(playerVariables[playerid][pAdmin] <= 4) return AdminOnly(playerid, 5); new option[32], id, value; if(sscanf(params, "sud", option, id, value)) { Syntax(playerid, "/set <option> <playerid> <value>"); SCM(playerid, COLOR_SERVER, "Options: {FFFFFF}money, level"); return 1; } new bool:foundOption = false; if(!strcmp(option, "money", true, 5)) { if(id == INVALID_PLAYER_ID) return Syntax(playerid, "/set money <playerid> <value>"); SetMoney(id, value); foundOption = true; } else if(!strcmp(option, "level", true)) { if(id == INVALID_PLAYER_ID) return Syntax(playerid, "/set level <playerid> <value>"); UpdateVar(playerid, "Level", value); foundOption = true; } if(!foundOption) SCM(playerid, COLOR_SERVER, "Options: {FFFFFF}money, level"); return 1; }
switch(YHash(option))
{
case _H<money>:
{
}
case _H<level>:
{
}
}
well in php you can use switch for strings, but pwn doesn't allow it.
and i would suggest you to use pawn.cmd fastest command engine. PHP код:
|
By using y_stringhash, you can do it.
PHP код:
|