23.07.2014, 12:23
Quote:
public OnPlayerRequestSpawn(playerid) { new Index, Float, Float:y, Float:z, Float:Angle, Name[24], Msg[128]; // Get the player's name GetPlayerName(playerid, Name, sizeof(Name)); // Choose a random spawnlocation based on the player's class switch (APlayerData[playerid][PlayerClass]) { case ClassTruckDriver: { Index = random(sizeof(ASpawnLocationsTrucker)); // Get a random array-index to chose a random spawnlocation x = ASpawnLocationsTrucker[Index][SpawnX]; // Get the X-position for the spawnlocation y = ASpawnLocationsTrucker[Index][SpawnY]; // Get the Y-position for the spawnlocation z = ASpawnLocationsTrucker[Index][SpawnZ]; // Get the Z-position for the spawnlocation Angle = ASpawnLocationsTrucker[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation format(Msg, 128, "{FFFF00}O Jogador {FFFFFF}%s{FFFF00} Entrou como um Caminhoneiro.", Name); } case ClassBusDriver: { Index = random(sizeof(ASpawnLocationsBusDriver)); x = ASpawnLocationsBusDriver[Index][SpawnX]; // Get the X-position for the spawnlocation y = ASpawnLocationsBusDriver[Index][SpawnY]; // Get the Y-position for the spawnlocation z = ASpawnLocationsBusDriver[Index][SpawnZ]; // Get the Z-position for the spawnlocation Angle = ASpawnLocationsBusDriver[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation format(Msg, 128, "{00FFFF}O Jogador {FFFFFF}%s{00FFFF} Entrou como um Taxista.", Name); } case ClassPilot: { Index = random(sizeof(ASpawnLocationsPilot)); x = ASpawnLocationsPilot[Index][SpawnX]; // Get the X-position for the spawnlocation y = ASpawnLocationsPilot[Index][SpawnY]; // Get the Y-position for the spawnlocation z = ASpawnLocationsPilot[Index][SpawnZ]; // Get the Z-position for the spawnlocation Angle = ASpawnLocationsPilot[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation format(Msg, 128, "{BEBEBE}O Jogador {FFFFFF}%s{BEBEBE} Entrou como um Piloto de Aviгo.", Name); } case ClassPolice: { // Count the number of normal players (all classes except police) and count the amount of police players new NormalPlayers, PolicePlayers, bool: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 pid; pid < MAX_PLAYERS; pid++) { // 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 ClassTruckDriver, ClassBusDriver, ClassPilot, ClassMafia, ClassCourier, ClassAssistance, ClassRoadWorker: NormalPlayers++; } } } } } // Check if there are less police players than allowed if (PolicePlayers < (NormalPlayers / PlayersBeforePolice)) 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, "O Maximo de Policiais ja estao Online", 5000, 4); SendClientMessage(playerid, 0xFFFFFFFF, "{808080}O Maximo de Policiais jб foram Atingidos, Escolha outro Cargo"); return 0; // Don't allow the player to spawn as police player } } // If the player has less than 100 scorepoints if (APlayerData[playerid][PlayerScore] < 1000) { // Let the player know he needs 100 scorepoints GameTextForPlayer(playerid, "Voce precisa de 7000 Scores para Ser Policial", 5000, 4); SendClientMessage(playerid, 0xFFFFFFFF, "{808080}Voce Precisa de 7000 Scores Para Ser Policial"); return 0; // Don't allow the player to spawn as police player } // 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, "Voce nao pode Ser Policial enquanto estб Sendo Procurado", 5000, 4); SendClientMessage(playerid, 0xFFFFFFFF, "{808080}Voce nao pode Ser Policial enquanto estб Sendo Procurado"); return 0; // Don't allow the player to spawn as police player } Index = random(sizeof(ASpawnLocationsPolice)); x = ASpawnLocationsPolice[Index][SpawnX]; // Get the X-position for the spawnlocation y = ASpawnLocationsPolice[Index][SpawnY]; // Get the Y-position for the spawnlocation z = ASpawnLocationsPolice[Index][SpawnZ]; // Get the Z-position for the spawnlocation Angle = ASpawnLocationsPolice[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation format(Msg, 128, "{0000FF}O Jogador {FFFFFF}%s{0000FF} Entrou como um Policial.", Name); } case ClassMafia: { Index = random(sizeof(ASpawnLocationsMafia)); x = ASpawnLocationsMafia[Index][SpawnX]; // Get the X-position for the spawnlocation y = ASpawnLocationsMafia[Index][SpawnY]; // Get the Y-position for the spawnlocation z = ASpawnLocationsMafia[Index][SpawnZ]; // Get the Z-position for the spawnlocation Angle = ASpawnLocationsMafia[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation format(Msg, 128, "{A020F0}O Jogador {FFFFFF} %s {A020F0} Entrou como um Traficante.", Name); } case ClassCourier: { Index = random(sizeof(ASpawnLocationsCourier)); x = ASpawnLocationsCourier[Index][SpawnX]; // Get the X-position for the spawnlocation y = ASpawnLocationsCourier[Index][SpawnY]; // Get the Y-position for the spawnlocation z = ASpawnLocationsCourier[Index][SpawnZ]; // Get the Z-position for the spawnlocation Angle = ASpawnLocationsCourier[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation format(Msg, 128, "{FF0000}O Jogador {FFFFFF}%s{FF0000} Entrou como um Entregador do Sedex.", Name); } case ClassAssistance: { Index = random(sizeof(ASpawnLocationsAssistance)); x = ASpawnLocationsAssistance[Index][SpawnX]; // Get the X-position for the spawnlocation y = ASpawnLocationsAssistance[Index][SpawnY]; // Get the Y-position for the spawnlocation z = ASpawnLocationsAssistance[Index][SpawnZ]; // Get the Z-position for the spawnlocation Angle = ASpawnLocationsAssistance[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation format(Msg, 128, "{006400}O Jogador {FFFFFF}%s{006400} Entrou como um Mecanico.", Name); } case ClassRoadWorker: { Index = random(sizeof(ASpawnLocationsRoadWorker)); x = ASpawnLocationsRoadWorker[Index][SpawnX]; // Get the X-position for the spawnlocation y = ASpawnLocationsRoadWorker[Index][SpawnY]; // Get the Y-position for the spawnlocation z = ASpawnLocationsRoadWorker[Index][SpawnZ]; // Get the Z-position for the spawnlocation Angle = ASpawnLocationsRoadWorker[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation format(Msg, 128, "{EEE8AA}O Jogador {FFFFFF} %s {EEE8AA} Entrou como um Funcionario do DNIT.", Name); } case ClassLixeiro: { Index = random(sizeof(ASpawnLocationsLixeiro)); x = ASpawnLocationsLixeiro[Index][SpawnX]; // Get the X-position for the spawnlocation y = ASpawnLocationsLixeiro[Index][SpawnY]; // Get the Y-position for the spawnlocation z = ASpawnLocationsLixeiro[Index][SpawnZ]; // Get the Z-position for the spawnlocation Angle = ASpawnLocationsLixeiro[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation format(Msg, 128, "{FFA500}O Jogador {FFFFFF} %s {FFA500} Entrou como um Lixeiro.", Name); } case ClassPizza: { Index = random(sizeof(ASpawnLocationsPizza)); x = ASpawnLocationsPizza[Index][SpawnX]; // Get the X-position for the spawnlocation y = ASpawnLocationsPizza[Index][SpawnY]; // Get the Y-position for the spawnlocation z = ASpawnLocationsPizza[Index][SpawnZ]; // Get the Z-position for the spawnlocation Angle = ASpawnLocationsPizza[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation format(Msg, 128, "{F5F5DC}O Jogador {FFFFFF} %s {F5F5DC} Entrou como um Entregador de Pizza.", Name); } case ClassMendigo: { Index = random(sizeof(ASpawnLocationsMendigo)); x = ASpawnLocationsMendigo[Index][SpawnX]; // Get the X-position for the spawnlocation y = ASpawnLocationsMendigo[Index][SpawnY]; // Get the Y-position for the spawnlocation z = ASpawnLocationsMendigo[Index][SpawnZ]; // Get the Z-position for the spawnlocation Angle = ASpawnLocationsMendigo[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation format(Msg, 128, "{B8860B}O Jogador {FFFFFF} %s {B8860B} Entrou como um Mendigo.", Name); } } |
Quote:
// Define class-colors #define ColorClassTruckDriver 0xFFFF00 // Amarelo #define ColorClassBusDriver 0x00FFFF // Azul Claro #define ColorClassPilot 0xBEBEBE // Cinza #define ColorClassPolice 0x0000FF// Azul Escuro #define ColorClassMafia 0xA020F0 // Roxo #define ColorClassCourier 0xFF0000 // Rosa #define ColorClassAssistance 0x006400 // Dark green #define ColorClassRoadWorker 0xEEE8AA // Light yellow #define ColorClassLixeiro 0xFFA500 // Laranja #define ColorClassPizza 0xF5F5DC // Beige #define ColorClassMendigo 0xB8860B // Gold |