/devip issue.
#1

I have made a command /devip which gives SERVER: Unknown command.

pawn Код:
forward Deactivevip(playerid);
public Deactivevip(playerid){

        if(vip[playerid]) return 0;

        vip[playerid]=false;
        SendClientMessage(playerid, COLOR_GREY, "Your VIP subscription has been taken away by admin.");
        SendClientMessage(playerid, COLOR_WHITE, "Thanks for your donation.");
        return 1;
}
pawn Код:
CMD:devip(playerid,cmdtext[])
{
    new player;
    if(GetAdminLevel(playerid) >= 4)
    {
    if(sscanf(cmdtext,"u",player)){
    SendClientMessage(playerid, -1, "/devip [player id]");
    return 1;
    }
    else return SendClientMessage(playerid, COLOR_WHITE, "Woah");
    }
    SendClientMessage(playerid, COLOR_WHITE, "Deactivation successfull.");
    Deactivevip(player);
    return 1;
}
Reply
#2

First off all, your code will not work at all, you're deactivating it regardless of the player being admin or not, and its not using sscanf properly.

Try something like this;
pawn Код:
CMD:devip(playerid,cmdtext[])
{
    if(GetAdminLevel(playerid) >= 4)
    {
      new player;
      if(sscanf(cmdtext,"u",player)) return SendClientMessage(playerid, -1, "/devip [player id / name]");
      SendClientMessage(playerid, COLOR_WHITE, "Deactivation successfull.");
      Deactivevip(player);
    }
    else return SendClientMessage(playerid, COLOR_WHITE, "You're not an admin.");
    return 1;
}
Try looking into some SSCANF usage guides and perhaps (better) identation will be a nice thing to learn at the get go too.
Reply
#3

Wonderful, it works! But it actaully doesn't deactivates the VIP, I stil can access the commands. Can someone help me out there. By the way reputation incremented
Reply
#4

And use this instead:

pawn Код:
forward Deactivevip(playerid);
public Deactivevip(playerid){

        if(!vip[playerid]) return 0;

        vip[playerid]=false;
        SendClientMessage(playerid, COLOR_GREY, "Your VIP subscription has been taken away by admin.");
        SendClientMessage(playerid, COLOR_WHITE, "Thanks for your donation.");
        return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)