[Ajuda] Erros na compilaзгo
#5

pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    new Index, Float:x, 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, "{00FF00}Jogador {FFFF00}%s{00FF00} Entrou como {FFA500}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, "{00FF00}Jogador {FFFF00}%s{00FF00} Entrou como {BFEFFF}Motorista de Onibus.", 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, "{00FF00}Jogador {FFFF00}%s{00FF00} Entrou como {36648B}Piloto.", 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, "Maximo de Policia Online Alcancado", 5000, 4);
                    SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Selecione Outra classe,a Policia estб lotada");
                    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 1000 Scores para Policial", 5000, 4);
                SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Voce Precisa de 1000 Scores para Ser Policia");
                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 Esta procurado,nao pode ser Policial", 5000, 4);
                SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}nao e permitido entrar na policia 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, "{00FF00}Jogador {FFFF00}%s{00FF00} Entrou como {0000FF}Policial.", Name);
        }
        case ClassMafia:

        {
            Index = random(sizeof(ASpawnLocationsMafia));
            x = ASpawnLocationsMafia[Index][SpawnX];
            y = ASpawnLocationsMafia[Index][SpawnY];
            z = ASpawnLocationsMafia[Index][SpawnZ];
            Angle = ASpawnLocationsMafia[Index][SpawnAngle];
            format(Msg, 128, "{8000FF}O Jogador {FFFFFF}%s {8000FF}Entrou como {9B30FF}Mafioso.", 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, "{00FF00}Jogador {FFFF00}%s{00FF00} Entrou como {FFC0CB}Carteiro.", 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, "{00FF00}Jogador {FFFF00}%s{00FF00} Entrou como {FFFFE0}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, "{00FF00}Jogador {FFFF00}%s{00FF00} Entrou como {CDCD00}Operario DNIT.", Name);
        }
    }

    // Spawn the player with his chosen skin at a random location based on his class
    SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), x, y, z, Angle, 0, 0, 0, 0, 0, 0);
    // Send the message to all players (who joined which class)
    SendClientMessageToAll(0xFFFFFFFF, Msg);

    return 1;
}
Reply


Messages In This Thread
Erros na compilaзгo - by PedexM - 11.10.2014, 20:00
Re: Erros na compilaзгo - by DavidCosta - 11.10.2014, 20:04
Re: Erros na compilaзгo - by PedexM - 11.10.2014, 20:07
Re: Erros na compilaзгo - by DavidCosta - 11.10.2014, 20:08
Re: Erros na compilaзгo - by PedexM - 11.10.2014, 20:11
Re: Erros na compilaзгo - by PedexM - 11.10.2014, 20:44
Re: Erros na compilaзгo - by Artista - 11.10.2014, 20:57
Re: Erros na compilaзгo - by PedexM - 11.10.2014, 21:20
Re: Erros na compilaзгo - by Artista - 12.10.2014, 01:20

Forum Jump:


Users browsing this thread: 1 Guest(s)