SA-MP Forums Archive
command help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: command help (/showthread.php?tid=221853)



command help - YungGee - 06.02.2011

Please help my command sets id 0 only regardless of what id i state, Ive tried everything.

pawn Код:
CMD:setvip(playerid, params[])
{
    new vip,id,file[256],str[128],name[MAX_PLAYER_NAME];
    GetPlayerName(id,name,MAX_PLAYER_NAME);
    format(file,sizeof(file),"Admin/Accounts/%s.txt",name);
    if(pInfo[playerid][Level] < 5) return SendClientMessage(playerid,RED,">> Your Not A High Enough Level To Use This Command!");
    if(sscanf(params, "Ui", id, vip)) return SendClientMessage(playerid,RED,"USAGE: /setvip [id] [level]");
    if(!IsPlayerConnected(id))return SendClientMessage(playerid,RED,">> Player Not Found!");
    pInfo[id][VIP] = vip;
    dini_IntSet(file,"VIP",vip);
    format(str,sizeof(str),">> You Have Set %s's VIP Level To %d!",name,vip);
    SendClientMessage(playerid,YELLOW,str);
    GameTextForPlayer(id,"~g~Promotion!",3000,5);
    return true;
}



Re: command help - xRyder - 06.02.2011

Okay, I edited it a little to try it out on my system and command worked.

pawn Код:
COMMAND:setvip(playerid, params[])
{
    new level,id,file[128],str[128],name[MAX_PLAYER_NAME];
    GetPlayerName(id,name,sizeof(name));
    format(file,sizeof(file),"Admin/Accounts/%s.txt",name);
   
    if(!sscanf(params, "ui",id,level))
    {
        if(pInfo[playerid][Level] >= 5)
        {
            if(IsPlayerConnected(id))
            {
                pInfo[id][VIP] = level;
                dini_IntSet(file,"VIP",level);
                format(str,sizeof(str),"You Have Set %s's VIP Level To %d!",name,level);
                SendClientMessage(playerid,YELLOW,str);
                GameTextForPlayer(id,"~g~Promotion!",3000,5);
            }
            else return SendClientMessage(playerid,RED,"Player Not Found!");
        }
        else return SendClientMessage(playerid,RED,"Your Not A High Enough Level To Use This Command!");
    }
    else return SendClientMessage(playerid,RED,"USAGE: /setvip [id] [level]");
    return 1;
}