[Ajuda] Problema com o ID
#1

Bom meu GM quando passa de alguns usuбrios online o ID Buga jб atualizei sscanf e nada.

PHP код:
// Revisado 100%                                                                                 //OK
#pragma tabsize 0
// ********************************************************************************************************************
// Mundo dos Caminhoneiros
// ********************************************************************************************************************
#define GameModeName                "MDC 2.0"
#include <a_samp>
#include <core>
new Text:ImagemEntrada;
#define Azul 0x0000FFAA
#define COR_BRANCO 0xFFFFFFAA
#define COR_ROXO 0x9900FFAA
#define COR_CINZA_AZUL 0x456EAF67
#define Azul 0x0000FFAA
#define COR_DARKROXO 0x800080AA
#define COR_CINZA_AZUL 0x456EAF67
forward SendMSG();
new 
RandomServerName[4][] = {
    
"•Mundo dos Caminhoneiros®",
    
"•Mundo dos Caminhoneiros™",
    
"Versгo 2.0",
    
"•Mundo dos Caminhoneiros™•"
};
public 
SendMSG() {
    new 
string[128];
    new 
randMSG randomsizeof(RandomServerName) );
    
formatstring128"hostname %s"RandomServerName[randMSG] );
    
SendRconCommand( string );
    return 
1;
}
/********************************************************************************************************************
///////////////////////////////////////////////////////////// 100% Desbugado \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
||||||||||||||||||||||||||||||||||||||||||||| # PPC_Trucking Editada # |||||||||||||||||||||||||||
********************************************************************************************************************/
new PlayersBeforePolice    0;
// ********************************************************************************************************************
// ********************************************************************************************************************
// Include default files
#include <a_samp>
#include <zcmd>
#include <dutils>
#include <sscanf2>
#include <streamer>
#include <F_Streamer>
#define SLOT         1
#define TimerFlood   3000
#define AlertFlood   4
#define ColorFlood   0x24B1DBAA
#define CLIMATEMPO   0xFFFFAFAA
#define AMARELO      0xFFFF00AA
#define VERMELHO     0xFF0000AA
#define AZUL         0x0000FFAA
#define VERDE        0x00FF00AA
#define BRANCO       0xFFFFFFFF
// Include all define-statements and custom-type declarations and the arrays which use them
// These files need to be included before the functions get included, because the functions use the defines, custom types and the arrays
// Also include the defined loads (for truckers, military, mafia, ...) and locations arrays
#include <PPC_DefTexts>
#include <PPC_ServerSettings>
#include <PPC_Defines>
#include <PPC_DefLocations>
#include <PPC_DefLoads>
#include <PPC_DefCars>
#include <PPC_DefPlanes>
#include <PPC_DefTrailers>
#include <PPC_DefBuyableVehicles>
// Include functions for this gamemode
#include <PPC_GlobalTimer>
#include <PPC_Common>
#include <PPC_Housing>
#include <PPC_Business>
#include <PPC_GameModeInit>
#include <PPC_FileOperations>
#include <PPC_Speedometer>
#include <PPC_MissionsTrucking>
#include <PPC_MissionsBus>
#include <PPC_MissionsPilot>
#include <PPC_MissionsPolice>
#include <PPC_MissionsMafia>
#include <PPC_MissionsAssistance>
#include <PPC_MissionsCourier>
#include <PPC_MissionsRoadworker>
#include <PPC_Convoys>
#include <PPC_Dialogs>
#include <PPC_PlayerCommands>
#include <PPC_Toll>
#include <PPC_Extras>
#define SLOT         1
#define TimerFlood   3000
#define AlertFlood   4
#define ColorFlood   0x24B1DBAA
#define CLIMATEMPO   0xFFFFAFAA
#define AMARELO      0xFFFF00AA
#define VERMELHO     0xFF0000AA
#define AZUL         0x0000FFAA
#define VERDE        0x00FF00AA
#define BRANCO       0xFFFFFFFF
forward timed(playerid);
forward Climas();
//Relуgio
new timer1,timer2,timer3;
//Nomezinho
new Text:AberturaP0;
new 
Text:AberturaP1;
//Abertura
new Text:Abertura0;
new 
Text:Abertura1;
new 
Text:Textdraw0;
main ()
{
    print(
"\nSistemas do Servidor");
    print(
" Carregando...");
    print(
" 100% - Servidor Online");
}
public 
OnGameModeInit()
{
    
ImagemEntrada TextDrawCreate(1.000000, -1.000000"loadsc7:loadsc7");
    
TextDrawBackgroundColor(ImagemEntrada255);
    
TextDrawFont(ImagemEntrada4);
    
TextDrawLetterSize(ImagemEntrada0.5000001.000000);
    
TextDrawColor(ImagemEntrada, -1);
    
TextDrawSetOutline(ImagemEntrada0);
    
TextDrawSetProportional(ImagemEntrada1);
    
TextDrawSetShadow(ImagemEntrada1);
    
TextDrawUseBox(ImagemEntrada1);
    
TextDrawBoxColor(ImagemEntrada255);
    
TextDrawTextSize(ImagemEntrada645.000000450.000000);
    
SetTimer"SendMSG"1000true );
    
Create3DTextLabel("{FFFFFF}/cor1\n{FF0000}/cor2\n{FFFFFF}/pintura\n{FF0000}/neon\n{FFFFFF}/reparar\n{FF0000}/editarplaca"0xFFFFFFFF2096.64451120.955211.1395130.000);  //6 Avenida
    
Create3DTextLabel("{FFFFFF}/cor1\n{FF0000}/cor2\n{FFFFFF}/pintura\n{FF0000}/neon\n{FFFFFF}/reparar"0xFFFFFFFF, -47.7836270.69172.250030.000);     //1  parking fazenda
    
Create3DTextLabel("{FFFFFF}/cor1\n{FF0000}/cor2\n{FFFFFF}/pintura\n{FF0000}/neon\n{FFFFFF}/reparar"0xFFFFFFFF24.64922418.969722.757830.000);    //2  aero
    
Create3DTextLabel("{FFFFFF}/cor1\n{FF0000}/cor2\n{FFFFFF}/pintura\n{FF0000}/neon\n{FFFFFF}/reparar\n{FF0000}/editarplaca"0xFFFFFFFF1348.4963946.510110.525230.000);   //3  chuckup
    
Create3DTextLabel("{FFFFFF}/cor1\n{FF0000}/cor2\n{FFFFFF}/pintura\n{FF0000}/neon\n{FFFFFF}/reparar"0xFFFFFFFF, -547.3569,507.0492,2.593330.000); //4   Dragao
    
Create3DTextLabel("{FFFFFF}/cor1\n{FF0000}/cor2\n{FFFFFF}/pintura\n{FF0000}/neon\n{FFFFFF}/reparar\n{FF0000}/editarplaca"0xFFFFFFFF, -1656.2089,454.5365,7.405330.000); //5   SF
    // Resgate
    
Create3DTextLabel("{FF0000}[MDC]\n{FFFFFF}IP: 151.236.11.185:8780\n{FF0000}Mundo dos Caminhoneiros - 2.0\n{FFFFFF}/ajuda\n{FF0000}/admins"0xFFFFFFFF, -525.00, -501.66,   25.5230.000); //resgate 1
    
Create3DTextLabel("{FF0000}[MDC]\n{FFFFFF}IP: 151.236.11.185:8780\n{FF0000}Mundo dos Caminhoneiros - 2.0\n{FFFFFF}/ajuda\n{FF0000}/admins"0xFFFFFFFF, -74.69, -1137.16,    4.2030.000); //resgate 2
    
Create3DTextLabel("{FF0000}[MDC]\n{FFFFFF}IP: 151.236.11.185:8780\n{FF0000}Mundo dos Caminhoneiros - 2.0\n{FFFFFF}/ajuda\n{FF0000}/admins"0xFFFFFFFF1457.00,  975.83,   10.8230.000); //resgate 3
    
Create3DTextLabel("{FF0000}[MDC]\n{FFFFFF}IP: 151.236.11.185:8780\n{FF0000}Mundo dos Caminhoneiros - 2.0\n{FFFFFF}/ajuda\n{FF0000}/admins"0xFFFFFFFF, -2135.68, -247.47,   36.1230.000); //resgate 4
    
Create3DTextLabel("{FF0000}[MDC]\n{FFFFFF}IP: 151.236.11.185:8780\n{FF0000}Mundo dos Caminhoneiros - 2.0\n{FFFFFF}/ajuda\n{FF0000}/admins"0xFFFFFFFF1766.83, -2040.70,   13.5230.000); //resgate 5
    
Create3DTextLabel("{FF0000}[MDC]\n{FFFFFF}IP: 151.236.11.185:8780\n{FF0000}Mundo dos Caminhoneiros - 2.0\n{FFFFFF}/ajuda\n{FF0000}/admins"0xFFFFFFFF, -545.662593.99,   53.5130.000); //5   SF
    
Create3DTextLabel("{FF0000}[MDC]\n{FFFFFF}IP: 151.236.11.185:8780\n{FF0000}Mundo dos Caminhoneiros - 2.0\n{FFFFFF}/ajuda\n{FF0000}/admins"0xFFFFFFFF332.13,  899.69,   24.7730.000); //5   SF
    
Create3DTextLabel("{FF0000[MDC]\n{FFFFFF}IP: 151.236.11.185:8780\n{FF0000}Mundo dos Caminhoneiros - 2.0\n{FFFFFF}/ajuda\n{FF0000}/admins",  0xFFFFFFFF, -1575.18, -2724.28,   48.5330.000); //5   SF
    
Create3DTextLabel("{FF0000}[MDC]\n{FFFFFF}IP: 151.236.11.185:8780\n{FF0000}Mundo dos Caminhoneiros - 2.0\n{FFFFFF}/ajuda\n{FF0000}/admins"0xFFFFFFFF661.591718.29,    7.1830.000); //5   SF
    
Create3DTextLabel("{FF0000}[MDC]\n{FFFFFF}IP: 151.236.11.185:8780\n{FF0000}Mundo dos Caminhoneiros - 2.0\n{FFFFFF}/ajuda\n{FF0000}/admins"0xFFFFFFFF2180.39, -2257.07,   14.7730.000); //5   SF
    
Create3DTextLabel("{FF0000}[MDC]\n{FFFFFF}IP: 151.236.11.185:8780\n{FF0000}Mundo dos Caminhoneiros - 2.0\n{FFFFFF}/ajuda\n{FF0000}/admins"0xFFFFFFFF3.301551.66,   12.7530.000); //5   SF
    // TextDraw
    
