IF to SWITCH
#10

Quote:
Originally Posted by CodeStyle175
Посмотреть сообщение
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 код:
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(idval);
    }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;

Some friends use ysi library instead of pawn.cmd, they recommanded me to use it.

Quote:
Originally Posted by Dutheil
Посмотреть сообщение
By using y_stringhash, you can do it.

PHP код:
switch(YHash(option))
{
    case 
_H<money>:
    {
    }
    case 
_H<level>:
    {
    }

That's what i wanted, thanks.
Reply


Messages In This Thread
IF to SWITCH - by Hazliu - 27.04.2018, 12:19
Re: IF to SWITCH - by CodeStyle175 - 27.04.2018, 12:23
Re: IF to SWITCH - by jasperschellekens - 27.04.2018, 12:26
Re: IF to SWITCH - by CodeStyle175 - 27.04.2018, 12:30
Re: IF to SWITCH - by jasperschellekens - 27.04.2018, 12:31
Re: IF to SWITCH - by CodeStyle175 - 27.04.2018, 12:34
Re: IF to SWITCH - by jasperschellekens - 27.04.2018, 12:36
Re: IF to SWITCH - by FnZ - 27.04.2018, 12:49
Re: IF to SWITCH - by Dutheil - 27.04.2018, 13:34
Re: IF to SWITCH - by Hazliu - 27.04.2018, 14:08

Forum Jump:


Users browsing this thread: 1 Guest(s)