changeviplevel bugs
#1

I've made this command, /changeviplevel, which has an error to it.
Not a compilation error, but it just doesn't work how I want it and I can't work out what the problem is.
When I am set to admin level higher than 3, it let's me see the syntax when I type '/changeviplevel', but once I add a players ID and a level, it sends the message "You have made Disconnected/Nothing a level 5 VIP!" to the client.
I am putting my id, yet it still sends that message. Here is the command:

pawn Код:
cmd(changeviplevel, playerid, params[])
{
   
    if(Player[playerid][AdminLevel] < 3)
        return 1;

    new targetid;

   
    if(!IsPlayerConnected(targetid))
        return SendClientMessage(playerid, -1, "That player is offline!");

    new level, string[128];

    if(sscanf(params, "ud", targetid, level))
        return SendClientMessage(playerid, GREY, "SYNTAX: /changeviplevel [playerid] [level]");

   
    if(level < 0 || level > 5)
        return SendClientMessage(playerid, -1, "Valid VIP levels are 0-5!");

   
    Player[targetid][VIPLevel] = level;
    format(string, sizeof(string), "You have made %s a level %d VIP!", GetName(targetid), level);
    SendClientMessage(playerid, -1, string);
    foreach(Player, i)
    {
        if(Player[i][VIPLevel] < 1)
            continue;
        format(string, sizeof(string), "%s has been made a level %d VIP!", GetName(targetid), level);
        SendClientMessage(i, YELLOW, string);
    }

    return 1;
}
And here is my stock GetName():
pawn Код:
stock GetName(playerid)
{
    new name[MAX_PLAYER_NAME];
    if(!IsPlayerConnected(playerid))
        name = "Disconnected/Nothing";

    GetPlayerName(playerid, name, sizeof(name));
    return name;
}
All help will be appreciated!

Note: I am having issues with most of my commands that deal with me getting somebodies ID. Or an issue with GetName()
Reply


Messages In This Thread
changeviplevel bugs - by cosbraa - 06.06.2012, 16:06
Re: changeviplevel bugs - by MadeMan - 06.06.2012, 16:10
Re: changeviplevel bugs - by cosbraa - 07.06.2012, 12:07

Forum Jump:


Users browsing this thread: 1 Guest(s)