AberturaP0 TextDrawCreate(486.000000125.000000"Mundo dos Caminhoneiros");
    
TextDrawBackgroundColor(AberturaP0255);
    
TextDrawFont(AberturaP03);
    
TextDrawLetterSize(AberturaP00.3299991.000000);
    
TextDrawColor(AberturaP0, -1);
    
TextDrawSetOutline(AberturaP01);
    
TextDrawSetProportional(AberturaP01);
    
// TextDraw
    
AberturaP1 TextDrawCreate(603.000000133.000000"2.0");
    
TextDrawBackgroundColor(AberturaP1255);
    
TextDrawFont(AberturaP13);
    
TextDrawLetterSize(AberturaP10.3100001.000000);
    
TextDrawColor(AberturaP1, -16776961);
    
TextDrawSetOutline(AberturaP11);
    
TextDrawSetProportional(AberturaP11);
    
// TextDraw
    
Abertura0 TextDrawCreate(210.000000105.000000"Mundo dos Caminhoneiros");
    
TextDrawBackgroundColor(Abertura0255);
    
TextDrawFont(Abertura03);
    
TextDrawLetterSize(Abertura00.5199993.400000);
    
TextDrawColor(Abertura0, -1);
    
TextDrawSetOutline(Abertura01);
    
TextDrawSetProportional(Abertura01);
    
// TextDraw
    
Abertura1 TextDrawCreate(403.000000134.000000"2.0");
    
TextDrawBackgroundColor(Abertura1255);
    
TextDrawFont(Abertura13);
    
TextDrawLetterSize(Abertura10.3400001.500000);
    
TextDrawColor(Abertura1, -16776961);
    
TextDrawSetOutline(Abertura11);
    
TextDrawSetProportional(Abertura11);
    
// TextDraw
    
Textdraw0 TextDrawCreate(0.00.0"loadsc10:loadsc10");
    
TextDrawBackgroundColor(Textdraw0255);
    
TextDrawFont(Textdraw03);
    
TextDrawLetterSize(Textdraw0,0.2900001.300000);
    
TextDrawColor(Textdraw0, -1);
    
TextDrawSetOutline(Textdraw00);
    
TextDrawSetProportional(Textdraw01);
    
TextDrawSetShadow(Textdraw01);
    
TextDrawUseBox(Textdraw01);
    
TextDrawBoxColor(Textdraw0255);
    
TextDrawTextSize(Textdraw0639.000000448.000000);
    
SetTimer("timed",10001);
    
SetTimer("Climas",6000001);
    new 
HostCommand[128];
    
SendRconCommand(HostCommand);
    
SetGameModeText(GameModeName);
    
GameModeInit_VehiclesPickups();
    
GameModeInit_Classes();
    
Convoys_Init();
    
ShowPlayerMarkers(1);
    
ShowNameTags(1);
    
ManualVehicleEngineAndLights();
    
EnableStuntBonusForAll(0);
    
DisableInteriorEnterExits();
    
UsePlayerPedAnims();
    
SetTimer("Timer_TimedMessages"1000 60 2true);
    
SetTimer("ShowRandomBonusMission"1000 60 5true);
    
SetTimer("Toll"1000true);
    
FixHouses();
    
SetTimer("GlobalTimer"1000true);
    for(new 
iMAX_PLAYERS++)
    {
        if(
IsPlayerConnected(i))
        {
            
TextDrawShowForPlayer(iAberturaP0);
            
TextDrawShowForPlayer(iAberturaP1);
            
TextDrawShowForPlayer(iTextdraw0);
        }
    }
    return 
1;
}
public 
OnGameModeExit()
{
    
KillTimer(timer1);
    
KillTimer(timer2);
    
KillTimer(timer3);
    
TextDrawHideForAll(AberturaP0);
    
TextDrawDestroy(AberturaP0);
    
TextDrawHideForAll(AberturaP1);
    
TextDrawDestroy(AberturaP1);
    return 
1;
}
// This callback gets called when a player connects to the server
public OnPlayerConnect(playerid)
{
    
TextDrawShowForPlayer(playeridImagemEntrada);
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0000FFAA"");
    
SendClientMessage(playerid0x0FFDD349"=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=");
    
SendClientMessage(playerid0x0FFDD349"    Mundo dos Caminhoneiros                               ");
    
SendClientMessage(playerid0x0FFDD349"    Sejam bem Vindo ao Servidor                           ");
    
SendClientMessage(playerid0x0FFDD349"    Divirta-se e Obrigado Pela Presenзa                     ");
    
SendClientMessage(playerid0x0FFDD349"    Melhor Servidor de Truck do Brasil                         ");
    
SendClientMessage(playerid0x0FFDD349"    Versгo 2.0                                                                      ");
    
SendClientMessage(playerid0x0FFDD349"=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=");
    
// Always allow NPC's to login without password or account
    
if (IsPlayerNPC(playerid))
    return 
1;
    
// Setup local variables
    
new Name[MAX_PLAYER_NAME], NewPlayerMsg[128], HouseID;
    
// Setup a PVar to allow cross-script money-transfers (only from filterscript to this mainscript) and scorepoints
    
SetPVarInt(playerid"PVarMoney"10000);
    
SetPVarInt(playerid"PVarScore"0);
    
// Get the playername
    
GetPlayerName(playeridNamesizeof(Name));
    
// Also store this name for the player
    
GetPlayerName(playeridAPlayerData[playerid][PlayerName], 24);
    
// Send a message to all players to let them know somebody else joined the server
    
format(NewPlayerMsg128TXT_PlayerJoinedServerNameplayerid);
    
SendClientMessageToAll(0xFFFFFFFFNewPlayerMsg);
    
// Try to load the player's datafile ("PlayerFile_Load" returns "1" is the file has been read, "0" when the file cannot be read)
    
if (PlayerFile_Load(playerid) == 1)
    {
        
// Check if the player is still banned
        
if (APlayerData[playerid][BanTime] < gettime()) // Player ban-time is passed
        
ShowPlayerDialog(playeridDialogLoginDIALOG_STYLE_INPUTTXT_DialogLoginTitleTXT_DialogLoginMsgTXT_DialogLoginButton1TXT_DialogButtonCancel);
        else 
// Player is still banned
        
{
            
ShowRemainingBanTime(playerid); // Show the remaining ban-time to the player is days, hours, minutes, seconds
            
Kick(playerid); // Kick the player
        
}
    }
    else
    
ShowPlayerDialog(playeridDialogRegisterDIALOG_STYLE_INPUTTXT_DialogRegisterTitleTXT_DialogRegisterMsgTXT_DialogRegisterButton1TXT_DialogButtonCancel);
    
// The houses have been loaded but not the cars, so load all vehicles assigned to the player's houses
    
for (new HouseSlotHouseSlot MAX_HOUSESPERPLAYERHouseSlot++)
    {
        
// Get the HouseID from this slot
        
HouseID APlayerData[playerid][Houses][HouseSlot];
        
// Check if there is a house in this slot
        
if (HouseID != 0)
        
HouseFile_Load(HouseIDtrue); // Load the cars of the house
    
}
    
// Speedometer setup
    
Speedometer_Setup(playerid);
    
// MissionText TextDraw setup
    
APlayerData[playerid][MissionText] = TextDrawCreate(320.0430.0" "); // Setup the missiontext at the bottom of the screen
    
TextDrawAlignment(APlayerData[playerid][MissionText], 2); // Align the missiontext to the center
    
TextDrawUseBox(APlayerData[playerid][MissionText], 1); // Set the missiontext to display inside a box
    
TextDrawBoxColor(APlayerData[playerid][MissionText], 0x00000066); // Set the box color of the missiontext
    // Display a message if the player hasn't accepted the rules yet
    
if (APlayerData[playerid][RulesRead] == false)
    
SendClientMessage(playerid0xFFFFFFFF"{828282}Vocк nгo viu as Regras digite {FFFF00}({ffffff}/regras{FFFF00}){828282}Mundo dos Caminhoneiros");
    return 
