/makevip
#1

Hey guys,

i made this cmd for Admins:
/makeadmin
Код:
COMMAND:makeadmin(playerid, params[])
{
    new id;
    new AdminLevel2;
    if(IsPlayerConnected(id))
    {
        if(PlayerInfo[playerid][AdminLevel] >= 5 || IsPlayerAdmin(playerid))
        {
            if(!sscanf(params, "ui", id, AdminLevel2))
            {
                if((AdminLevel2 >= 1 && AdminLevel2 <= 5) || AdminLevel2 == 0)
                {
                    new string[64];
                    new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
                    GetPlayerName(playerid, name, sizeof(name));
                    GetPlayerName(id, PlayerName, sizeof(PlayerName));
                    format(string, sizeof(string), "%s Has Promoted you to Admin Level %d.", name, AdminLevel2);
                    SendClientMessage(id, 0xD8D8D8FF, string);
                    format(string, sizeof(string), "You Have promoted %s to Admin Level %d.",PlayerName, AdminLevel2);
                    SendClientMessage(playerid, 0xD8D8D8FF, string);
                    PlayerInfo[id][AdminLevel] = AdminLevel2;
                    return 1;
                }
                else return SendClientMessage(playerid, 0xD8D8D8FF, "Levels: 1, 2, 3, 4 and 5.");
            }
            else return SendClientMessage(playerid, 0xD8D8D8FF, "USAGE: /makeadmin [PlayerId/PartOfName] [AdminLevel]");
        }
        else return SendClientMessage(playerid, 0xD8D8D8FF, "You Need to Be RCON Admin to use this Command.");
    }
    else return SendClientMessage(playerid, 0xD8D8D8FF, "Player Is Not Connected");
}
Can someone make same for VIP?
my Enum:
Код:
enum pInfo
{
        AdminLevel,
        VipLevel,
        Cash,
        Score,
        Color,
        Vw,
        Int,
        Warns,
        Prods,
        RepairOffer,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
Thanks.
Reply
#2

Wrong code.
Reply
#3

Код:
D:\SETUPS\GAMESP~1\Server\FILTER~1\tAdmin.pwn(226) : error 017: undefined symbol "AdminLevel2"
D:\SETUPS\GAMESP~1\Server\FILTER~1\tAdmin.pwn(228) : error 017: undefined symbol "AdminLevel2"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Line 226:
Код:
if(!sscanf(params, "ui", id, AdminLevel2))
Line 228:
Код:
if((AdminLevel2 >= 1 && AdminLevel2 <= 5) || AdminLevel2 == 0)
I just want 1 Level!
Reply
#4

It's different though, because you did not tell us how many levels etc, so I made as I know it. 0 is non VIP and 1 is VIP.
pawn Код:
COMMAND:makevip(playerid, params[])
{
    new id;
    new VipLevel2;
    if(PlayerInfo[playerid][AdminLevel] >= 5 || IsPlayerAdmin(playerid))
    {
        if(!sscanf(params, "ri", id, VipLevel2))
        {
            if(IsPlayerConnected(id))
            {
                if(VipLevel2 == 0 || VipLevel2 == 1)
                {
                    new string[64];
                    new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
                    GetPlayerName(playerid, name, sizeof(name));
                    GetPlayerName(id, PlayerName, sizeof(PlayerName));
                    if(VipLevel2 == 1)
                    {
                        format(string, sizeof(string), "%s Has Promoted you to VIP", name);
                        SendClientMessage(id, 0xD8D8D8FF, string);
                        format(string, sizeof(string), "You Have promoted %s to VIP",PlayerName);
                        SendClientMessage(playerid, 0xD8D8D8FF, string);
                    }
                    else
                    {
                        format(string, sizeof(string), "%s Has Demoted you from VIP.", name);
                        SendClientMessage(id, 0xD8D8D8FF, string);
                        format(string, sizeof(string), "You Have demoted %s from VIP.",PlayerName);
                        SendClientMessage(playerid, 0xD8D8D8FF, string);
                    }
                    PlayerInfo[id][VipLevel] = VipLevel2;
                    return 1;
                }
                else return SendClientMessage(playerid, 0xD8D8D8FF, "Levels: 0 and 1.");
            }
            else return SendClientMessage(playerid, 0xD8D8D8FF, "Player Is Not Connected");
        }
        else return SendClientMessage(playerid, 0xD8D8D8FF, "USAGE: /makevip [PlayerId/PartOfName] [VipLevel]");
    }
    else return SendClientMessage(playerid, 0xD8D8D8FF, "You Need to Be RCON Admin to use this Command.");
}
IMPORTANT: It will cause problems that you check if the id is connected player before the sscanf. It should be under of it.
Reply
#5

pawn Код:
COMMAND:makevip(playerid, params[])
{
    new id;
    new VipLevel2;
    if(IsPlayerConnected(id))
    {
        if(PlayerInfo[playerid][AdminLevel] >= 5 || IsPlayerAdmin(playerid))
        {
            if(!sscanf(params, "ui", id, VipLevel2))
            {
                if((VipLevel2 ==1)
                {
                    new string[64];
                    new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
                    GetPlayerName(playerid, name, sizeof(name));
                    GetPlayerName(id, PlayerName, sizeof(PlayerName));
                    format(string, sizeof(string), "%s Has Promoted you to Vip Level %d.", name, VipLevel2);
                    SendClientMessage(id, 0xD8D8D8FF, string);
                    format(string, sizeof(string), "You Have promoted %s to Vip Level %d.",PlayerName, VipLevel2);
                    SendClientMessage(playerid, 0xD8D8D8FF, string);
                    PlayerInfo[id][VipLevel] = VipLevel2;
                    return 1;
                }
                else return SendClientMessage(playerid, 0xD8D8D8FF, "Levels: 1, 2, 3, 4 and 5.");
            }
            else return SendClientMessage(playerid, 0xD8D8D8FF, "USAGE: /makeVip [PlayerId/PartOfName] [AdminLevel]");
        }
        else return SendClientMessage(playerid, 0xD8D8D8FF, "You Need to Be RCON Admin to use this Command.");
    }
    else return SendClientMessage(playerid, 0xD8D8D8FF, "Player Is Not Connected");
}
Reply
#6

Nevermind, too late.
Reply
#7

Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)