OnPlayerRequestClass
#1

Guys,
i have 4 gangs or classes Defined like:

Код:
#define Grove 1
#define Ballas 2
#define Vagos 3
#define Mafia 4
and this is OnPlayerRequestClass:
Код:
public OnPlayerRequestClass(playerid, classid)
{
	switch(classid) // Switching between the classids
    {
         case 0:
         {
              SetPlayerTeam(playerid, Grove); // Setting players team
              GameTextForPlayer(playerid, "~g~Grove Gang", 3000, 3); // Screen msg for player to show what team
         }
         case 1:
         {
              SetPlayerTeam(playerid, Ballas); // Same as above
              GameTextForPlayer(playerid, "~r~Ballas Gang", 3000, 3); // Same as above
         }
         case 2:
         {
              SetPlayerTeam(playerid, Vagos); // Same as above
              GameTextForPlayer(playerid, "~y~Vagos Gang", 3000, 3); // Same as above
         }
         case 3:
         {
              SetPlayerTeam(playerid, Mafia); // Same as above
              GameTextForPlayer(playerid, "~w~Mafia Gang", 3000, 3); // Same as above
         }
    }
	return 1;
}
So i need that how can i see that if player is Vip or Admin so that he need to be part of Mafia gang
Only Vips and Admins can be Part of It !

My Enum For saving AdminLevel and Vip :
Код:
enum PlayerInfo
{
    Pass[129], //User's password
    Adminlevel, //User's admin level
    VIPlevel, //User's vip level
    Money, //User's money
    Scores, //User's scores
    Kills, //User's kills
    Deaths //User's deaths
}
Hope You help me !
Reply
#2

Can you show me the example of your PlayerInfo use?
Reply
#3

didnt used anywhere atm !
just in loading player data !
Reply
#4

It should be mentioned in new or somehing like that, like in https://sampwiki.blast.hk/wiki/Keywords:Initialisers#enum
Example: new GetPlayerInfo[MAX_PLAYERS][PlayerInfo]
Reply
#5

Note 1:
If you want to make any VIP/Admin have to be in Mafia class, comment the note use this script

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(getPlayerinfo[playerid][VIPlevel] >= 1 || getPlayerInfo[playerid][Adminlevel] >= 1)
    {
        SetPlayerTeam(playerid, Mafia);
        SendClientMessage(playerid, 0xFF0000, "VIP/Admin have to be in this class");
        GameTextForPlayer(playerid, "~w~Mafia Gang", 3000, 3);
        return 1;
    }
    switch(classid) // Switching between the classids
    {
         case 0:
         {
            SetPlayerTeam(playerid, Grove); // Setting players team
            GameTextForPlayer(playerid, "~g~Grove Gang", 3000, 3); // Screen msg for player to show what team
         }
         case 1:
         {
            SetPlayerTeam(playerid, Ballas); // Same as above
            GameTextForPlayer(playerid, "~r~Ballas Gang", 3000, 3); // Same as above
         }
         case 2:
         {
            SetPlayerTeam(playerid, Vagos); // Same as above
            GameTextForPlayer(playerid, "~y~Vagos Gang", 3000, 3); // Same as above
         }
    }
    return 1;
}
Note 2:
If you want to make the Mafia gang is only for the VIP/Admin use this
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    switch(classid) // Switching between the classids
    {
         case 0:
         {
            SetPlayerTeam(playerid, Grove); // Setting players team
            GameTextForPlayer(playerid, "~g~Grove Gang", 3000, 3); // Screen msg for player to show what team
         }
         case 1:
         {
            SetPlayerTeam(playerid, Ballas); // Same as above
            GameTextForPlayer(playerid, "~r~Ballas Gang", 3000, 3); // Same as above
         }
         case 2:
         {
            SetPlayerTeam(playerid, Vagos); // Same as above
            GameTextForPlayer(playerid, "~y~Vagos Gang", 3000, 3); // Same as above
         }
         case 3:
         {
            if(getPlayerinfo[playerid][VIPlevel] < 1 || getPlayerInfo[playerid][Adminlevel] < 1)
            {
                SendClientMessage(playerid, 0xFF0000, "This Class is only for Admin/VIP!");
                return 0;
            }
            SetPlayerTeam(playerid, Mafia); // Same as above
            GameTextForPlayer(playerid, "~w~Mafia Gang", 3000, 3); // Same as above
         }
    }
    return 1;
}
Dont forget to change the getPlayerInfo to your variable
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)