1;
}
// This function shows the player how long his ban still is when he tries to login (in days, hours, minutes, seconds)
ShowRemainingBanTime(playerid)
{
    
// Setup local variables
    
new TotalBanTimeDaysHoursMinutesSecondsMsg[128];
    
// Get the total ban-time
    
TotalBanTime APlayerData[playerid][BanTime] - gettime();
    
// Calculate days
    
if (TotalBanTime >= 86400)
    {
        
Days TotalBanTime 86400;
        
TotalBanTime TotalBanTime - (Days 86400);
    }
    
// Calculate hours
    
if (TotalBanTime >= 3600)
    {
        
Hours TotalBanTime 3600;
        
TotalBanTime TotalBanTime - (Hours 3600);
    }
    
// Calculate minutes
    
if (TotalBanTime >= 60)
    {
        
Minutes TotalBanTime 60;
        
TotalBanTime TotalBanTime - (Minutes 60);
    }
    
// Calculate seconds
    
Seconds TotalBanTime;
    
// Display the remaining ban-time for this player
    
SendClientMessage(playerid0xFFFFFFFFTXT_StillBanned);
    
format(Msg128TXT_BannedDurationDaysHoursMinutesSeconds);
    
SendClientMessage(playerid0xFFFFFFFFMsg);
}
// This callback gets called when a player disconnects from the server
public OnPlayerDisconnect(playeridreason)
{
    
// Setup local variables
    
new Name[24], Msg[128], HouseID;
    
// Get the playername
    
GetPlayerName(playeridNamesizeof(Name));
    
// Send a message to all players to let them know somebody left the server
    
format(Msg128TXT_PlayerLeftServerNameplayerid);
    
SendClientMessageToAll(0xFFFFFFFFMsg);
    
// If the player entered a proper password (the player has an account)
    
if (strlen(APlayerData[playerid][PlayerPassword]) != 0)
    {
        
// Save the player data and his houses
        
PlayerFile_Save(playerid);
    }
    
// Stop any job that may have started (this also clears all mission data)
    
switch (APlayerData[playerid][PlayerClass])
    {
        case 
ClassTruckDriverTrucker_EndJob(playerid); // Stop any trucker job
        
case ClassBusDriverBusDriver_EndJob(playerid); // Stop any busdriver job
        
case ClassPilotPilot_EndJob(playerid); // Stop any pilot job
        
case ClassPolicePolice_EndJob(playerid); // Stop any police job
        
case ClassMafiaMafia_EndJob(playerid); // Stop any mafia job
        
case ClassAssistanceAssistance_EndJob(playerid);
        case 
ClassRoadWorkerRoadworker_EndJob(playerid);
    }
    
// If the player is part of a convoy, kick him from it
    
Convoy_Leave(playerid);
    
// Unload all the player's house-vehicles to make room for other player's vehicles
    
for (new HouseSlotHouseSlot MAX_HOUSESPERPLAYERHouseSlot++)
    {
        
// Get the HouseID from this slot
        
HouseID APlayerData[playerid][Houses][HouseSlot];
        
// Check if there is a house in this slot
        
if (HouseID != 0)
        {
            
// Unload the cars of the house
            
House_RemoveVehicles(HouseID);
            
// Set the house so it cannot be entered by anyone (close the house)
            
AHouseData[HouseID][HouseOpened] = false;
        }
    }
    
// Clear the data in the APlayerData array to make sure the next player with the same id doesn't hold wrong data
    
APlayerData[playerid][SpectateID] = -1;
    
APlayerData[playerid][SpectateVehicle] = -1;
    
APlayerData[playerid][SpectateType] = ADMIN_SPEC_TYPE_NONE;
    
APlayerData[playerid][LoggedIn] = false;
    
APlayerData[playerid][AssistanceNeeded] = false;
    
APlayerData[playerid][PlayerPassword] = 0;
    
APlayerData[playerid][PlayerLevel] = 0;
    
APlayerData[playerid][PlayerJailed] = 0;
    
APlayerData[playerid][PlayerFrozen] = 0// Clearing this variable automatically kills the frozentimer
    
APlayerData[playerid][Bans] = 0;
    
APlayerData[playerid][BanTime] = 0;
    
APlayerData[playerid][Muted] = false;
    
APlayerData[playerid][RulesRead] = false;
    
APlayerData[playerid][AutoReportTime] = 0;
    
APlayerData[playerid][TruckerLicense] = 0;
    
APlayerData[playerid][BusLicense] = 0;
    
APlayerData[playerid][PlayerClass] = 0;
    
APlayerData[playerid][Warnings] = 0;
    
APlayerData[playerid][PlayerMoney] = 0;
    
APlayerData[playerid][PlayerScore] = 0;
    for (new 
HouseSlotHouseSlot MAX_HOUSESPERPLAYERHouseSlot++)
    
APlayerData[playerid][Houses][HouseSlot] = 0;
    for (new 
BusSlotBusSlot MAX_BUSINESSPERPLAYERBusSlot++)
    
APlayerData[playerid][Business][BusSlot] = 0;
    
APlayerData[playerid][CurrentHouse] = 0;
    
// Clear bank account info
    
APlayerData[playerid][BankPassword] = 0;
    
APlayerData[playerid][BankLoggedIn] = false;
    
APlayerData[playerid][BankMoney] = 0;
    
// Clear stats
    
APlayerData[playerid][StatsTruckerJobs] = 0;
    
APlayerData[playerid][StatsConvoyJobs] = 0;
    
APlayerData[playerid][StatsBusDriverJobs] = 0;
    
APlayerData[playerid][StatsPilotJobs] = 0;
    
APlayerData[playerid][StatsMafiaJobs] = 0;
    
APlayerData[playerid][StatsMafiaStolen] = 0;
    
APlayerData[playerid][StatsPoliceFined] = 0;
    
APlayerData[playerid][StatsPoliceJailed] = 0;
    
APlayerData[playerid][StatsCourierJobs] = 0;
    
APlayerData[playerid][StatsRoadworkerJobs] = 0;
    
APlayerData[playerid][StatsAssistance] = 0;
    
APlayerData[playerid][StatsMetersDriven] = 0.0;
    
// Clear police warnings
    
APlayerData[playerid][PoliceCanJailMe] = false;
    
APlayerData[playerid][PoliceWarnedMe] = false;
    
APlayerData[playerid][Value_PoliceCanJailMe] = 0;
    
// Make sure the jailtimer has been destroyed
    
KillTimer(APlayerData[playerid][PlayerJailedTimer]);
    
KillTimer(APlayerData[playerid][Timer_PoliceCanJailMe]);
    
// Destroy the speedometer TextDraw for this player and the timer, also set the speed to 0
    
Speedometer_Cleanup(playerid);
    
// Also destroy the missiontext TextDraw for this player
    
TextDrawDestroy(APlayerData[playerid][MissionText]);
    
// Destroy a rented vehicle is the player had any
    
if (APlayerData[playerid][RentedVehicleID] != 0)
    {
        
// Clear the data for the already rented vehicle
        
AVehicleData[APlayerData[playerid][RentedVehicleID]][Model] = 0;
        
AVehicleData[APlayerData[playerid][RentedVehicleID]][Fuel] = 100;
        
AVehicleData[APlayerData[playerid][RentedVehicleID]][Owned] = false;
        
AVehicleData[APlayerData[playerid][RentedVehicleID]][Owner] = 0;
        
AVehicleData[APlayerData[playerid][RentedVehicleID]][PaintJob] = 0;
        for (new 
j14j++)
        {
            
AVehicleData[APlayerData[playerid][RentedVehicleID]][Components][j] = 0;
        }
        
// Destroy the vehicle
        
DestroyVehicle(APlayerData[playerid][RentedVehicleID]);
        
// Clear the RentedVehicleID
        
APlayerData[playerid][RentedVehicleID] = 0;
    }
    return 
1;
}
public 
OnPlayerText(playeridtext[])
{
    if (
APlayerData[playerid][Muted] == true)
    {
        
SendClientMessage(playeridVERMELHO"Vocк estб mudo!");
        return 
0;
    }
    return 
1;
}
// This callback gets called when a player interacts with a dialog
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    
// Select the proper dialog to process
    
switch (dialogid)
    {
        case 
DialogRegisterDialog_Register(playeridresponseinputtext); // The "Register"-dialog
        
case DialogLoginDialog_Login(playeridresponseinputtext); // The "Login"-dialog
        
case DialogStatsOtherPlayerDialog_StatsOtherPlayer(playeridresponselistitem);
        case 
DialogStatsHouseDialog_StatsHouse(playeridresponselistitem);
        case 
DialogStatsGoHouseDialog_StatsGoHouse(playeridresponselistitem);
        case 
DialogStatsGoBusinessDialog_StatsGoBusiness(playeridresponselistitem);
        case 
DialogRescueDialog_Rescue(playeridresponselistitem); // The rescue-dialog
        
case DialogBuyLicensesDialog_BuyLicenses(playeridresponselistitem); // The license-dialog (allows the player to buy trucker/busdriver licenses)
        
case DialogRulesDialog_Rules(playeridresponse);
        case 
DialogTruckerJobMethodDialog_TruckerSelectJobMethod(playeridresponselistitem); // The work-dialog for truckers (shows the loads he can carry and lets the player choose the load)
        
case DialogTruckerSelectLoadDialog_TruckerSelectLoad(playeridresponselistitem); // The load-selection dialog for truckers (shows the startlocations for the selected load and let the player choose his startlocation)
        
case DialogTruckerStartLocDialog_TruckerSelectStartLoc(playeridresponselistitem); // The start-location dialog for truckers (shows the endlocations for the selected load and let the player choose his endlocation)
        
case DialogTruckerEndLocDialog_TruckerSelectEndLoc(playeridresponselistitem); // The end-location dialog for truckers (processes the selected endlocation and starts the job)
        
case DialogBusJobMethodDialog_BusSelectJobMethod(playeridresponselistitem); // The work-dialog for busdrivers (process the options to choose own busroute or auto-assigned busroute)
        
case DialogBusSelectRouteDialog_BusSelectRoute(playeridresponselistitem); // Choose the busroute and start the job
        
case DialogCourierSelectQuantDialog_CourierSelectQuant(playeridresponselistitem);
        case 
DialogBikeDialog_Bike(playeridresponselistitem); // The bike-dialog
        
case DialogCarDialog_Car(playeridresponselistitem); // The car-dialog (which uses a split dialog structure)
        
case DialogPlaneDialog_Plane(playeridresponselistitem); // The plane-dialog (which uses a split dialog structure)
        
case DialogTrailerDialog_Trailer(playeridresponselistitem); // The trailer-dialog (which uses a split dialog structure)
        
case DialogBoatDialog_Boat(playeridresponselistitem); // The boat-dialog
        
case DialogRentCarClassDialog_RentProcessClass(playeridresponselistitem); // The player chose a vehicleclass from where he can rent a vehicle
        
case DialogRentCarDialog_RentCar(playeridresponselistitem); // The player chose a vehicle from the list of vehicles from the vehicleclass he chose before
        
case DialogPlayerCommandsDialog_PlayerCommands(playeridresponselistitem); // Displays all commands in a split-dialog structure
        
case DialogPrimaryCarColorDialog_PrimaryCarColor(playeridresponselistitem);
        case 
DialogSedundaryCarColorDialog_SedundaryCarColor(playeridresponselistitem);
        case 
DialogWeatherDialog_Weather(playeridresponselistitem); // The weather dialog
        
case DialogCarOptionDialog_CarOption(playeridresponselistitem); // The caroption dialog
        
case DialogSelectConvoyDialog_SelectConvoy(playeridresponselistitem);
        case 
DialogHouseMenuDialog_HouseMenu(playeridresponselistitem); // Process the main housemenu
        
case DialogUpgradeHouseDialog_UpgradeHouse(playeridresponselistitem); // Process the house-upgrade menu
        
case DialogGoHomeDialog_GoHome(playeridresponselistitem); // Port to one of your houses
        
case DialogHouseNameChangeDialog_ChangeHouseName(playeridresponseinputtext); // Change the name of your house
        
case DialogSellHouseDialog_SellHouse(playeridresponse); // Sell the house
        
case DialogBuyCarClassDialog_BuyCarClass(playeridresponselistitem); // The player chose a vehicleclass from where he can buy a vehicle
        
case DialogBuyCarDialog_BuyCar(playeridresponselistitem); // The player chose a vehicle from the list of vehicles from the vehicleclass he chose before
        
case DialogSellCarDialog_SellCar(playeridresponselistitem);
        case 
DialogBuyInsuranceDialog_BuyInsurance(playeridresponse);
        case 
DialogGetCarSelectHouseDialog_GetCarSelectHouse(playeridresponselistitem);
        case 
DialogGetCarSelectCarDialog_GetCarSelectCar(playeridresponselistitem);
        case 
DialogUnclampVehiclesDialog_UnclampVehicles(playeridresponse);
        case 
DialogCreateBusSelTypeDialog_CreateBusSelType(playeridresponselistitem);
        case 
DialogBusinessMenuDialog_BusinessMenu(playeridresponselistitem);
        case 
DialogGoBusinessDialog_GoBusiness(playeridresponselistitem);
        case 
DialogBusinessNameChangeDialog_ChangeBusinessName(playeridresponseinputtext); // Change the name of your business
        
case DialogSellBusinessDialog_SellBusiness(playeridresponse); // Sell the business
        
case DialogBankPasswordRegisterDialog_BankPasswordRegister(playeridresponseinputtext);
        case 
DialogBankPasswordLoginDialog_BankPasswordLogin(playeridresponseinputtext);
        case 
DialogBankOptionsDialog_BankOptions(playeridresponselistitem);
        case 
DialogBankDepositDialog_BankDeposit(playeridresponseinputtext);
        case 
DialogBankWithdrawDialog_BankWithdraw(playeridresponseinputtext);
        case 
DialogBankTransferMoneyDialog_BankTransferMoney(playeridresponseinputtext);
        case 
DialogBankTransferNameDialog_BankTransferName(playeridresponseinputtext);
        case 
DialogBankCancelDialog_BankCancel(playeridresponse);
        case 
DialogHelpItemChosenDialog_HelpItemChosen(playeridresponselistitem);
        case 
DialogHelpItemDialog_HelpItem(playeridresponse);
        case 
DialogOldPasswordDialog_OldPassword(playeridresponseinputtext);
        case 
DialogNewPasswordDialog_NewPassword(playeridresponseinputtext);
        case 
DialogConfirmPasswordDialog_ConfirmPassword(playeridresponse);
    }
    return 
