SetVIP problem
#1

Here is my Setvip code that i personally made

PHP код:
CMD:setVIP(playeridparams[])
{
    new 
victimname[MAX_PLAYER_NAME], vipname[MAX_PLAYER_NAME], viplvlid;
    if(
IsPlayerAdmin(playerid))
    {
        if (
sscanf(params"ui"idviplvl)) return SendClientMessage(playeridCOLOR_RED"USAGE: /setvip [id] [viplevel]");
        if (
id == INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_RED"System: Invalid ID");
        if (
viplvl <= && viplvl >= 0) return SendClientMessage(playeridCOLOR_RED,"System: Valid vip Levels: 1-3!");
        
PlayerInfo[id][pVipLevel] = viplvl;
        
GetPlayerName(idvictimnamesizeof(victimname));
        
GetPlayerName(playeridvipnamesizeof(vipname));
        new 
str[128];
        
format(str,128,"System: %s [ID %d] has set %s [ID %d] admin level to %i",vipnameplayeridvictimnameidviplvl);
        
SendClientMessage(playerid,COLOR_GREEN,str);
        return 
1;
    }
    else return 
SendClientMessage(playerid,COLOR_RED,"  You are not allowed to use this command!");

So here's the problem, It doesn't work. None if the

if(PlayerInfo[playerid][pVipLevel] >= 3) work and when i type /setvip i got a response of Unknown Server Command. Whats the problem?
Reply
#2

You need to return 1 on the command itself.

pawn Код:
CMD:setVIP(playerid, params[])
{
    new victimname[MAX_PLAYER_NAME], vipname[MAX_PLAYER_NAME], viplvl, id;
    if(IsPlayerAdmin(playerid))
    {
        if (sscanf(params, "ui", id, viplvl)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setvip [id] [viplevel]");
        if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "System: Invalid ID");
        if (viplvl <= 3 && viplvl >= 0) return SendClientMessage(playerid, COLOR_RED,"System: Valid vip Levels: 1-3!");
        PlayerInfo[id][pVipLevel] = viplvl;
        GetPlayerName(id, victimname, sizeof(victimname));
        GetPlayerName(playerid, vipname, sizeof(vipname));
        new str[128];
        format(str,128,"System: %s [ID %d] has set %s [ID %d] admin level to %i",vipname, playerid, victimname, id, viplvl);
        SendClientMessage(playerid,COLOR_GREEN,str);
        return 1;
    }
    else return SendClientMessage(playerid,COLOR_RED,"  You are not allowed to use this command!");
    return 1;
}
Reply
#3

PHP код:
    else return SendClientMessage(playerid,COLOR_RED,"  You are not allowed to use this command!");
    return 
1;

The return 1; gives me a Unreachable code
Reply
#4

pawn Код:
CMD:setVIP(playerid, params[])
{
    new victimname[MAX_PLAYER_NAME], vipname[MAX_PLAYER_NAME], viplvl, id;
    if(IsPlayerAdmin(playerid))
    {
        if (sscanf(params, "ui", id, viplvl)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setvip [id] [viplevel]");
        if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "System: Invalid ID");
        if (viplvl > 3 || viplvl < 1) return SendClientMessage(playerid, COLOR_RED,"System: Valid vip Levels: 1-3!");
        PlayerInfo[id][pVipLevel] = viplvl;
        GetPlayerName(id, victimname, sizeof(victimname));
        GetPlayerName(playerid, vipname, sizeof(vipname));
        new str[128];
        format(str,128,"System: %s [ID %d] has set %s [ID %d] admin level to %i",vipname, playerid, victimname, id, viplvl);
        SendClientMessage(playerid,COLOR_GREEN,str);
        return 1;
    }
    else SendClientMessage(playerid,COLOR_RED,"  You are not allowed to use this command!");
    return 1;
}
Reply
#5

Try removing the return 1 from

pawn Код:
SendClientMessage(playerid,COLOR_GREEN,str);
        return 1;
Reply
#6

Nope, still didnt work
Reply
#7

Quote:
Originally Posted by Shockey HD
Посмотреть сообщение
Nope, still didnt work
Did you try what I said ?
Reply
#8

Quote:
Originally Posted by PrawkC
Посмотреть сообщение
Did you try what I said ?
Yea i found the problem /setVIP need to be /setvip No capitals are allowed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)