command help
#1

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;
}
Reply
#2

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)