[Ajuda] Erros na compilaзгo
#1

PHP код:
(984) : error 014invalid statementnot in switch
(
984) : warning 215expression has no effect
(984) : error 001expected token";"but found ":"
(984) : error 029invalid expressionassumed zero
(984) : fatal error 107too many error messages on one line 
pawn Код:
[984]       case ClassMafia
[985]       {
[986]           Index = random(sizeof(ASpawnLocationsMafia));
[987]          x = ASpawnLocationsMafia[Index][SpawnX];
[988]           y = ASpawnLocationsMafia[Index][SpawnY];
[989]           z = ASpawnLocationsMafia[Index][SpawnZ];
[990]           Angle = ASpawnLocationsMafia[Index][SpawnAngle];
[991]           format(Msg, 128, "{8000FF}O Jogador {FFFFFF}%s {8000FF}Entrou como {9B30FF}Mafioso.", Name);
               }
Eu jб coloquei o original,sem traduzi nesta parte mas nunca dб ¬¬ parece que o compilador ficou com raiva desta parte
Reply
#2

Tenta assim:
pawn Код:
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);
    }
Reply
#3

Fica do msm jeito,os 4 erros й o msm '-
Reply
#4

Manda o cуdigo todo...
Reply
#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
#6

Eu acabei arrumando este erro,e arrumando outro ¬¬ e outros 3 Warnings,Sera que pode ajudar?

pawn Код:
(1027) : error 002: only a single statement (or expression) can follow each "case"
(1022) : warning 204: symbol is assigned a value that is never used: "Angle"
(1021) : warning 204: symbol is assigned a value that is never used: "z"
(1020) : warning 204: symbol is assigned a value that is never used: "y"
(1019) : warning 204: symbol is assigned a value that is never used: "x"
Eu arrumei fazendo isso
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 ClassMafia:
        {
            if (APlayerData[playerid][PlayerScore] < 500 )
            {
                GameTextForPlayer(playerid, "Vocк precisa de 500 Scores para ser Mafioso", 5000, 4);
                SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000} Vocк precisa de 500 Scores para ser Mafioso");
            }
            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 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 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);
        }
        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);
        }

    }
    SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), x, y, z, Angle, 0, 0, 0, 0, 0, 0);
    SendClientMessageToAll(0xFFFFFFFF, Msg);
return 1;
}
Eu coloquei todas as profissхes acima da profissгo da Policia '- Que deve ser o problema,mas nгo sei resolver ¬¬
Reply
#7

Quote:

warning 204: symbol is assigned a value that is never used

Vocк nгo estб usando as variбveis, provavelmente estб apenas armazenando algo sem nenhum proposito.

O outro erro creio que esteja aqui
Quote:

// If the player has less than 100 scorepoints
{

Vocк abriu uma { sem necessidade alguma e nгo fechou. Sу deletar

Aqui vai o cуdigo (nгo testei, mas creio que esteja certo)
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 ClassMafia:
        {
            if (APlayerData[playerid][PlayerScore] < 500 )
            {
                GameTextForPlayer(playerid, "Vocк precisa de 500 Scores para ser Mafioso", 5000, 4);
                SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000} Vocк precisa de 500 Scores para ser Mafioso");
            }
            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 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 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);
        }
        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
            //{ ---===> A parte em que foi alterada
           
            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);
        }

    }
    SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), x, y, z, Angle, 0, 0, 0, 0, 0, 0);
    SendClientMessageToAll(0xFFFFFFFF, Msg);
    return 1;
}
Reply
#8

Poo,cara vlw,era isso msm,Eu sу nгo dou rep,porque eu nгo posso,mas valeu ai.
Reply
#9

De nada, qualquer coisa pode contar comigo =)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)