Problem: Only join team with level 2 or higher
#1

Heey guys,

I have made 3 teams in my gamemode now,

1. Terrorists
2. SWAT
3. Donator

But you can join donator with level 0

I want that you can only use donator team with level 2 or higher!

My script:

PHP код:
public OnPlayerRequestClass(playeridclassid)
{
    
Update3DTextLabelText(RankLabel[playerid], 0xFFFFFFFF" ");
    new 
Float:xFloat:yFloat:z;
    
GetPlayerPos(playeridx,y,z);
    switch(
classid)
    {
        case 
0:
        {
            
// TERRORISTS //
            
SetPlayerFacingAngle(playerid,280.0);
            
SetPlayerPos(playerid, -382.5999,2206.6169,42.4236);
            
SetPlayerCameraPos(playerid, -379.5999,2206.6169,42.4236);
            
SetPlayerCameraLookAt(playerid, -382.5999,2206.6169,42.4236CAMERA_MOVE);
            
TextDrawHideForPlayer(playeridA);
            
TextDrawHideForPlayer(playeridS);
            
TextDrawHideForPlayer(playeridU);
            
TextDrawHideForPlayer(playeridA2);
            
TextDrawShowForPlayer(playeridE);
            
gTeam[playerid] = TEAM_TERRORISTS;
            
SetPlayerTeam(playerid0);
            
SetPlayerSkin(playerid124);
            
SetPlayerColor(playeridTEAM_TERRORISTS_COLOR);
            
Update3DTextLabelText(RankLabel[playerid], 0xFFFFFFFF" ");
        }
        case 
1:
        {
            
// SWAT //
            
SetPlayerFacingAngle(playerid,180.0);
            
SetPlayerPos(playerid212.7791,1919.7570,17.6406);
            
SetPlayerCameraPos(playerid212.7791,1916.7570,17.6406);
            
SetPlayerCameraLookAt(playerid212.7791,1919.7570,17.6406CAMERA_MOVE);
            
TextDrawShowForPlayer(playeridA);
            
TextDrawHideForPlayer(playeridS);
            
TextDrawHideForPlayer(playeridU);
            
TextDrawHideForPlayer(playeridA2);
            
TextDrawHideForPlayer(playeridE);
            
SetPlayerTeam(playerid1);
            
SetPlayerSkin(playerid285);
            
gTeam[playerid] = TEAM_SWAT;
            
SetPlayerColor(playeridTEAM_SWAT_COLOR);
            
Update3DTextLabelText(RankLabel[playerid], 0xFFFFFFFF" ");
        }
        case 
2:
        {
            
// DONATOR //
            
SetPlayerFacingAngle(playerid250.0);
            
SetPlayerPos(playerid219.7300,1822.7803,7.5293);
            
SetPlayerCameraPos(playerid226.8338,1823.0217,7.4141);
            
SetPlayerCameraLookAt(playerid100.8338,1823.0217,7.4141CAMERA_MOVE);
            
TextDrawShowForPlayer(playeridS);
            
TextDrawHideForPlayer(playeridA);
            
TextDrawHideForPlayer(playeridU);
            
TextDrawHideForPlayer(playeridA2);
            
TextDrawHideForPlayer(playeridE);
            
SetPlayerSkin(playerid123);
            
SetPlayerTeam(playerid2);
            
gTeam[playerid] = TEAM_DONATOR;
            
SetPlayerColor(playeridTEAM_DONATOR_COLOR);
            
Update3DTextLabelText(RankLabel[playerid], 0xFFFFFFFF" ");
        }
    }
    return 
1;

Please Help
Reply
#2

Can you send the donator rank enum?
Reply
#3

What do you mean?
Reply
#4

Like PlayerInfo[playerid][pDonator] , Donatorlevel[playerid] or anything...
Reply
#5

Send us your enum.
Reply
#6

PHP код:
// Enums
enum PlayerData
{
    
Registered,
    
LoggedIn,
    
Level,
    
Helper,
    
Tag,
    
dRank,
    
Muted,
    
Caps,
    
Jailed,
    
JailTime,
    
Frozen,
    
FreezeTime,
    
Kills,
    
Deaths,
    
hours,
    
mins,
    
secs,
    
TotalTime,
    
ConnectTime,
     
MuteWarnings,
    
Warnings,
    
Spawned,
    
TimesSpawned,
    
God,
    
GodCar,
    
DoorsLocked,
    
SpamCount,
    
SpamTime,
    
PingCount,
    
PingTime,
    
blip,
    
blipS,
    
pColour,
    
pCar,
    
SpecID,
    
SpecType,
    
OnDuty,
    
bool:AllowedIn,
    
FailLogin
};
new 
PlayerInfo[MAX_PLAYERS][PlayerData];
enum ServerData
{
    
MaxPing,
    
ReadPMs,
    
ReadCmds,
    
MaxAdminLevel,
    
AdminOnlySkins,
    
AdminSkin,
    
AdminSkin2,
    
NameKick,
    
PartNameKick,
    
AntiSpam,
     
AntiSwear,
     
NoCaps,
    
Locked,
    
Password[128],
    
GiveWeap,
    
GiveMoney,
    
ConnectMessages,
    
AdminCmdMsg,
    
AutoLogin,
    
MaxMuteWarnings,
    
DisableChat,
    
MustLogin,
    
MustRegister,
}; 
Reply
#7

Do it under OnPlayerRequestSpawn callback
PHP код:
public OnPlayerRequestSpawn(playerid)
{
    if(
GetPlayerSkin(playerid)==//Donator's skin id)
    
{
         if(
PlayerInfo[playerid][Level]<2)
         {
              
SendClientMessage(playerid, -1"You must be level 2 or above to select this class.");
              return 
0;
          }
     }
     return 
1;

Reply
#8

Quote:
Originally Posted by ATGOggy
Посмотреть сообщение
Do it under OnPlayerRequestSpawn callback
PHP код:
public OnPlayerRequestSpawn(playerid)
{
    if(
GetPlayerSkin(playerid)==//Donator's skin id)
    
{
         if(
PlayerInfo[playerid][Level]<2)
         {
              
SendClientMessage(playerid, -1"You must be level 2 or above to select this class.");
              return 
0;
          }
     }
     return 
1;

I have done that but then I compile it but my compiler crash...
Reply
#9

Did you replace the donator's skin id with the id?
Reply
#10

No wait I'll try
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)