Class Selection problem
#1

Hi, i'am scripting a system and i have a small problem , when the player choose this ClassPolice or ClassMafia he will spawn at locations 0.0 0.0 0.0
PHP код:
        case ClassPolice:
        {
            
// Count the number of normal players (all classes except police) and count the amount of police players
            
new NormalPlayersPolicePlayersbool:CanSpawnAsCop false;
            
// Block this check if PlayersBeforePolice is set to 0 (this allows anyone to join as police)
            
if (PlayersBeforePolice 0)
            {
                
// Loop through all players
                
for (new pidpid MAX_PLAYERSpid++)
                {
                    
// Exclude this player, as he doesn't have a class yet, he's still choosing here
                    
if (pid != playerid)
                    {
                        
// Also exclude all players who are still in the class-selection screen, as they don't have a class selected yet
                        
if (GetPlayerInterior(pid) != 14)
                        {
                            
// Check if this player is logged in
                            
if (APlayerData[pid][LoggedIn] == true)
                            {
                                
// Count the amount of normal players and police players
                                
switch (APlayerData[pid][PlayerClass])
                                {
                                    case 
ClassPolice:
                                        
PolicePlayers++;
                                    case 
ClassTruckDriverClassBusDriverClassPilotClassMafiaClassCourierClassRoadWorkerClassMarinClassTrainClassPizzaClassAssistanceClassTaxiClassBucheron:
                                        
NormalPlayers++;
                                }
                            }
                        }
                    }
                }
                
// Check if there are less police players than allowed
                // or allow police if less than 3 players
                // or allow police for admin and modo
                
if (PolicePlayers < (NormalPlayers PlayersBeforePolice) || NormalPlayers || APlayerData[playerid][PlayerLevel] == || strcmp("trucking"APlayerData[playerid][PlayerName], true24) == 0)
                    
CanSpawnAsCop true// There are less police players than allowed, so the player can choose this class
                
else
                    
CanSpawnAsCop false// The maximum amount of police players has been reached, the player can't choose to be a cop
                // Check if the player isn't allowed to spawn as police
                
if (CanSpawnAsCop == false)
                {
                    
// Let the player know the maximum amount of cops has been reached
                    
GameTextForPlayer(playerid"Le nombre maximum de policier est atteint"50004);
                    
SendClientMessage(playerid0xFFFFFFFF"{FF0000}Le nombre maximum de policier est atteint, sйlectionnez une autre classe");
                    return 
0// Don't allow the player to spawn as police player
                
}
            }
            if(
Factions[APlayerData[playerid][Team]][Type] == 2)
            {
                
// If the player has a wanted level
                
if (GetPlayerWantedLevel(playerid) > 0)
                {
                    
// Let the player know he cannot have a wanted level to join police
                    
GameTextForPlayer(playerid"Vous n'etes pas autorises"50004);
                    
SendClientMessage(playerid0xFFFFFFFF"{FF0000}Vous n'кtes pas autorisй а rejoindre la police lorsque vous кtes recherchй.");
                    return 
0// Don't allow the player to spawn as police player
                
}
                
Index random(sizeof(ASpawnLocationsPolice));
                
ASpawnLocationsPolice[Index][SpawnX]; // Get the X-position for the spawnlocation
                
ASpawnLocationsPolice[Index][SpawnY]; // Get the Y-position for the spawnlocation
                
ASpawnLocationsPolice[Index][SpawnZ]; // Get the Z-position for the spawnlocation
                
Angle ASpawnLocationsPolice[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
                
format(Msg128"{00FF00}Le joueur {FFFF00}%s{00FF00} a rejoint {FFFF00}la police"Name);
            }
            else {
                
GameTextForPlayer(playerid"Vous n'etes pas autorises"50004);
                
SendClientMessage(playerid0xFFFFFFFF"{FF0000}Cette classe est rйservй a la faction Flic.");
                return 
0// Don't allow the player to spawn as police player
            
}
        }
        case 
ClassMafia:
        {
            if (
Factions[APlayerData[playerid][Team]][Type] == 1)
            {
                
Index random(sizeof(ASpawnLocationsMafia));
                
ASpawnLocationsMafia[Index][SpawnX]; // Get the X-position for the spawnlocation
                
ASpawnLocationsMafia[Index][SpawnY]; // Get the Y-position for the spawnlocation
                
ASpawnLocationsMafia[Index][SpawnZ]; // Get the Z-position for the spawnlocation
                
Angle ASpawnLocationsMafia[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
                
format(Msg128"{00FF00}Le joueur {FFFF00}%s{00FF00} a rejoint {FFFF00}la mafia"Name);
            }
            else
            {
                
// Let the player know he needs 200 scorepoints
                
GameTextForPlayer(playerid"Vous n'кtes pas autorisй a rejoindre cette classe."50004);
                
SendClientMessage(playerid0xFFFFFFFF"{FF0000}Cette classe est rйservй a la faction Mafia.");
                return 
0;
            }
        }
    }
    
// Spawn the player with his chosen skin at a random location based on his class
    
SetSpawnInfo(playerid0GetPlayerSkin(playerid), xyzAngle000000); 
Reply


Messages In This Thread
Class Selection problem - by AlexBlack - 31.05.2015, 13:59
Re: Class Selection problem - by semara123 - 31.05.2015, 14:10
Re : Class Selection problem - by AlexBlack - 31.05.2015, 14:18
Re: Class Selection problem - by semara123 - 31.05.2015, 14:24
Re: Class Selection problem - by SoFahim - 31.05.2015, 15:31
Re: Class Selection problem - by Konstantinos - 31.05.2015, 15:39
Re: Class Selection problem - by amirm3hdi - 31.05.2015, 15:43
Re : Class Selection problem - by AlexBlack - 03.06.2015, 22:46
Re : Re: Class Selection problem - by AlexBlack - 04.06.2015, 14:42

Forum Jump:


Users browsing this thread: 1 Guest(s)