1;
}
// this callback gets called when a player clicks on another player on the scoreboard
public OnPlayerClickPlayer(playeridclickedplayeridsource)
{
    
// Check if the player is an admin of at least level 1
    
if (APlayerData[playerid][PlayerLevel] >= 1)
    {
        
// Setup local variables
        
new Name[24], DialogTitle[128], PlayerStatList[3000], PlayerIP[16], NumHousesNumBusinesses;
        
// Construct the dialog-title
        
GetPlayerName(clickedplayeridNamesizeof(Name));
        
format(DialogTitle128"Statisticas do jogador: %s"Name);
        
// Add the IP of the player to the list
        
GetPlayerIp(clickedplayeridPlayerIPsizeof(PlayerIP));
        
format(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}IP: {00FF00}%s\n"PlayerStatListPlayerIP);
        
// Add the level of the player to the list
        
format(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Level de Admin: {00FF00}%i\n"PlayerStatListAPlayerData[clickedplayerid][PlayerLevel]);
        
// Add the class of the player to the list
        
switch(APlayerData[clickedplayerid][PlayerClass])
        {
            case 
ClassTruckDriverformat(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Classe: {00FF00}Caminhoneiro\n"PlayerStatList);
            case 
ClassBusDriverformat(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Classe: {00FF00}Motorista de Фnibus\n"PlayerStatList);
            case 
ClassPilotformat(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Classe: {00FF00}Piloto de Aviгo\n"PlayerStatList);
            case 
ClassPoliceformat(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Classe: {00FF00}Policial\n"PlayerStatList);
            case 
ClassMafiaformat(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Classe: {00FF00}Mafia\n"PlayerStatList);
            case 
ClassCourierformat(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Classe: {00FF00}Correios\n"PlayerStatList);
            case 
ClassAssistanceformat(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Classe: {00FF00}Mecвnico\n"PlayerStatList);
            case 
ClassRoadWorkerformat(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Classe: {00FF00}DNIT\n"PlayerStatList);
        }
        
// Add money and score of the player to the list
        
format(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Dinheiro: {00FF00}%i\n"PlayerStatListAPlayerData[clickedplayerid][PlayerMoney]);
        
format(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Score: {00FF00}%i\n"PlayerStatListAPlayerData[clickedplayerid][PlayerScore]);
        
// Add wanted-level of the player to the list
        
format(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Level de Procurado: {00FF00}%i\n"PlayerStatListGetPlayerWantedLevel(clickedplayerid));
        
// Add truckerlicense and busdriver license of the player to the list
        
if (APlayerData[clickedplayerid][TruckerLicense] == 1)
        
format(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Licenзa de Caminhгo: {00FF00}Sim\n"PlayerStatList);
        else
        
format(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Licenзa de Caminhгo: {00FF00}Nгo\n"PlayerStatList);
        if (
APlayerData[clickedplayerid][BusLicense] == 1)
        
format(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Licenзa de Фnibus: {00FF00}Sim\n"PlayerStatList);
        else
        
format(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Licenзa de Фnibus: {00FF00}Nгo\n"PlayerStatList);
        
format(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Trabalhos de Caminhoneiro: {00FF00}%i\n"PlayerStatListAPlayerData[clickedplayerid][StatsTruckerJobs]);
        
format(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Trabalhos em Comboio: {00FF00}%i\n"PlayerStatListAPlayerData[clickedplayerid][StatsConvoyJobs]);
        
format(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Trabalhos de Motorista de Фnibus: {00FF00}%i\n"PlayerStatListAPlayerData[clickedplayerid][StatsBusDriverJobs]);
        
format(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Trabalhos de Piloto: {00FF00}%i\n"PlayerStatListAPlayerData[clickedplayerid][StatsPilotJobs]);
        
format(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Trabalhos de Mбfia: {00FF00}%i\n"PlayerStatListAPlayerData[clickedplayerid][StatsMafiaJobs]);
        
format(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Cargas-Mбfia Roubadas: {00FF00}%i\n"PlayerStatListAPlayerData[clickedplayerid][StatsMafiaStolen]);
        
format(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Jogadores Multados: {00FF00}%i\n"PlayerStatListAPlayerData[clickedplayerid][StatsPoliceFined]);
        
format(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Jogadores Presos: {00FF00}%i\n"PlayerStatListAPlayerData[clickedplayerid][StatsPoliceJailed]);
        
format(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Trabalhos de Correios: {00FF00}%i\n"PlayerStatListAPlayerData[clickedplayerid][StatsCourierJobs]);
        
format(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Trabalhos de DNIT: {00FF00}%i\n"PlayerStatListAPlayerData[clickedplayerid][StatsRoadworkerJobs]);
        
format(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Jogadores Socorridos: {00FF00}%i\n"PlayerStatListAPlayerData[clickedplayerid][StatsAssistance]);
        
format(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Distвncia Percorrida: {00FF00}%f\n"PlayerStatListAPlayerData[clickedplayerid][StatsMetersDriven]);
        
// Count the number of houses/businesses that the player has and add them to the list
        
for (new iMAX_HOUSESPERPLAYERi++)
        if (
APlayerData[clickedplayerid][Houses][i] != 0)
        
NumHouses++;
        for (new 
iMAX_BUSINESSPERPLAYERi++)
        if (
APlayerData[clickedplayerid][Business][i] != 0)
        
NumBusinesses++;
        
format(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Casas: {00FF00}%i (dois clicks para ver)\n"PlayerStatListNumHouses);
        
format(PlayerStatListsizeof(PlayerStatList), "%s{FFFFFF}Empresas: {00FF00}%i (dois clicks para ver)\n"PlayerStatListNumBusinesses);
        
// Store the player-id of the other player so the other dialogs can display his statistics further (houses, businesses, cars)
        
APlayerData[playerid][DialogOtherPlayer] = clickedplayerid;
        
// Show the statistics of the other player
        
ShowPlayerDialog(playeridDialogStatsOtherPlayerDIALOG_STYLE_LISTDialogTitlePlayerStatListTXT_DialogButtonSelectTXT_DialogButtonCancel); // Let the player buy a license
    
}
    return 
1;
}
// This callback gets called when a player picks up any pickup
public OnPlayerPickUpPickup(playeridpickupid)
{
    
// If the player picks up the Buy_License pickup at the driving school in Doherty
    
if (pickupid == Pickup_License)
    
// Ask the player which license he wants to buy
    
ShowPlayerDialog(playeridDialogBuyLicensesDIALOG_STYLE_LISTTXT_DialogLicenseTitleTXT_DialogLicenseListTXT_DialogButtonBuyTXT_DialogButtonCancel); // Let the player buy a license
    
return 1;
}
// This callback gets called when a player spawns somewhere
public OnPlayerSpawn(playerid)
{
    if (
APlayerData[playerid][RulesRead] == false)
    {
        new 
Msg[2000];
        
format(Msg2000"%s1. Sempre dirigir do lado direito nas estradas para evitar acidentes.\n"Msg);
        
format(Msg2000"%s2. Nao chingar ou desrespeitar os outros jogadores, eles sao seus companheiros.\n"Msg);
        
format(Msg2000"%s3. Usar a linguagem padrгo 'Portuguкs'.\n"Msg);
        
format(Msg2000"%s4. Nao usar hackers ou serб banido permanentemente.\n"Msg);
        
format(Msg2000"%s5. Nao floodar no chat, pode ser calado por um admin.\n"Msg);
        
format(Msg2000"%s6. Nao roubar carros, sujeito a prisao caso haja denuncia.\n"Msg);
        
format(Msg2000"%s7. Nunca chingue ou desrespeite um administrador, voce sera banido.\n"Msg);
        
ShowPlayerDialog(playeridDialogRulesDIALOG_STYLE_MSGBOX"Regras"Msg"Aceitar"TXT_DialogButtonCancel);
    }
    
// Always allow NPC's to spawn without logging in
    
if (IsPlayerNPC(playerid))
    return 
1;
    
// Check if the player properly logged in by typing his password
    
if (APlayerData[playerid][LoggedIn] == false)
    {
        
SendClientMessage(playerid0xFFFFFFFFTXT_FailedLoginProperly);
        
Kick(playerid); // Kick the player if he didn't log in properly
    
}
    
// Setup local variables
    
new missiontext[200];
    
// Spawn the player in the global world (where everybody plays the game)
    
SetPlayerVirtualWorld(playerid0);
    
SetPlayerInterior(playerid0);
    
// Also set a variable that tracks in which house the player currently is
    
APlayerData[playerid][CurrentHouse] = 0;
    
// Disable the clock
    
TogglePlayerClock(playerid0);
    
// Delete all weapons from the player
    
ResetPlayerWeapons(playerid);
    
// Set the missiontext based on the chosen class
    
switch (APlayerData[playerid][PlayerClass])
    {
        case 
ClassTruckDriver// Truck-driver class
        
{
            
format(missiontextsizeof(missiontext), Trucker_NoJobText); // Preset the missiontext
            
SetPlayerColor(playeridColorClassTruckDriver); // Set the playercolor (chatcolor for the player and color on the map)
        
}
        case 
ClassBusDriver// Bus-driver class
        
{
            
format(missiontextsizeof(missiontext), BusDriver_NoJobText); // Preset the missiontext
            
SetPlayerColor(playeridColorClassBusDriver); // Set the playercolor (chatcolor for the player and color on the map)
        
}
        case 
ClassPilot// Pilot class
        
{
            
format(missiontextsizeof(missiontext), Pilot_NoJobText); // Preset the missiontext
            
SetPlayerColor(playeridColorClassPilot); // Set the playercolor (chatcolor for the player and color on the map)
        
}
        case 
ClassPolice// Police class
        
{
            
format(missiontextsizeof(missiontext), Police_NoJobText); // Preset the missiontext
            
SetPlayerColor(playeridColorClassPolice); // Set the playercolor (chatcolor for the player and color on the map)
            // Start the PlayerCheckTimer to scan for wanted players (be sure the timer has been destroyed first)
            
KillTimer(APlayerData[playerid][PlayerCheckTimer]);
            
APlayerData[playerid][PlayerCheckTimer] = SetTimerEx("Police_CheckWantedPlayers"1000true"i"playerid);
            
// Check if the police player can get weapons
            
if (PoliceGetsWeapons == true)
            {
                
// Give up to 12 weapons to the player
                
for (new i12i++)
                
GivePlayerWeapon(playeridAPoliceWeapons[i], PoliceWeaponsAmmo);
            }
        }
        case 
ClassMafia// Mafia class
        
{
            
format(missiontextsizeof(missiontext), Mafia_NoJobText); // Preset the missiontext
            
SetPlayerColor(playeridColorClassMafia); // Set the playercolor (chatcolor for the player and color on the map)
            // Start the PlayerCheckTimer to scan for players that carry mafia-loads (be sure the timer has been destroyed first)
            
KillTimer(APlayerData[playerid][PlayerCheckTimer]);
            
APlayerData[playerid][PlayerCheckTimer] = SetTimerEx("Mafia_CheckMafiaLoads"1000true"i"playerid);
        }
        case 
ClassCourier// Courier class
        
{
            
format(missiontextsizeof(missiontext), Courier_NoJobText); // Preset the missiontext
            
SetPlayerColor(playeridColorClassCourier); // Set the playercolor (chatcolor for the player and color on the map)
        
}
        case 
ClassAssistance// Assistance class
        
{
            
format(missiontextsizeof(missiontext), Assistance_NoJobText); // Preset the missiontext
            
SetPlayerColor(playeridColorClassAssistance); // Set the playercolor (chatcolor for the player and color on the map)
            // Start the PlayerCheckTimer to scan for players who need assistance (be sure the timer has been destroyed first)
            
KillTimer(APlayerData[playerid][PlayerCheckTimer]);
            
APlayerData[playerid][PlayerCheckTimer] = SetTimerEx("Assistance_CheckPlayers"1000true"i"playerid);
        }
        case 
ClassRoadWorker// Roadworker class
        
{
            
format(missiontextsizeof(missiontext), RoadWorker_NoJobText); // Preset the missiontext
            
SetPlayerColor(playeridColorClassRoadWorker); // Set the playercolor (chatcolor for the player and color on the map)
        
}
    }
    
// Set the missiontext
    
TextDrawSetString(APlayerData[playerid][MissionText], missiontext);
    
// Show the missiontext for this player
    
TextDrawShowForPlayer(playeridAPlayerData[playerid][MissionText]);
    
// If the player spawns and his jailtime hasn't passed yet, put him back in jail
    
if (APlayerData[playerid][PlayerJailed] != 0)
    
Police_JailPlayer(playeridAPlayerData[playerid][PlayerJailed]);
    return 
1;
}
// This callback gets called whenever a player enters a checkpoint
public OnPlayerEnterCheckpoint(playerid)
{
    
// Check the player's class
    
switch (APlayerData[playerid][PlayerClass])
    {
        case 
ClassTruckDriver// Truckdriver class
        
Trucker_OnPlayerEnterCheckpoint(playerid); // Process the checkpoint (load or unload goods)
        
case ClassBusDriver// BusDriver class
        
{
            
GameTextForPlayer(playeridTXT_BusDriverMissionPassed30004); // Show a message to let the player know he finished his job
            
BusDriver_EndJob(playerid); // End the current mission
        
}
        case 
ClassPilot// Pilot class
        
Pilot_OnPlayerEnterCheckpoint(playerid); // Process the checkpoint (load or unload)
        
case ClassMafia// Mafia class
        
Mafia_OnPlayerEnterCheckpoint(playerid);
        case 
ClassCourier// Courier class
        
Courier_OnPlayerEnterCheckpoint(playerid);
        case 
ClassRoadWorker// Roadworker class
        
{
            
// Only end the mission when doing "repair-speedcamera" jobtype (checkpoint is the base of the roadworker)
            
if (APlayerData[playerid][JobID] == 1// Repairing speedcamera's
            
{
                
GameTextForPlayer(playeridTXT_RoadworkerMissionPassed30004); // Show a message to let the player know he finished his job
                
Roadworker_EndJob(playerid); // End the current mission
            
}
            if (
APlayerData[playerid][JobID] == 2// Towing broken vehicle to shredder
            
Roadworker_EnterCheckpoint(playerid);
        }
    }
    return 
1;
}
// This callback gets called when a player enters a race-checkpoint
public OnPlayerEnterRaceCheckpoint(playerid)
{
    
// Check the player's class
    
switch (APlayerData[playerid][PlayerClass])
    {
        case 
ClassBusDriver// BusDriver class
        
Bus_EnterRaceCheckpoint(playerid); // Process the checkpoint
        
case ClassRoadWorker// Roadworker class
        
Roadworker_EnterRaceCheckpoint(playerid);
    }
    return 
1;
}
// This callback gets called whenever a player dies
public OnPlayerDeath(playeridkilleridreason)
{
    
// Setup local variables
    
new VictimName[24], KillerName[24], Msg[128];
    
// Clear the missiontext
    
TextDrawSetString(APlayerData[playerid][MissionText], " ");
    
// Hide the missiontext for this player (when the player is choosing a class, it's not required to show any mission-text)
    
TextDrawHideForPlayer(playeridAPlayerData[playerid][MissionText]);
    
// Stop any job that may have started
    
switch (APlayerData[playerid][PlayerClass])
    {
        case 
ClassTruckDriverTrucker_EndJob(playerid);
        case 
ClassBusDriverBusDriver_EndJob(playerid);
        case 
ClassPilotPilot_EndJob(playerid);
        case 
ClassPolicePolice_EndJob(playerid);
        case 
ClassMafiaMafia_EndJob(playerid);
        case 
ClassCourierCourier_EndJob(playerid);
        case 
ClassAssistanceAssistance_EndJob(playerid);
        case 
ClassRoadWorkerRoadworker_EndJob(playerid);
    }
    
// If the player is part of a convoy,kick him from it
    
Convoy_Leave(playerid);
    
// If another player kills you, he'll get an extra star of his wanted level
    
if (killerid != INVALID_PLAYER_ID)
    {
        
// Increase the wanted level of the killer by one star
        
SetPlayerWantedLevel(killeridGetPlayerWantedLevel(killerid) + 1);
        
// Get the name of the killed player and the killer
        
GetPlayerName(playeridVictimNamesizeof(VictimName));
        
GetPlayerName(killeridKillerNamesizeof(KillerName));
        
// Let the killed know the police are informed about the kill
        
format(Msg128"{FF0000}Vocк matou {FFFF00}%s{FF0000}, e agora estб sendo procurado pela polнcia."VictimName);
        
SendClientMessage(killerid0xFFFFFFFFMsg);
        
// Inform all police players about the kill
        
format(Msg128"{00FF00}O jogador {FFFF00}%s{00FF00} matou {FFFF00}%s{00FF00}. [Objetvo]: Persiga-o e Multe-o."KillerNameVictimName);
        
Police_SendMessage(Msg);
    }
    return 
1;
}
// This callback gets called when the player is selecting a class (but hasn't clicked "Spawn" yet)
public OnPlayerRequestClass(playeridclassid)
{
    
TextDrawHideForPlayer(playeridImagemEntrada);
    
SetPlayerInterior(playerid,0);
    
SetPlayerFacingAngle(playerid90.0);
    
SetPlayerPos(playerid,-1932.51,2603.14,47.36);
    
SetPlayerCameraPos(playerid,-1938.92,2602.74,47.60);
    
SetPlayerCameraLookAt(playerid,-1932.51,2603.14,47.36);
    
// Display a short message to inform the player about the class he's about to choose
    
switch (classid)
    {
        case 
01234567// Classes that will be truckdrivers
        
{
            
// Display the name of the class
            
GameTextForPlayer(playeridTXT_ClassTrucker30004);
            
// Store the class for the player (truckdriver)
            
APlayerData[playerid][PlayerClass] = ClassTruckDriver;
        }
        case 
89// Classes that will be bus-drivers
        
{
            
// Display the name of the class
            
GameTextForPlayer(playeridTXT_ClassBusDriver30004);
            
// Store the class for the player (busdriver)
            
APlayerData[playerid][PlayerClass] = ClassBusDriver;
        }
        case 
10// Classes that will be Pilot
        
{
            
// Display the name of the class
            
GameTextForPlayer(playeridTXT_ClassPilot30004);
            
// Store the class for the player (pilot)
            
APlayerData[playerid][PlayerClass] = ClassPilot;
        }
        case 
111213// Classes that will be police
        
{
            
// Display the name of the class
            
GameTextForPlayer(playeridTXT_ClassPolice30004);
            
// Store the class for the player (police)
            
APlayerData[playerid][PlayerClass] = ClassPolice;
        }
        case 
141516// Classes that will be mafia
        
{
            
// Display the name of the class
            
GameTextForPlayer(playeridTXT_ClassMafia30004);
            
// Store the class for the player (mafia)
            
APlayerData[playerid][PlayerClass] = ClassMafia;
        }
        case 
1718// Classes that will be courier
        
{
            
// Display the name of the class
            
GameTextForPlayer(playeridTXT_ClassCourier30004);
            
// Store the class for the player (courier)
            
APlayerData[playerid][PlayerClass] = ClassCourier;
        }
        case 
19// Classes that will be assistance
        
{
            
// Display the name of the class
            
GameTextForPlayer(playeridTXT_ClassAssistance30004);
            
// Store the class for the player (assistance)
            
APlayerData[playerid][PlayerClass] = ClassAssistance;
        }
        case 
202122// Classes that will be roadworker
        
{
            
// Display the name of the class
            
GameTextForPlayer(playeridTXT_ClassRoadWorker30004);
            
// Store the class for the player (roadworker)
            
APlayerData[playerid][PlayerClass] = ClassRoadWorker;
        }
    }
    return 
1;
}
// This callback is called when the player attempts to spawn via class-selection
public OnPlayerRequestSpawn(playerid)
{
    new 
IndexFloat:xFloat:yFloat:zFloat:AngleName[24], Msg[128];
    
// Get the player's name
    
GetPlayerName(playeridNamesizeof(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
            
ASpawnLocationsTrucker[Index][SpawnX]; // Get the X-position for the spawnlocation
            
ASpawnLocationsTrucker[Index][SpawnY]; // Get the Y-position for the spawnlocation
            
ASpawnLocationsTrucker[Index][SpawnZ]; // Get the Z-position for the spawnlocation
            
Angle ASpawnLocationsTrucker[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
            
format(Msg128"{FF8000}O Jogador {FFFFff}%s{FF8000} entrou no server como um {FF8000}Caminhoneiro."Name);
        }
        case 
ClassBusDriver:
        {
            
Index random(sizeof(ASpawnLocationsBusDriver));
            
ASpawnLocationsBusDriver[Index][SpawnX]; // Get the X-position for the spawnlocation
            
ASpawnLocationsBusDriver[Index][SpawnY]; // Get the Y-position for the spawnlocation
            
ASpawnLocationsBusDriver[Index][SpawnZ]; // Get the Z-position for the spawnlocation
            
Angle ASpawnLocationsBusDriver[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
            
format(Msg128"{00FFFF}O Jogador {FFFFff}%s{00FFFF} entrou no server como um {00FFFF}Motorista de Onibus."Name);
        }
        case 
ClassPilot:
        {
            
Index random(sizeof(ASpawnLocationsPilot));
            
ASpawnLocationsPilot[Index][SpawnX]; // Get the X-position for the spawnlocation
            
ASpawnLocationsPilot[Index][SpawnY]; // Get the Y-position for the spawnlocation
            
ASpawnLocationsPilot[Index][SpawnZ]; // Get the Z-position for the spawnlocation
            
Angle ASpawnLocationsPilot[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
            
format(Msg128"{008080}O Jogador {FFFFff}%s{008080} entrou no server como um {008080}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 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 
ClassTruckDriverClassBusDriverClassPilotClassMafiaClassCourierClassAssistanceClassRoadWorker:
                                    
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 nъmero mбximo de COP's online foi atingido."50004);
                    
SendClientMessage(playerid0xFFFFFFFF"{FF0000}O nъmero mбximo de COP's online foi atingido, por favor selecione outra classe.");
                    return 
0// Don't allow the player to spawn as police player
                
}
            }
            
// If the player has less than 100 scorepoints
            
if (APlayerData[playerid][PlayerScore] < 200)
            {
                
// Let the player know he needs 100 scorepoints
                
GameTextForPlayer(playerid"~r~Voce precisa de ~b~200 ~r~pontos de score, para ser um ~y~policial~r~."50004);
                
SendClientMessage(playerid0xFFFFFFFF"{FF0000}Vocк precisa ter 200 pontos de score para ser um 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 um policial enquanto estiver sendo procurado"50004);
                
SendClientMessage(playerid0xFFFFFFFF"{FF0000}Vocк nгo pode ser um policial enquanto estiver sendo procurado.");
                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"{0000FF}O Jogador {FFFFff}%s{0000FF} entrou no server como um Policial."Name);
        }
        case 
ClassMafia:
        {
            
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"{8000FF}O Jogador {FFFFff}%s{8000FF} entrou no server como um {8000FF}Mafioso."Name);
        }
        case 
ClassCourier:
        {
            
Index random(sizeof(ASpawnLocationsCourier));
            
ASpawnLocationsCourier[Index][SpawnX]; // Get the X-position for the spawnlocation
            
ASpawnLocationsCourier[Index][SpawnY]; // Get the Y-position for the spawnlocation
            
ASpawnLocationsCourier[Index][SpawnZ]; // Get the Z-position for the spawnlocation
            
Angle ASpawnLocationsCourier[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
            
format(Msg128"{FF00FF}O Jogador {FFFFff}%s{FF00FF} entrou no server como um {FF00FF}Agente dos Correios."Name);
        }
        case 
ClassAssistance:
        {
            
Index random(sizeof(ASpawnLocationsAssistance));
            
ASpawnLocationsAssistance[Index][SpawnX]; // Get the X-position for the spawnlocation
            
ASpawnLocationsAssistance[Index][SpawnY]; // Get the Y-position for the spawnlocation
            
ASpawnLocationsAssistance[Index][SpawnZ]; // Get the Z-position for the spawnlocation
            
Angle ASpawnLocationsAssistance[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
            
format(Msg128"{A5ED54}O Jogador {FFFFff}%s{A5ED54} entrou no server como um Mecвnico."Name);
        }
        case 
ClassRoadWorker:
        {
            
Index random(sizeof(ASpawnLocationsRoadWorker));
            
ASpawnLocationsRoadWorker[Index][SpawnX]; // Get the X-position for the spawnlocation
            
ASpawnLocationsRoadWorker[Index][SpawnY]; // Get the Y-position for the spawnlocation
            
ASpawnLocationsRoadWorker[Index][SpawnZ]; // Get the Z-position for the spawnlocation
            
Angle ASpawnLocationsRoadWorker[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
            
format(Msg128"{FFFF80}O Jogador {FFFFff}%s{FFFF80} entrou no server como um {FFFF80}Funcionбrio do DNIT."Name);
        }
    }
    
    
// Spawn the player with his chosen skin at a random location based on his class
    
SetSpawnInfo(playerid0GetPlayerSkin(playerid), xyzAngle000000);
    
// Send the message to all players (who joined which class)
    
SendClientMessageToAll(0xFFFFFFFFMsg);
    return 
1;
}
// This callback gets called when a vehicle respawns at it's spawn-location (where it was created)
public OnVehicleSpawn(vehicleid)
{
    
// Set the vehicle as not-wanted by the mafia
    
AVehicleData[vehicleid][MafiaLoad] = false;
    
// Also reset the fuel to maximum (only for non-owned vehicles)
    
if (AVehicleData[vehicleid][Owned] == false)
    
AVehicleData[vehicleid][Fuel] = MaxFuel;
    
// Re-apply the paintjob (if any was applied)
    
if (AVehicleData[vehicleid][PaintJob] != 0)
    {
        
// Re-apply the paintjob
        
ChangeVehiclePaintjob(vehicleidAVehicleData[vehicleid][PaintJob] - 1);
    }
    
// Also update the car-color
    
ChangeVehicleColor(vehicleidAVehicleData[vehicleid][Color1], AVehicleData[vehicleid][Color2]);
    
// Re-add all components that were installed (if they were there)
    
for (new i14i++)
    {
        
// Remove all mods from the vehicle (all added mods applied by hackers will hopefully be removed this way when the vehicle respawns)
        
RemoveVehicleComponent(vehicleidGetVehicleComponentInSlot(vehicleidi));
        
// Check if the componentslot has a valid component-id
        
if (AVehicleData[vehicleid][Components][i] != 0)
        
AddVehicleComponent(vehicleidAVehicleData[vehicleid][Components][i]); // Add the component to the vehicle
    
}
    return 
1;
}
// This callback is called when the vehicle leaves a mod shop
public OnVehicleRespray(playeridvehicleidcolor1color2)
{
    
// Let the player pay $150 for changing the color (if they have been changed)
    
if ((AVehicleData[vehicleid][Color1] != color1) || (AVehicleData[vehicleid][Color2] != color2))
    {
        
RewardPlayer(playerid, -1500);
        
SendClientMessage(playerid0xFFFFFFFF"{00FF00}Vocк alterou a cor do seu veнculo por R$150.");
    }
    
// Save the colors
    
AVehicleData[vehicleid][Color1] = color1;
    
AVehicleData[vehicleid][Color2] = color2;
    
// If the primary color is black, remove the paintjob
    
if (color1 == 0)
    
AVehicleData[vehicleid][PaintJob] = 0;
    return 
1;
}
// This callback gets called when a player enters or exits a mod-shop
public OnEnterExitModShop(playeridenterexitinteriorid)
{
    return 
1;
}
// This callback gets called whenever a player mods his vehicle
public OnVehicleMod(playeridvehicleidcomponentid)
{
    
// When the player changes a component of his vehicle, reduce the price of the component from the player's money
    
APlayerData[playerid][PlayerMoney] = APlayerData[playerid][PlayerMoney] - AVehicleModPrices[componentid 1000];
    
// Store the component in the AVehicleData array
    
AVehicleData[vehicleid][Components][GetVehicleComponentType(componentid)] = componentid;
    return 
1;
}
// This callback gets called whenever a player VIEWS at a paintjob in a mod garage (viewing automatically applies it)
public OnVehiclePaintjob(playeridvehicleidpaintjobid)
{
    
// Store the paintjobid for the vehicle (add 1 to the value, otherwise checking for an applied paintjob is difficult)
    
AVehicleData[vehicleid][PaintJob] = paintjobid 1;
    return 
1;
}
// This callback gets called whenever a player enters a vehicle
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    
// Setup local variables
    
new enginelightsalarmdoorsbonnetbootobjective;
    
// Check if the vehicle has fuel
    
if (AVehicleData[vehicleid][Fuel] > 0)
    {
        
// Start the engine and turn on the lights
        
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
        
SetVehicleParamsEx(vehicleid11alarmdoorsbonnetbootobjective);
    }
    
// Store the player's current location and interior-id, otherwise anti-airbreak hack code could kick you
    
GetPlayerPos(playeridAPlayerData[playerid][PreviousX], APlayerData[playerid][PreviousY], APlayerData[playerid][PreviousZ]);
    
APlayerData[playerid][PreviousInt] = GetPlayerInterior(playerid);
    return 
1;
}
// This callback gets called when a player exits his vehicle
public OnPlayerExitVehicle(playeridvehicleid)
{
    
// Setup local variables
    
new enginelightsalarmdoorsbonnetbootobjective;
    
// Check if the player is the driver of the vehicle
    
if (GetPlayerVehicleSeat(playerid) == 0)
    {
        
// Turn off the lights and engine
        
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
        
SetVehicleParamsEx(vehicleid00alarmdoorsbonnetbootobjective);
    }
    
// Chech if the player is a pilot
    
if (APlayerData[playerid][PlayerClass] == ClassPilot)
    {
        
// If the pilot started a job --> as soon as a pilot leaves his plane while doing a job, he fails his mission
        
if (APlayerData[playerid][JobStarted] == true)
        {
            
// End the job (clear data)
            
Pilot_EndJob(playerid);
            
// Inform the player that he failed the mission
            
GameTextForPlayer(playeridTXT_FailedMission50004);
            
// Reduce the player's cash by 1000
            
RewardPlayer(playerid, -10000);
        }
    }
    return 
1;
}
// This callback gets called whenever a vehicle enters the water or is destroyed (explodes)
public OnVehicleDeath(vehicleid)
{
    
// Get the houseid to which this vehicle belongs
    
new HouseID AVehicleData[vehicleid][BelongsToHouse];
    
// Check if this vehicle belongs to a house
    
if (HouseID != 0)
    {
        
// If the house doesn't have insurance for it's vehicles
        
if (AHouseData[HouseID][Insurance] == 0)
        {
            
// Delete the vehicle, clear the data and remove it from the house it belongs to
            
Vehicle_Delete(vehicleid);
            
// Save the house (and linked vehicles)
            
HouseFile_Save(HouseID);
        }
    }
    return 
1;
}
// This callback gets called when the player changes state
public OnPlayerStateChange(playerid,newstate,oldstate)
{
    
// Setup local variables
    
new vidName[24], Msg[128], enginelightsalarmdoorsbonnetbootobjective;
    switch (
newstate)
    {
        case 
PLAYER_STATE_DRIVER// Player became the driver of a vehicle
        
{
            
// Get the ID of the player's vehicle
            
vid GetPlayerVehicleID(playerid);
            
// Get the player's name (the one who is trying to enter the vehicle)
            
GetPlayerName(playeridNamesizeof(Name));
            
// Check if the vehicle is owned
            
if (AVehicleData[vid][Owned] == true)
            {
                
// Check if the vehicle is owned by somebody else (strcmp will not be 0)
                
if (strcmp(AVehicleData[vid][Owner], Namefalse) != 0)
                {
                    
// Force the player out of the vehicle
                    
RemovePlayerFromVehicle(playerid);
                    
// Turn off the lights and engine
                    
GetVehicleParamsEx(videnginelightsalarmdoorsbonnetbootobjective);
                    
SetVehicleParamsEx(vid00alarmdoorsbonnetbootobjective);
                    
// Let the player know he cannot use somebody else's vehicle
                    
format(Msg128TXT_SpeedometerCannotUseVehicleAVehicleData[vid][Owner]);
                    
SendClientMessage(playerid0xFFFFFFFFMsg);
                }
                
// Check if the vehicle is clamped
                
if (AVehicleData[vid][Clamped] == true)
                {
                    
// Force the player out of the vehicle
                    
RemovePlayerFromVehicle(playerid);
                    
// Turn off the lights and engine
                    
GetVehicleParamsEx(videnginelightsalarmdoorsbonnetbootobjective);
                    
SetVehicleParamsEx(vid00alarmdoorsbonnetbootobjective);
                    
// Let the player know he cannot use a clamped vehicle
                    
format(Msg128TXT_SpeedometerClampedVehicle);
                    
SendClientMessage(playerid0xFFFFFFFFMsg);
                    
format(Msg128TXT_SpeedometerClampedVehicle2);
                    
SendClientMessage(playerid0xFFFFFFFFMsg);
                }
            }
            
// Check if the player is not a cop
            
if (APlayerData[playerid][PlayerClass] != ClassPolice)
            {
                
// First check if the vehicle is a static vehicle (player can still use a bought cop-car that he bought in his house,
                // as a bought vehicle isn't static)
                
if (AVehicleData[vid][StaticVehicle] == true)
                {
                    
// Check if the entered vehicle is a cop vehicle
                    
switch (GetVehicleModel(vid))
                    {
                        case 
VehiclePoliceLSPDVehiclePoliceSFPDVehiclePoliceLVPDVehicleHPV1000VehiclePoliceRanger:
                        {
                            
// Force the player out of the vehicle
                            
RemovePlayerFromVehicle(playerid);
                            
// Turn off the lights and engine
                            
GetVehicleParamsEx(videnginelightsalarmdoorsbonnetbootobjective);
                            
SetVehicleParamsEx(vid00alarmdoorsbonnetbootobjective);
                            
// Let the player know he cannot use a cop car
                            
SendClientMessage(playerid0xFFFFFFFF"{FF0000}Vocк nгo pode usar um veнculo policial.");
                        }
                    }
                }
            }
            
// Check if the player is not a pilot
            
if (APlayerData[playerid][PlayerClass] != ClassPilot)
            {
                
// First check if the vehicle is a static vehicle (player can still use a bought plane that he bought in his house,
                // as a bought vehicle isn't static)
                
if (AVehicleData[vid][StaticVehicle] == true)
                {
                    
// Check if the entered vehicle is a plane or helicopter vehicle
                    
switch (GetVehicleModel(vid))
                    {
                        case 
VehicleShamalVehicleNevadaVehicleStuntPlaneVehicleDodoVehicleMaverickVehicleCargobob:
                        {
                            
// Force the player out of the vehicle
                            
RemovePlayerFromVehicle(playerid);
                            
// Turn off the lights and engine
                            
GetVehicleParamsEx(videnginelightsalarmdoorsbonnetbootobjective);
                            
SetVehicleParamsEx(vid00alarmdoorsbonnetbootobjective);
                            
// Let the player know he cannot use a cop car
                            
SendClientMessage(playerid0xFFFFFFFF"{FF0000}Vocк nгo pode usar um veнculo de piloto.");
                        }
                    }
                }
            }
        }
    }
    return 
1;
}
// This callback gets called whenever a player presses a key
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    
// Debug the keypresses
    //    DebugKeys(playerid, newkeys, oldkeys);
    // ****************************************************************************************
    // NOTE: the keys are messed up, so the code may look strange when testing for certain keys
    // ****************************************************************************************
    // Fining and jailing players when you're police and press the correct keys
    // Check the class of the player
    
switch (APlayerData[playerid][PlayerClass])
    {
        case 
ClassPolice:
        {
            
// If the police-player pressed the RMB key (AIM key) when OUTSIDE his vehicle
            
if (((newkeys KEY_HANDBRAKE) && !(oldkeys KEY_HANDBRAKE)) && (GetPlayerVehicleID(playerid) == 0))
            
Police_FineNearbyPlayers(playerid);
            
// If the police-player pressed the LCTRL (SECUNDAIRY key) key when INSIDE his vehicle
            
if (((newkeys KEY_ACTION) && !(oldkeys KEY_ACTION)) && (GetPlayerVehicleID(playerid) != 0))
            
Police_WarnNearbyPlayers(playerid);
        }
        case 
ClassAssistance:
        {
            
// If the assistance-player pressed the RMB key (AIM key) when OUTSIDE his vehicle
            
if (((newkeys KEY_HANDBRAKE) && !(oldkeys KEY_HANDBRAKE)) && (GetPlayerVehicleID(playerid) == 0))
            
Assistance_FixVehicle(playerid);
            
// If the police-player pressed the LCTRL (SECUNDAIRY key) key when INSIDE his vehicle
            
if (((newkeys KEY_ACTION) && !(oldkeys KEY_ACTION)) && (GetPlayerVehicleID(playerid) != 0))
            
Assistance_FixOwnVehicle(playerid);
        }
    }
    
// Trying to attach the closest vehicle to the towtruck when the player pressed FIRE when inside a towtruck
    // Check if the player is inside a towtruck
    
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == VehicleTowTruck)
    {
        
// Check if the player pushed the fire-key
        
if(newkeys KEY_FIRE)
        {
            
// Get the vehicle-id of the closest vehicle
            
new closest GetClosestVehicle(playerid);
            if(
VehicleToPlayer(playeridclosest) < 10// Check if the closest vehicle is within 10m from the player
            
AttachTrailerToVehicle(closestGetPlayerVehicleID(playerid)); // Attach the vehicle to the towtruck
        
}
    }
    
// Refuel a vehicle when driving a vehicle and pressing the HORN key
    // Check if the player presses the HORN key
    
if ((newkeys KEY_CROUCH) && !(oldkeys KEY_CROUCH))
    {
        
// Check if the player is driving a vehicle
        
if (GetPlayerVehicleSeat(playerid) == 0)
        {
            
// Loop through all ARefuelPickups
            
for (new isizeof(ARefuelPickups); i++)
            {
                
// Check if the player is in range of a refuelpickup
                
if(IsPlayerInRangeOfPoint(playerid2.5ARefuelPickups[i][pux], ARefuelPickups[i][puy], ARefuelPickups[i][puz]))
                {
                    
// Show a message that the player's vehicle is refuelling
                    
GameTextForPlayer(playeridTXT_Refuelling30004);
                    
// Don't allow the player to move again (the timer will allow it after refuelling)
                    
TogglePlayerControllable(playerid0);
                    
// Start a timer (let the player wait until the vehicle is refuelled)
                    
SetTimerEx("RefuelVehicle"5000false"i"playerid);
                    
// Stop the search
                    
break;
                }
            }
        }
    }
    return 
1;
}
forward VehicleToPlayer(playerid,vehicleid);
// Get the distance between the vehicle and the player
public VehicleToPlayer(playeridvehicleid)
{
    
// Setup local variables
    
new Float:pXFloat:pYFloat:pZFloat:cXFloat:cYFloat:cZFloat:distance;
    
// Get the player position
    
GetPlayerPos(playeridpXpYpZ);
    
// Get the vehicle position
    
GetVehiclePos(vehicleidcXcYcZ);
    
// Calculate the distance
    
distance floatsqroot(floatpower(floatabs(floatsub(cXpX)), 2) + floatpower(floatabs(floatsub(cYpY)), 2) + floatpower(floatabs(floatsub(cZpZ)), 2));
    
// Return the distance to the calling routine
    
return floatround(distance);
}
forward GetClosestVehicle(playerid);
// Find the vehicle closest to the player
public GetClosestVehicle(playerid)
{
    
// Setup local variables
    
new Float:distance 99999.000+1Float:distance2result = -1;
    
// Loop through all vehicles
    
for(new 0MAX_VEHICLESi++)
    {
        
// First check if the player isn't driving the current vehicle that needs to be checked for it's distance to the player
        
if (GetPlayerVehicleID(playerid) != i)
        {
            
// Get the distance between player and vehicle
            
distance2 VehicleToPlayer(playeridi);
            
// Check if the distance is smaller than the previous distance
            
if(distance2 distance)
            {
                
// Store the distance
                
distance distance2;
                
// Store the vehicle-id
                
result i;
            }
        }
    }
    
// Return the vehicle-id of the closest vehicle
    
return result;
}
// This function is used to debug the key-presses
stock DebugKeys(playeridnewkeysoldkeys)
{
    
// Debug keys
    
if ((newkeys KEY_FIRE) && !(oldkeys KEY_FIRE))
    
SendClientMessage(playerid0x0000FFFF"You pressed the KEY_FIRE key");
    if ((
newkeys KEY_ACTION) && !(oldkeys KEY_ACTION))
    
SendClientMessage(playerid0x0000FFFF"You pressed the KEY_ACTION key");
    if ((
newkeys KEY_CROUCH) && !(oldkeys KEY_CROUCH))
    
SendClientMessage(playerid0x0000FFFF"You pressed the KEY_CROUCH key");
    if ((
newkeys KEY_SPRINT) && !(oldkeys KEY_SPRINT))
    
SendClientMessage(playerid0x0000FFFF"You pressed the KEY_SPRINT key");
    if ((
newkeys KEY_SECONDARY_ATTACK) && !(oldkeys KEY_SECONDARY_ATTACK))
    
SendClientMessage(playerid0x0000FFFF"You pressed the KEY_SECONDARY_ATTACK key");
    if ((
newkeys KEY_JUMP) && !(oldkeys KEY_JUMP))
    
SendClientMessage(playerid0x0000FFFF"You pressed the KEY_JUMP key");
    if ((
newkeys KEY_LOOK_RIGHT) && !(oldkeys KEY_LOOK_RIGHT))
    
SendClientMessage(playerid0x0000FFFF"You pressed the KEY_LOOK_RIGHT key");
    if ((
newkeys KEY_HANDBRAKE) && !(oldkeys KEY_HANDBRAKE))
    
SendClientMessage(playerid0x0000FFFF"You pressed the KEY_HANDBRAKE key");
    if ((
newkeys KEY_LOOK_LEFT) && !(oldkeys KEY_LOOK_LEFT))
    
SendClientMessage(playerid0x0000FFFF"You pressed the KEY_LOOK_LEFT key");
    if ((
newkeys KEY_SUBMISSION) && !(oldkeys KEY_SUBMISSION))
    
SendClientMessage(playerid0x0000FFFF"You pressed the KEY_SUBMISSION key");
    if ((
newkeys KEY_LOOK_BEHIND) && !(oldkeys KEY_LOOK_BEHIND))
    
SendClientMessage(playerid0x0000FFFF"You pressed the KEY_LOOK_BEHIND key");
    if ((
newkeys KEY_WALK) && !(oldkeys KEY_WALK))
    
SendClientMessage(playerid0x0000FFFF"You pressed the KEY_WALK key");
    if ((
newkeys KEY_ANALOG_UP) && !(oldkeys KEY_ANALOG_UP))
    
SendClientMessage(playerid0x0000FFFF"You pressed the KEY_ANALOG_UP key");
    if ((
newkeys KEY_ANALOG_DOWN) && !(oldkeys KEY_ANALOG_DOWN))
    
SendClientMessage(playerid0x0000FFFF"You pressed the KEY_ANALOG_DOWN key");
    if ((
newkeys KEY_ANALOG_LEFT) && !(oldkeys KEY_ANALOG_LEFT))
    
SendClientMessage(playerid0x0000FFFF"You pressed the KEY_ANALOG_LEFT key");
    if ((
newkeys KEY_ANALOG_RIGHT) && !(oldkeys KEY_ANALOG_RIGHT))
    
SendClientMessage(playerid0x0000FFFF"You pressed the KEY_ANALOG_RIGHT key");
    if ((
newkeys KEY_UP) && !(oldkeys KEY_UP))
    
SendClientMessage(playerid0x0000FFFF"You pressed the KEY_UP key");
    if ((
newkeys KEY_DOWN) && !(oldkeys KEY_DOWN))
    
SendClientMessage(playerid0x0000FFFF"You pressed the KEY_DOWN key");
    if ((
newkeys KEY_LEFT) && !(oldkeys KEY_LEFT))
    
SendClientMessage(playerid0x0000FFFF"You pressed the KEY_LEFT key");
    if ((
newkeys KEY_RIGHT) && !(oldkeys KEY_RIGHT))
    
SendClientMessage(playerid0x0000FFFF"You pressed the KEY_RIGHT key");
    return 
1;
    public 
timed(playerid)
    {
        new 
str2[128];
        new 
hour;
        new 
minute;
        new 
second;
        
gettime(hour,minute,second);
        
format(str2sizeof(str2), "%d:%d:%d"hourminutesecond);
        
TextDrawSetString(Text:txtTimeDispstr2);
        
SetWorldTime(hour+3);
    }
    
stock IsABike(vehicleid)
    {
        new 
result;
        new 
model GetVehicleModel(vehicleid);
        switch(
model)
        {
            case 
509481510462448581522461521523463586468471result model;
            default: 
result 0;
        }
        return 
result;
    }
    public 
Climas()
    {
        new 
cl random(13);
        if(
cl == 0) { SetWeather(0);SendClientMessageToAll(CLIMATEMPO"[Rбdio] Dia Limpo, Mнnima de {0342F8}22°C{FFFFAF}, Mбxima de {F80303}26°C{FFFFAF}."); }
        if(
cl == 1) { SetWeather(1);SendClientMessageToAll(CLIMATEMPO"[Rбdio] Clima Seco, Mнnima de {0342F8}24°C{FFFFAF}, Mбxima de {F80303}28°C{FFFFAF}."); }
        if(
cl == 2) { SetWeather(3);SendClientMessageToAll(CLIMATEMPO"[Rбdio] Ventos Fortes, Mнnima de {0342F8}19°C{FFFFAF}, Mбxima de {F80303}22°C{FFFFAF}."); }
        if(
cl == 3) { SetWeather(7);SendClientMessageToAll(CLIMATEMPO"[Rбdio] Tempo Nublado com Ventos fortes, Mнnima de {0342F8}15°C{FFFFAF}, Mбxima de {F80303}18°C{FFFFAF}."); }
        if(
cl == 4) { SetWeather(8);SendClientMessageToAll(CLIMATEMPO"[Rбdio] Tempo Chuvoso com Ventos fortes, Mнnima de {0342F8}12°C{FFFFAF}, Mбxima de {F80303}15°C{FFFFAF}."); }
        if(
cl == 5) { SetWeather(9);SendClientMessageToAll(CLIMATEMPO"[Rбdio] Neblina forte, Mнnima de {0342F8}2°C{FFFFAF}, Mбxima de {F80303}5°C{FFFFAF}."); }
        if(
cl == 6) { SetWeather(11);SendClientMessageToAll(CLIMATEMPO"[Rбdio] Cйu Limpo, Mнnima de {0342F8}22°C{FFFFAF}, Mбxima de {F80303}26°C{FFFFAF}."); }
        if(
cl == 7) { SetWeather(12);SendClientMessageToAll(CLIMATEMPO"[Rбdio] Nublado com Ventos fracos, Mнnima de {0342F8}15°C{FFFFAF}, Mбxima de {F80303}18°C{FFFFAF}."); }
        if(
cl == 8) { SetWeather(13);SendClientMessageToAll(CLIMATEMPO"[Rбdio] Cйu amarelado, Mнnima de {0342F8}19°C{FFFFAF}, Mбxima de {F80303}21°C{FFFFAF}."); }
        if(
cl == 9) { SetWeather(15);SendClientMessageToAll(CLIMATEMPO"[Rбdio] Tempo Nublado, Mнnima de {0342F8}12°C{FFFFAF}, Mбxima de {F80303}15°C{FFFFAF}."); }
        if(
cl == 10) { SetWeather(16);SendClientMessageToAll(CLIMATEMPO"[Rбdio] Chuva Forte, Cuidado com a pista escorregadia, Mнnima de {0342F8}4°C{FFFFAF}, Mбxima de {F80303}7°C{FFFFAF}."); }
        if(
cl == 11) { SetWeather(17);SendClientMessageToAll(CLIMATEMPO"[Rбdio] Cйu Alaranjado, Mнnima de {0342F8}11°C{FFFFAF}, Mбxima de {F80303}14°C{FFFFAF}."); }
        if(
cl == 12) { SetWeather(19);SendClientMessageToAll(CLIMATEMPO"[Rбdio] Neblina Densa com Vento forte, Mнnima de {0342F8}-2°C{FFFFAF}, Mбxima de {F80303}1°C{FFFFAF}."); }
    }
    
stock GetOnLinePlayers()
    {
        new 
OnLine;
        for(new 
iGetMaxPlayers(); gi++)
        if(
IsPlayerConnected(i))
        
OnLine++;
        return 
OnLine;
    } 
Reply
#2

Alguйm??
Reply
#3

pode descrever melhor o bug pf ? e dar o exemplo de um sistema que esteja incluнdo nesse mesmo bug ?
Reply
#4

Amigo, o bug й o seguinte passa de 10 ON buga e jб tirei todos FS й o GM
Reply
#5

Jб te disse por skype e vou repetir: Nгo existem problemas em IDS de jogadores de SA-MP, caso houvesse seria universal do cуdigo fonte do prуprio multiplayer, o problema estб em seu script, IDS no SA-MP nгo bugam, atй porque a ъnica funзгo disponнvel relacionada com IDS do SA-MP й a "getplayerid" que apenas pega o id de um player, o bug estб no seu script, aprenda a programar ou contrate um programador, nгo retiro bugs mais de graзa.
Reply
#6

Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)