Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*VISITE NOSSO SITE: http://www.sampknd.com/
- VISITE NOSSO FACEBOOK: http://www.facebook.com/SampKnd
- SAMP KND MELHOR BLOG DE SAMP DO BRASIL
- */
- #include < a_samp >
- #include < dof2 >
- #include < zcmd >
- #define ForEach(%0,%1) \
- for(new %0 = 0; %0 != %1; %0++) if(IsPlayerConnected(%0) && !IsPlayerNPC(%0))
- #define Loop(%0,%1) \
- for(new %0 = 0; %0 != %1; %0++)
- #define IsOdd(%1) \
- ((%1) & 1)
- #define ConvertTime(%0,%1,%2,%3,%4) \
- new \
- Float: %0 = floatdiv(%1, 60000) \
- ;\
- %2 = floatround(%0, floatround_tozero); \
- %3 = floatround(floatmul(%0 - %2, 60), floatround_tozero); \
- %4 = floatround(floatmul(floatmul(%0 - %2, 60) - %3, 1000), floatround_tozero)
- #define function%0(%1) \
- forward%0(%1); public%0(%1)
- #define DIRETORIO_CORRIDAS "/Corridas/%s.ini"
- #define DIRETORIO_NOME_CORRIDAS "/Corridas/%s.txt"
- #define DEBUG_CORRIDA 1
- #define TAMANHO_CHECKPOINTS 8
- #define CONTAGEM_START 30
- #define MAX_CHECKPOINTS 800
- #define MAX_CORRIDAS 500
- #define MAX_CORRIDA_TEMPO 6000
- #define CINZA 0xAFAFAFAA
- #define VERDE 0x9FFF00FF
- #define VERMELHO 0xE60000FF
- #define AMARELO 0xFFFF00AA
- #define BRANCO 0xFFFFFFAA
- new
- vNames[212][] =
- {
- {
- "Landstalker"},
- {
- "Bravura"},
- {
- "Buffalo"},
- {
- "Linerunner"},
- {
- "Perrenial"},
- {
- "Sentinel"},
- {
- "Dumper"},
- {
- "Firetruck"},
- {
- "Trashmaster"},
- {
- "Stretch"},
- {
- "Manana"},
- {
- "Infernus"},
- {
- "Voodoo"},
- {
- "Pony"},
- {
- "Mule"},
- {
- "Cheetah"},
- {
- "Ambulance"},
- {
- "Leviathan"},
- {
- "Moonbeam"},
- {
- "Esperanto"},
- {
- "Taxi"},
- {
- "Washington"},
- {
- "Bobcat"},
- {
- "Mr Whoopee"},
- {
- "BF Injection"},
- {
- "Hunter"},
- {
- "Premier"},
- {
- "Enforcer"},
- {
- "Securicar"},
- {
- "Banshee"},
- {
- "Predator"},
- {
- "Bus"},
- {
- "Rhino"},
- {
- "Barracks"},
- {
- "Hotknife"},
- {
- "Trailer 1"},
- {
- "Previon"},
- {
- "Coach"},
- {
- "Cabbie"},
- {
- "Stallion"},
- {
- "Rumpo"},
- {
- "RC Bandit"},
- {
- "Romero"},
- {
- "Packer"},
- {
- "Monster"},
- {
- "Admiral"},
- {
- "Squalo"},
- {
- "Seasparrow"},
- {
- "Pizzaboy"},
- {
- "Tram"},
- {
- "Trailer 2"},
- {
- "Turismo"},
- {
- "Speeder"},
- {
- "Reefer"},
- {
- "Tropic"},
- {
- "Flatbed"},
- {
- "Yankee"},
- {
- "Caddy"},
- {
- "Solair"},
- {
- "Berkley's RC Van"},
- {
- "Skimmer"},
- {
- "PCJ-600"},
- {
- "Faggio"},
- {
- "Freeway"},
- {
- "RC Baron"},
- {
- "RC Raider"},
- {
- "Glendale"},
- {
- "Oceanic"},
- {
- "Sanchez"},
- {
- "Sparrow"},
- {
- "Patriot"},
- {
- "Quad"},
- {
- "Coastguard"},
- {
- "Dinghy"},
- {
- "Hermes"},
- {
- "Sabre"},
- {
- "Rustler"},
- {
- "ZR-350"},
- {
- "Walton"},
- {
- "Regina"},
- {
- "Comet"},
- {
- "BMX"},
- {
- "Burrito"},
- {
- "Camper"},
- {
- "Marquis"},
- {
- "Baggage"},
- {
- "Dozer"},
- {
- "Maverick"},
- {
- "News Chopper"},
- {
- "Rancher"},
- {
- "FBI Rancher"},
- {
- "Virgo"},
- {
- "Greenwood"},
- {
- "Jetmax"},
- {
- "Hotring"},
- {
- "Sandking"},
- {
- "Blista Compact"},
- {
- "Police Maverick"},
- {
- "Boxville"},
- {
- "Benson"},
- {
- "Mesa"},
- {
- "RC Goblin"},
- {
- "Hotring Racer A"},
- {
- "Hotring Racer B"},
- {
- "Bloodring Banger"},
- {
- "Rancher"},
- {
- "Super GT"},
- {
- "Elegant"},
- {
- "Journey"},
- {
- "Bike"},
- {
- "Mountain Bike"},
- {
- "Beagle"},
- {
- "Cropdust"},
- {
- "Stunt"},
- {
- "Tanker"},
- {
- "Roadtrain"},
- {
- "Nebula"},
- {
- "Majestic"},
- {
- "Buccaneer"},
- {
- "Shamal"},
- {
- "Hydra"},
- {
- "FCR-900"},
- {
- "NRG-500"},
- {
- "HPV1000"},
- {
- "Cement Truck"},
- {
- "Tow Truck"},
- {
- "Fortune"},
- {
- "Cadrona"},
- {
- "FBI Truck"},
- {
- "Willard"},
- {
- "Forklift"},
- {
- "Tractor"},
- {
- "Combine"},
- {
- "Feltzer"},
- {
- "Remington"},
- {
- "Slamvan"},
- {
- "Blade"},
- {
- "Freight"},
- {
- "Streak"},
- {
- "Vortex"},
- {
- "Vincent"},
- {
- "Bullet"},
- {
- "Clover"},
- {
- "Sadler"},
- {
- "Firetruck LA"},
- {
- "Hustler"},
- {
- "Intruder"},
- {
- "Primo"},
- {
- "Cargobob"},
- {
- "Tampa"},
- {
- "Sunrise"},
- {
- "Merit"},
- {
- "Utility"},
- {
- "Nevada"},
- {
- "Yosemite"},
- {
- "Windsor"},
- {
- "Monster A"},
- {
- "Monster B"},
- {
- "Uranus"},
- {
- "Jester"},
- {
- "Sultan"},
- {
- "Stratum"},
- {
- "Elegy"},
- {
- "Raindance"},
- {
- "RC Tiger"},
- {
- "Flash"},
- {
- "Tahoma"},
- {
- "Savanna"},
- {
- "Bandito"},
- {
- "Freight Flat"},
- {
- "Streak Carriage"},
- {
- "Kart"},
- {
- "Mower"},
- {
- "Duneride"},
- {
- "Sweeper"},
- {
- "Broadway"},
- {
- "Tornado"},
- {
- "AT-400"},
- {
- "DFT-30"},
- {
- "Huntley"},
- {
- "Stafford"},
- {
- "BF-400"},
- {
- "Newsvan"},
- {
- "Tug"},
- {
- "Trailer 3"},
- {
- "Emperor"},
- {
- "Wayfarer"},
- {
- "Euros"},
- {
- "Hotdog"},
- {
- "Club"},
- {
- "Freight Carriage"},
- {
- "Trailer 3"},
- {
- "Andromada"},
- {
- "Dodo"},
- {
- "RC Cam"},
- {
- "Launch"},
- {
- "Police Car (LSPD)"},
- {
- "Police Car (SFPD)"},
- {
- "Police Car (LVPD)"},
- {
- "Police Ranger"},
- {
- "Picador"},
- {
- "S.W.A.T. Van"},
- {
- "Alpha"},
- {
- "Phoenix"},
- {
- "Glendale"},
- {
- "Sadler"},
- {
- "Luggage Trailer A"},
- {
- "Luggage Trailer B"},
- {
- "Stair Trailer"},
- {
- "Boxville"},
- {
- "Farm Plow"},
- {
- "Utility Trailer"}
- },
- ConstruindoCorrida,
- ConstrucaoCorridaTipo,
- ConstrucaoVeiculo,
- ConstrucaoVeiculoCriado,
- ConstrucaoModeloID,
- NomeConstrucao[30],
- bool: BuildTakeVehPos,
- BuildVehPosCount,
- bool: BuildTakeCheckpoints,
- ConstruirCheckPointCount,
- RaceBusy = 0x00,
- NomeCorrida[30],
- VeiculoCorrida,
- CorridaTipo,
- TotalCP,
- Float: CoordVehCorrida[2][4],
- Float: CPCoords[MAX_CHECKPOINTS][4],
- CriarVehCorrida[MAX_PLAYERS],
- Index,
- PlayersCount[2],
- CountTimer,
- CountAmount,
- bool: NaCorrida[MAX_PLAYERS],
- CorridaTick,
- CorridaIniciada,
- CPProgesso[MAX_PLAYERS],
- Posicao,
- FinishCount,
- JoinCount,
- rCounter,
- CorridaTempo,
- Text: CorridaInfo[MAX_PLAYERS],
- InfoTimer[MAX_PLAYERS],
- Colocacao[MAX_PLAYERS],
- NomeCorridas[MAX_CORRIDAS][128],
- TotalCorridas,
- bool: CorrridasAutomaticas,
- TempoProgresso;
- new CarGod[MAX_VEHICLES];
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Sistema de corrida carregado com sucesso");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- ConstrucaoVeiculoCriado = (ConstrucaoVeiculoCriado == 0x01) ? (DestroyVehicle(ConstrucaoVeiculo), ConstrucaoVeiculoCriado = 0x00) : (DestroyVehicle(ConstrucaoVeiculo), ConstrucaoVeiculoCriado = 0x00);
- KillTimer(rCounter);
- KillTimer(CountTimer);
- Loop(i, MAX_PLAYERS)
- {
- DisablePlayerRaceCheckpoint(i);
- TextDrawDestroy(CorridaInfo[i]);
- DestroyVehicle(CriarVehCorrida[i]);
- NaCorrida[i] = false;
- KillTimer(InfoTimer[i]);
- }
- JoinCount = 0;
- FinishCount = 0;
- TempoProgresso = 0;
- CorrridasAutomaticas = false;
- DOF2_Exit();
- return 1;
- }
- CMD:construircorrida(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, VERMELHO, "[x] Voce Nao é Um Administrador(a) RCON!");
- if(ConstruindoCorrida != 0) return SendClientMessage(playerid, VERMELHO, "» Voce esta em Modo de Construção !");
- if(RaceBusy == 0x01) return SendClientMessage(playerid, VERMELHO, "[x] Espere primeiro até a corrida termina!");
- if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, VERMELHO, "[x] Por favor, deixe o seu veículo Primeiro!");
- ConstruindoCorrida = playerid+1;
- ShowDialog(playerid, 599);
- return 1;
- }
- CMD:iniciarcorrida(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, VERMELHO, "[x] Voce Nao é Um Administrador(a) RCON!");
- if(CorrridasAutomaticas == true) return SendClientMessage(playerid, VERMELHO, "[x] Não é possível. Corrida automática está ativada !");
- if(ConstruindoCorrida != 0) return SendClientMessage(playerid, VERMELHO, "[x] Há alguém a construção de uma corrida!");
- if(RaceBusy == 0x01 || CorridaIniciada == 1) return SendClientMessage(playerid, VERMELHO, "[x] Há uma Corrida atualmente. Espera primeiro até corrida terminar !");
- if(isnull(params)) return SendClientMessage(playerid, VERMELHO, "Use /iniciarcorrida [Nome-Da-Corrida]");
- LoadRace(playerid, params);
- return 1;
- }
- CMD:pararcorrida(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, VERMELHO, "[x] Voce Nao é Um Administrador(a) RCON!");
- if(RaceBusy == 0x00 || CorridaIniciada == 0) return SendClientMessage(playerid, VERMELHO, "[x] Não há nenhuma corrida para parar ");
- SendClientMessageToAll(VERMELHO, ">> O(a) Administrador(a) Fechou a Corrida Atual!!");
- SetPlayerPos(playerid, 1242.3445,-1815.5928,14.7578);
- return StopRace();
- }
- CMD:entrarcorrida(playerid, params[])
- {
- if(CorridaIniciada == 1) return SendClientMessage(playerid, VERMELHO, "Corrida já começou! Espera primeiro até o Fim da corrida!");
- if(RaceBusy == 0x00) return SendClientMessage(playerid, VERMELHO, "[x] Não há nenhuma corrida para participar!");
- if(NaCorrida[playerid] == true) return SendClientMessage(playerid, VERMELHO, "[x] Você já se juntou a uma corrida!");
- if(IsPlayerInAnyVehicle(playerid)) return SetTimerEx("SetupRaceForPlayer", 2500, 0, "e", playerid), RemovePlayerFromVehicle(playerid), NaCorrida[playerid] = true;
- SetupRaceForPlayer(playerid);
- NaCorrida[playerid] = true;
- CarGod[GetPlayerVehicleID(playerid)] = true;
- return 1;
- }
- CMD:autocorrida(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, VERMELHO, "[x] Voce Nao é Um Administrador(a) RCON!");
- if(RaceBusy == 0x01 || CorridaIniciada == 1) return SendClientMessage(playerid, VERMELHO, "[x] Há uma Corrida atualmente. Espera primeiro até corrida termina!");
- if(CorrridasAutomaticas == true) return SendClientMessage(playerid, VERMELHO, "[x] Já está ativado!");
- CarregarNomeCorridas();
- CarregarCorridasAutomaticas(NomeCorridas[random(TotalCorridas)]);
- CorrridasAutomaticas = true;
- SendClientMessage(playerid, VERDE, ">> Você iniciou a corrida Automatica. O filterscript vai começar uma corrida aleatória sempre que a corrida anterior acabar!");
- return 1;
- }
- CMD:pararautocorrida(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, VERMELHO, "[x] Voce Nao é Um Administrador(a) RCON!");
- if(CorrridasAutomaticas == false) return SendClientMessage(playerid, VERMELHO, "[x] Já está ativado!");
- CorrridasAutomaticas = false;
- return 1;
- }
- CMD:desistir(playerid, params[])
- {
- if(NaCorrida[playerid] == true)
- {
- CarGod[GetPlayerVehicleID(playerid)] = false;
- JoinCount--;
- NaCorrida[playerid] = false;
- DestroyVehicle(CriarVehCorrida[playerid]);
- DisablePlayerRaceCheckpoint(playerid);
- TextDrawHideForPlayer(playerid, CorridaInfo[playerid]);
- CPProgesso[playerid] = 0;
- SetPlayerPos(playerid, 1242.3445,-1815.5928,14.7578);
- KillTimer(InfoTimer[playerid]);
- TogglePlayerControllable(playerid, true);
- SetCameraBehindPlayer(playerid);
- #if defined RACE_IN_OTHER_WORLD
- SetPlayerVirtualWorld(playerid, 0);
- #endif
- } else return SendClientMessage(playerid, VERMELHO, "[x] Você não está em uma corrida!");
- return 1;
- }
- public OnVehicleDamageStatusUpdate(vehicleid, playerid)
- {
- if(CarGod[vehicleid]) RepairVehicle(vehicleid);
- return 1;
- }
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- if(CPProgesso[playerid] == TotalCP -1)
- {
- new
- TimeStamp,
- TotalRaceTime,
- string[256],
- arquivo[256],
- pName[MAX_PLAYER_NAME],
- rTime[3],
- Prize[2],
- TempTotalTime,
- TempTime[3]
- ;
- Posicao++;
- GetPlayerName(playerid, pName, sizeof(pName));
- SetVehicleHealth(GetPlayerVehicleID(playerid),999999);
- TimeStamp = GetTickCount();
- TotalRaceTime = TimeStamp - CorridaTick;
- ConvertTime(var, TotalRaceTime, rTime[0], rTime[1], rTime[2]);
- switch(Posicao)
- {
- case 1: Prize[0] = (random(random(5000)) + 10000), Prize[1] = 10;
- case 2: Prize[0] = (random(random(4500)) + 9000), Prize[1] = 9;
- case 3: Prize[0] = (random(random(4000)) + 8000), Prize[1] = 8;
- case 4: Prize[0] = (random(random(3500)) + 7000), Prize[1] = 7;
- case 5: Prize[0] = (random(random(3000)) + 6000), Prize[1] = 6;
- case 6: Prize[0] = (random(random(2500)) + 5000), Prize[1] = 5;
- case 7: Prize[0] = (random(random(2000)) + 4000), Prize[1] = 4;
- case 8: Prize[0] = (random(random(1500)) + 3000), Prize[1] = 3;
- case 9: Prize[0] = (random(random(1000)) + 2000), Prize[1] = 2;
- default: Prize[0] = random(random(1000)), Prize[1] = 1;
- }
- format(string, sizeof(string), "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", pName, Posicao);
- SendClientMessageToAll(VERMELHO, string);
- format(string, sizeof(string), "~~~~~~~~~~~~~~~ O Jogador %s Venceu a Corida em %d Lugar ~~~~~~~~~~~~~~~", pName, Posicao);
- SendClientMessageToAll(BRANCO, string);
- format(string, sizeof(string), "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", pName, Posicao);
- SendClientMessageToAll(VERMELHO, string);
- format(string, sizeof(string), "", rTime[0], rTime[1], rTime[2]);
- SendClientMessageToAll(BRANCO, string);
- format(string, sizeof(string), "", Prize[0], Prize[1]);
- SendClientMessageToAll(BRANCO, string);
- if(FinishCount <= 5)
- {
- format(arquivo, sizeof(arquivo), DIRETORIO_CORRIDAS, NomeCorrida);
- format(string, sizeof(string), "MelhorTempoCorrida-%d", TempoProgresso);
- TempTotalTime = DOF2_GetInt(arquivo, string);
- ConvertTime(var1, TempTotalTime, TempTime[0], TempTime[1], TempTime[2]);
- if(TotalRaceTime <= DOF2_GetInt(arquivo, string) || TempTotalTime == 0)
- {
- DOF2_SetInt(arquivo, string, TotalRaceTime);
- format(string, sizeof(string), "MelhorCorrida-%d", TempoProgresso);
- if(TempTotalTime != 0) format(string, sizeof(string), "", pName, DOF2_GetString(arquivo, string), -(rTime[1] - TempTime[1]), TempoProgresso+1);
- else format(string, sizeof(string), "", pName, TempoProgresso+1);
- SendClientMessageToAll(VERDE, " ");
- SendClientMessageToAll(VERDE, string);
- SendClientMessageToAll(VERDE, " ");
- format(string, sizeof(string), "MelhorCorrida-%d", TempoProgresso);
- DOF2_SetString(arquivo, string, pName);
- TempoProgresso++;
- }
- }
- FinishCount++;
- GivePlayerMoney(playerid, Prize[0]);
- SetPlayerScore(playerid, GetPlayerScore(playerid) + Prize[0]);
- DisablePlayerRaceCheckpoint(playerid);
- CPProgesso[playerid]++;
- SetPlayerPos(playerid, 1242.3445,-1815.5928,14.7578);
- if(FinishCount >= JoinCount) return StopRace();
- }
- else
- {
- CPProgesso[playerid]++;
- CPCoords[CPProgesso[playerid]][3]++;
- Colocacao[playerid] = floatround(CPCoords[CPProgesso[playerid]][3], floatround_floor);
- SetCP(playerid, CPProgesso[playerid], CPProgesso[playerid]+1, TotalCP, CorridaTipo);
- PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid)
- {
- if(NaCorrida[playerid] == true)
- {
- JoinCount--;
- NaCorrida[playerid] = false;
- DestroyVehicle(CriarVehCorrida[playerid]);
- DisablePlayerRaceCheckpoint(playerid);
- TextDrawHideForPlayer(playerid, CorridaInfo[playerid]);
- CPProgesso[playerid] = 0;
- KillTimer(InfoTimer[playerid]);
- #if defined RACE_IN_OTHER_WORLD
- SetPlayerVirtualWorld(playerid, 0);
- #endif
- }
- TextDrawDestroy(CorridaInfo[playerid]);
- if(ConstruindoCorrida == playerid+1) ConstruindoCorrida = 0;
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- CorridaInfo[playerid] = TextDrawCreate(633.000000, 348.000000, " ");
- TextDrawAlignment(CorridaInfo[playerid], 3);
- SetVehicleHealth(GetPlayerVehicleID(playerid),999999);
- TextDrawBackgroundColor(CorridaInfo[playerid], 255);
- TextDrawFont(CorridaInfo[playerid], 1);
- TextDrawLetterSize(CorridaInfo[playerid], 0.240000, 1.100000);
- TextDrawColor(CorridaInfo[playerid], -687931137);
- TextDrawSetOutline(CorridaInfo[playerid], 0);
- TextDrawSetProportional(CorridaInfo[playerid], 1);
- TextDrawSetShadow(CorridaInfo[playerid], 1);
- return 1;
- }
- public OnPlayerDeath(playerid)
- {
- if(NaCorrida[playerid] == true)
- {
- JoinCount--;
- NaCorrida[playerid] = false;
- DestroyVehicle(CriarVehCorrida[playerid]);
- DisablePlayerRaceCheckpoint(playerid);
- TextDrawHideForPlayer(playerid, CorridaInfo[playerid]);
- CPProgesso[playerid] = 0;
- KillTimer(InfoTimer[playerid]);
- #if defined RACE_IN_OTHER_WORLD
- SetPlayerVirtualWorld(playerid, 0);
- #endif
- }
- if(ConstruindoCorrida == playerid+1) ConstruindoCorrida = 0;
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch(dialogid)
- {
- case 599:
- {
- if(!response) return ConstruindoCorrida = 0;
- switch(listitem)
- {
- case 0: ConstrucaoCorridaTipo = 0;
- case 1: ConstrucaoCorridaTipo = 3;
- }
- ShowDialog(playerid, 600);
- }
- case 600..601:
- {
- if(!response) return ShowDialog(playerid, 599);
- if(!strlen(inputtext)) return ShowDialog(playerid, 601);
- if(strlen(inputtext) < 1 || strlen(inputtext) > 20) return ShowDialog(playerid, 601);
- strmid(NomeConstrucao, inputtext, 0, strlen(inputtext), sizeof(NomeConstrucao));
- ShowDialog(playerid, 602);
- }
- case 602..603:
- {
- if(!response) return ShowDialog(playerid, 600);
- if(!strlen(inputtext)) return ShowDialog(playerid, 603);
- if(isNumeric(inputtext))
- {
- if(!IsValidVehicle(strval(inputtext))) return ShowDialog(playerid, 603);
- new
- Float: pPos[4]
- ;
- GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
- GetPlayerFacingAngle(playerid, pPos[3]);
- ConstrucaoModeloID = strval(inputtext);
- ConstrucaoVeiculoCriado = (ConstrucaoVeiculoCriado == 0x01) ? (DestroyVehicle(ConstrucaoVeiculo), ConstrucaoVeiculoCriado = 0x00) : (DestroyVehicle(ConstrucaoVeiculo), ConstrucaoVeiculoCriado = 0x00);
- ConstrucaoVeiculo = CreateVehicle(strval(inputtext), pPos[0], pPos[1], pPos[2], pPos[3], random(126), random(126), (60 * 60));
- PutPlayerInVehicle(playerid, ConstrucaoVeiculo, 0);
- ConstrucaoVeiculoCriado = 0x01;
- ShowDialog(playerid, 604);
- }
- else
- {
- if(!IsValidVehicle(ReturnVehicleID(inputtext))) return ShowDialog(playerid, 603);
- new
- Float: pPos[4]
- ;
- GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
- GetPlayerFacingAngle(playerid, pPos[3]);
- ConstrucaoModeloID = ReturnVehicleID(inputtext);
- ConstrucaoVeiculoCriado = (ConstrucaoVeiculoCriado == 0x01) ? (DestroyVehicle(ConstrucaoVeiculo), ConstrucaoVeiculoCriado = 0x00) : (DestroyVehicle(ConstrucaoVeiculo), ConstrucaoVeiculoCriado = 0x00);
- ConstrucaoVeiculo = CreateVehicle(ReturnVehicleID(inputtext), pPos[0], pPos[1], pPos[2], pPos[3], random(126), random(126), (60 * 60));
- PutPlayerInVehicle(playerid, ConstrucaoVeiculo, 0);
- ConstrucaoVeiculoCriado = 0x01;
- ShowDialog(playerid, 604);
- }
- }
- case 604:
- {
- if(!response) return ShowDialog(playerid, 602);
- SendClientMessage(playerid, VERMELHO, ">> [x] IMPORTANTE: Aperte 'KEY_FIRE' Na Posiçao Local onde Será os Primeiros Lugares da Corrida.");
- SendClientMessage(playerid, VERMELHO, " Apos Setar as Posições Voce Continuara a Construção ");
- BuildVehPosCount = 0;
- BuildTakeVehPos = true;
- }
- case 605:
- {
- if(!response) return ShowDialog(playerid, 604);
- SendClientMessage(playerid, VERMELHO, ">> Insira os Check-Points Pressionando 'KEY_FIRE' ");
- SendClientMessage(playerid, VERMELHO, " [x] IMPORTANTE: Pressione 'ENTER' Quando Inserir o Ultimo Check-Point Para o a Corrida Construida for Salva e Terminada ");
- ConstruirCheckPointCount = 0;
- BuildTakeCheckpoints = true;
- }
- case 606:
- {
- if(!response) return ShowDialog(playerid, 606);
- ConstruindoCorrida = 0;
- ConstruirCheckPointCount = 0;
- BuildVehPosCount = 0;
- BuildTakeCheckpoints = false;
- BuildTakeVehPos = false;
- ConstrucaoVeiculoCriado = (ConstrucaoVeiculoCriado == 0x01) ? (DestroyVehicle(ConstrucaoVeiculo), ConstrucaoVeiculoCriado = 0x00) : (DestroyVehicle(ConstrucaoVeiculo), ConstrucaoVeiculoCriado = 0x00);
- }
- }
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- new
- string[256], CorridaArquivo[256], arquivo[256], Float: vPos[4];
- if(newkeys & KEY_FIRE)
- {
- if(ConstruindoCorrida == playerid+1)
- {
- if(BuildTakeVehPos == true)
- {
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, VERMELHO, ">> Voce Prescisa Estar em Um Veiculo");
- format(arquivo, sizeof(arquivo), DIRETORIO_CORRIDAS, NomeConstrucao);
- GetVehiclePos(GetPlayerVehicleID(playerid), vPos[0], vPos[1], vPos[2]);
- GetVehicleZAngle(GetPlayerVehicleID(playerid), vPos[3]);
- DOF2_CreateFile(arquivo);
- DOF2_SetInt(arquivo, "Modelo", ConstrucaoModeloID);
- DOF2_SetInt(arquivo, "Tipo", ConstrucaoCorridaTipo);
- format(string, sizeof(string), "PosX_%d", BuildVehPosCount), DOF2_SetFloat(arquivo, string, vPos[0]);
- format(string, sizeof(string), "PosY_%d", BuildVehPosCount), DOF2_SetFloat(arquivo, string, vPos[1]);
- format(string, sizeof(string), "PosZ_%d", BuildVehPosCount), DOF2_SetFloat(arquivo, string, vPos[2]);
- format(string, sizeof(string), "Angulo_%d", BuildVehPosCount), DOF2_SetFloat(arquivo, string, vPos[3]);
- format(string, sizeof(string), ">> Posição Do Veiculo '%d' Setado.", BuildVehPosCount+1);
- SendClientMessage(playerid, AMARELO, string);
- BuildVehPosCount++;
- }
- if(BuildVehPosCount >= 2)
- {
- BuildVehPosCount = 0;
- BuildTakeVehPos = false;
- ShowDialog(playerid, 605);
- }
- if(BuildTakeCheckpoints == true)
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, VERMELHO, "");
- if(ConstruirCheckPointCount > MAX_CHECKPOINTS) return SendClientMessage(playerid, VERMELHO, ">> Voce Atingiu o Limite Maximo de Check-Point");
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, VERMELHO, ">> Voce Prescisa Estar em Um Veiculo");
- format(arquivo, sizeof(arquivo), DIRETORIO_CORRIDAS, NomeConstrucao);
- GetVehiclePos(GetPlayerVehicleID(playerid), vPos[0], vPos[1], vPos[2]);
- format(string, sizeof(string), "CP_%d_PosX", ConstruirCheckPointCount), DOF2_SetFloat(arquivo, string, vPos[0]);
- format(string, sizeof(string), "CP_%d_PosY", ConstruirCheckPointCount), DOF2_SetFloat(arquivo, string, vPos[1]);
- format(string, sizeof(string), "CP_%d_PosZ", ConstruirCheckPointCount), DOF2_SetFloat(arquivo, string, vPos[2]);
- format(string, sizeof(string), ">> Checkpoint '%d' Setado!", ConstruirCheckPointCount+1);
- SendClientMessage(playerid, AMARELO, string);
- ConstruirCheckPointCount++;
- }
- }
- }
- if(newkeys & KEY_SECONDARY_ATTACK)
- {
- if(BuildTakeCheckpoints == true)
- {
- ShowDialog(playerid, 606);
- format(CorridaArquivo, sizeof(CorridaArquivo), DIRETORIO_NOME_CORRIDAS);
- TotalCorridas = DOF2_GetInt(CorridaArquivo, "TotalCorridas");
- TotalCorridas++;
- DOF2_SetInt(CorridaArquivo, "TotalCorridas", TotalCorridas);
- format(string, sizeof(string), "Race_%d", TotalCorridas-1);
- format(arquivo, sizeof(arquivo), DIRETORIO_CORRIDAS, NomeConstrucao);
- DOF2_SetString(CorridaArquivo, string, NomeConstrucao);
- DOF2_SetInt(arquivo, "TotalCP", ConstruirCheckPointCount);
- Loop(x, 5)
- {
- format(string, sizeof(string), "MelhorTempoCorrida-%d", x);
- DOF2_SetString(arquivo, string, "0");
- format(string, sizeof(string), "MelhorCorrida-%d", x);
- DOF2_SetString(arquivo, string, "Nenhum");
- }
- }
- }
- return 1;
- }
- function CarregarNomeCorridas()
- {
- new
- CorridaArquivo[64],string[64];
- format(CorridaArquivo, sizeof(CorridaArquivo), DIRETORIO_NOME_CORRIDAS);
- TotalCorridas = DOF2_GetInt(CorridaArquivo, "TotalCorridas");
- Loop(x, TotalCorridas)
- {
- format(string, sizeof(string), "Race_%d", x), strmid(NomeCorridas[x], DOF2_GetString(CorridaArquivo, string), 0, 20, sizeof(NomeCorridas));
- printf(">> Loaded Races: %s", NomeCorridas[x]);
- }
- return 1;
- }
- function CarregarCorridasAutomaticas(rName[])
- {
- new
- arquivo[256],
- string[256]
- ;
- format(arquivo, sizeof(arquivo), DIRETORIO_CORRIDAS, rName);
- strmid(NomeCorrida, rName, 0, strlen(rName), sizeof(NomeCorrida));
- VeiculoCorrida = DOF2_GetInt(arquivo, "Modelo");
- CorridaTipo = DOF2_GetInt(arquivo, "Tipo");
- TotalCP = DOF2_GetInt(arquivo, "TotalCP");
- #if DEBUG_CORRIDA == 1
- printf("ModeloVeiculo: %d", VeiculoCorrida);
- printf("CorridaTipo: %d", CorridaTipo);
- printf("TotalCheckpoints: %d", TotalCP);
- #endif
- Loop(x, 2)
- {
- format(string, sizeof(string), "PosX_%d", x), CoordVehCorrida[x][0] = DOF2_GetFloat(arquivo, string);
- format(string, sizeof(string), "PosY_%d", x), CoordVehCorrida[x][1] = DOF2_GetFloat(arquivo, string);
- format(string, sizeof(string), "PosZ_%d", x), CoordVehCorrida[x][2] = DOF2_GetFloat(arquivo, string);
- format(string, sizeof(string), "Angulo_%d", x), CoordVehCorrida[x][3] = DOF2_GetFloat(arquivo, string);
- #if DEBUG_CORRIDA == 1
- printf("VeiculoPos %d: %f, %f, %f, %f", x, CoordVehCorrida[x][0], CoordVehCorrida[x][1], CoordVehCorrida[x][2], CoordVehCorrida[x][3]);
- #endif
- }
- Loop(x, TotalCP)
- {
- format(string, sizeof(string), "CP_%d_PosX", x), CPCoords[x][0] = DOF2_GetFloat(arquivo, string);
- format(string, sizeof(string), "CP_%d_PosY", x), CPCoords[x][1] = DOF2_GetFloat(arquivo, string);
- format(string, sizeof(string), "CP_%d_PosZ", x), CPCoords[x][2] = DOF2_GetFloat(arquivo, string);
- #if DEBUG_CORRIDA == 1
- printf("RaceCheckPoint %d: %f, %f, %f", x, CPCoords[x][0], CPCoords[x][1], CPCoords[x][2]);
- #endif
- }
- Posicao = 0;
- FinishCount = 0;
- JoinCount = 0;
- Loop(x, 2) PlayersCount[x] = 0;
- CountAmount = CONTAGEM_START;
- CorridaTempo = MAX_CORRIDA_TEMPO;
- RaceBusy = 0x01;
- CountTimer = SetTimer("CountTillRace", 999, 1);
- TempoProgresso = 0;
- return 1;
- }
- function LoadRace(playerid, rName[])
- {
- new
- arquivo[256],
- string[256]
- ;
- format(arquivo, sizeof(arquivo), DIRETORIO_CORRIDAS, rName);
- if(!DOF2_FileExists(arquivo)) return SendClientMessage(playerid, VERMELHO, "[x] Corrida Inexistente ! ");
- strmid(NomeCorrida, rName, 0, strlen(rName), sizeof(NomeCorrida));
- VeiculoCorrida = DOF2_GetInt(arquivo, "Modelo");
- CorridaTipo = DOF2_GetInt(arquivo, "Tipo");
- TotalCP = DOF2_GetInt(arquivo, "TotalCP");
- #if DEBUG_CORRIDA == 1
- printf("ModeloVeiculo: %d", VeiculoCorrida);
- printf("CorridaTipo: %d", CorridaTipo);
- printf("TotalCheckpoints: %d", TotalCP);
- #endif
- Loop(x, 2)
- {
- format(string, sizeof(string), "PosX_%d", x), CoordVehCorrida[x][0] = DOF2_GetFloat(arquivo, string);
- format(string, sizeof(string), "PosY_%d", x), CoordVehCorrida[x][1] = DOF2_GetFloat(arquivo, string);
- format(string, sizeof(string), "PosZ_%d", x), CoordVehCorrida[x][2] = DOF2_GetFloat(arquivo, string);
- format(string, sizeof(string), "Angulo_%d", x), CoordVehCorrida[x][3] = DOF2_GetFloat(arquivo, string);
- #if DEBUG_CORRIDA == 1
- printf("VeiculoPos %d: %f, %f, %f, %f", x, CoordVehCorrida[x][0], CoordVehCorrida[x][1], CoordVehCorrida[x][2], CoordVehCorrida[x][3]);
- #endif
- }
- Loop(x, TotalCP)
- {
- format(string, sizeof(string), "CP_%d_PosX", x), CPCoords[x][0] = DOF2_GetFloat(arquivo, string);
- format(string, sizeof(string), "CP_%d_PosY", x), CPCoords[x][1] = DOF2_GetFloat(arquivo, string);
- format(string, sizeof(string), "CP_%d_PosZ", x), CPCoords[x][2] = DOF2_GetFloat(arquivo, string);
- #if DEBUG_CORRIDA == 1
- printf("RaceCheckPoint %d: %f, %f, %f", x, CPCoords[x][0], CPCoords[x][1], CPCoords[x][2]);
- #endif
- }
- Posicao = 0;
- FinishCount = 0;
- JoinCount = 0;
- Loop(x, 2) PlayersCount[x] = 0;
- NaCorrida[playerid] = true;
- CountAmount = CONTAGEM_START;
- CorridaTempo = MAX_CORRIDA_TEMPO;
- RaceBusy = 0x01;
- TempoProgresso = 0;
- SetupRaceForPlayer(playerid);
- CountTimer = SetTimer("CountTillRace", 999, 1);
- return 1;
- }
- function SetCP(playerid, PrevCP, NextCP, MaxCP, Type)
- {
- if(Type == 0)
- {
- if(NextCP == MaxCP) SetPlayerRaceCheckpoint(playerid, 1, CPCoords[PrevCP][0], CPCoords[PrevCP][1], CPCoords[PrevCP][2], CPCoords[NextCP][0], CPCoords[NextCP][1], CPCoords[NextCP][2], TAMANHO_CHECKPOINTS);
- else SetPlayerRaceCheckpoint(playerid, 0, CPCoords[PrevCP][0], CPCoords[PrevCP][1], CPCoords[PrevCP][2], CPCoords[NextCP][0], CPCoords[NextCP][1], CPCoords[NextCP][2], TAMANHO_CHECKPOINTS);
- }
- else if(Type == 3)
- {
- if(NextCP == MaxCP) SetPlayerRaceCheckpoint(playerid, 4, CPCoords[PrevCP][0], CPCoords[PrevCP][1], CPCoords[PrevCP][2], CPCoords[NextCP][0], CPCoords[NextCP][1], CPCoords[NextCP][2], TAMANHO_CHECKPOINTS);
- else SetPlayerRaceCheckpoint(playerid, 3, CPCoords[PrevCP][0], CPCoords[PrevCP][1], CPCoords[PrevCP][2], CPCoords[NextCP][0], CPCoords[NextCP][1], CPCoords[NextCP][2], TAMANHO_CHECKPOINTS);
- }
- return 1;
- }
- function SetupRaceForPlayer(playerid)
- {
- CPProgesso[playerid] = 0;
- TogglePlayerControllable(playerid, false);
- CPCoords[playerid][3] = 0;
- SetCP(playerid, CPProgesso[playerid], CPProgesso[playerid]+1, TotalCP, CorridaTipo);
- if(IsOdd(playerid)) Index = 1;
- else Index = 0;
- switch(Index)
- {
- case 0:
- {
- if(PlayersCount[0] == 1)
- {
- CoordVehCorrida[0][0] -= (6 * floatsin(-CoordVehCorrida[0][3], degrees));
- CoordVehCorrida[0][1] -= (6 * floatcos(-CoordVehCorrida[0][3], degrees));
- if(IsPlayerInAnyVehicle(playerid) == 1)
- RepairVehicle(playerid);
- CriarVehCorrida[playerid] = CreateVehicle(VeiculoCorrida, CoordVehCorrida[0][0], CoordVehCorrida[0][1], CoordVehCorrida[0][2]+2, CoordVehCorrida[0][3], random(126), random(126), (60 * 60));
- SetPlayerPos(playerid, CoordVehCorrida[0][0], CoordVehCorrida[0][1], CoordVehCorrida[0][2]+2);
- SetPlayerFacingAngle(playerid, CoordVehCorrida[0][3]);
- PutPlayerInVehicle(playerid, CriarVehCorrida[playerid], RepairVehicle(playerid));
- SetVehicleHealth(GetPlayerVehicleID(playerid),99999);
- Camera(playerid, CoordVehCorrida[0][0], CoordVehCorrida[0][1], CoordVehCorrida[0][2], CoordVehCorrida[0][3], 20);
- }
- }
- case 1:
- {
- if(PlayersCount[1] == 1)
- {
- CoordVehCorrida[1][0] -= (6 * floatsin(-CoordVehCorrida[1][3], degrees));
- CoordVehCorrida[1][1] -= (6 * floatcos(-CoordVehCorrida[1][3], degrees));
- CriarVehCorrida[playerid] = CreateVehicle(VeiculoCorrida, CoordVehCorrida[1][0], CoordVehCorrida[1][1], CoordVehCorrida[1][2]+2, CoordVehCorrida[1][3], random(126), random(126), (60 * 60));
- SetPlayerPos(playerid, CoordVehCorrida[1][0], CoordVehCorrida[1][1], CoordVehCorrida[1][2]+2);
- SetPlayerFacingAngle(playerid, CoordVehCorrida[1][3]);
- PutPlayerInVehicle(playerid, CriarVehCorrida[playerid], 0);
- SetVehicleHealth(GetPlayerVehicleID(playerid),99999);
- RepairVehicle(GetPlayerVehicleID(playerid));
- Camera(playerid, CoordVehCorrida[1][0], CoordVehCorrida[1][1], CoordVehCorrida[1][2], CoordVehCorrida[1][3], 20);
- }
- }
- }
- switch(Index)
- {
- case 0:
- {
- if(PlayersCount[0] != 1)
- {
- CriarVehCorrida[playerid] = CreateVehicle(VeiculoCorrida, CoordVehCorrida[0][0], CoordVehCorrida[0][1], CoordVehCorrida[0][2]+2, CoordVehCorrida[0][3], random(126), random(126), (60 * 60));
- SetPlayerPos(playerid, CoordVehCorrida[0][0], CoordVehCorrida[0][1], CoordVehCorrida[0][2]+2);
- SetPlayerFacingAngle(playerid, CoordVehCorrida[0][3]);
- PutPlayerInVehicle(playerid, CriarVehCorrida[playerid], 0);
- SetVehicleHealth(GetPlayerVehicleID(playerid),99999);
- RepairVehicle(GetPlayerVehicleID(playerid));
- Camera(playerid, CoordVehCorrida[0][0], CoordVehCorrida[0][1], CoordVehCorrida[0][2], CoordVehCorrida[0][3], 20);
- PlayersCount[0] = 1;
- }
- }
- case 1:
- {
- if(PlayersCount[1] != 1)
- {
- CriarVehCorrida[playerid] = CreateVehicle(VeiculoCorrida, CoordVehCorrida[1][0], CoordVehCorrida[1][1], CoordVehCorrida[1][2]+2, CoordVehCorrida[1][3], random(126), random(126), (60 * 60));
- SetPlayerPos(playerid, CoordVehCorrida[1][0], CoordVehCorrida[1][1], CoordVehCorrida[1][2]+2);
- SetVehicleHealth(GetPlayerVehicleID(playerid),99999);
- SetPlayerFacingAngle(playerid, CoordVehCorrida[1][3]);
- PutPlayerInVehicle(playerid, CriarVehCorrida[playerid], 0);
- Camera(playerid, CoordVehCorrida[1][0], CoordVehCorrida[1][1], CoordVehCorrida[1][2], CoordVehCorrida[1][3], 20);
- PlayersCount[1] = 1;
- }
- }
- }
- new
- string[128];
- #if defined RACE_IN_OTHER_WORLD
- SetPlayerVirtualWorld(playerid, 10);
- #endif
- InfoTimer[playerid] = SetTimerEx("TextInfo", 500, 1, "e", playerid);
- if(JoinCount == 1) format(string, sizeof(string), "Corrida: ~w~%s~n~~p~~h~Checkpoint: ~w~%d/%d~n~~b~~h~CorridaTempo: ~w~%s~n~~y~Posicao: ~w~1/1~n~ ", NomeCorrida, CPProgesso[playerid], TotalCP, TempoConvertido(CorridaTempo));
- else format(string, sizeof(string), "Corrida: ~w~%s~n~~p~~h~Checkpoint: ~w~%d/%d~n~~b~~h~CorridaTempo: ~w~%s~n~~y~Posicao: ~w~%d/%d~n~ ", NomeCorrida, CPProgesso[playerid], TotalCP, TempoConvertido(CorridaTempo), Colocacao[playerid], JoinCount);
- TextDrawSetString(CorridaInfo[playerid], string);
- TextDrawShowForPlayer(playerid, CorridaInfo[playerid]);
- JoinCount++;
- return 1;
- }
- function CountTillRace()
- {
- switch(CountAmount)
- {
- case 0:
- {
- ForEach(i, MAX_PLAYERS)
- {
- if(NaCorrida[i] == false)
- {
- new
- string[128]
- ;
- format(string, sizeof(string), ">> Você não pode participar de corrida chamado %s mais. Junte-se tempo está acabado!", NomeCorrida);
- SendClientMessage(i, VERMELHO, string);
- }
- }
- StartRace();
- }
- case 1..5:
- {
- new
- string[10]
- ;
- format(string, sizeof(string), "~b~%d", CountAmount);
- ForEach(i, MAX_PLAYERS)
- {
- if(NaCorrida[i] == true)
- {
- GameTextForPlayer(i, string, 999, 5);
- PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
- }
- }
- }
- case 60, 50, 40, 30, 20, 10:
- {
- new
- string[128]
- ;
- format(string, sizeof(string), ">> Uma Corrida Foi Iniciada ! Digite /EntrarRace para Participar da Corrida");
- SendClientMessageToAll(VERMELHO, string);
- }
- }
- return CountAmount--;
- }
- function StartRace()
- {
- ForEach(i, MAX_PLAYERS)
- {
- if(NaCorrida[i] == true)
- {
- TogglePlayerControllable(i, true);
- PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
- GameTextForPlayer(i, "~g~GO GO GO", 2000, 5);
- SetCameraBehindPlayer(i);
- SetVehicleHealth(GetPlayerVehicleID(i),99999);
- RepairVehicle(GetPlayerVehicleID(i));
- }
- }
- rCounter = SetTimer("RaceCounter", 900, 1);
- CorridaTick = GetTickCount();
- CorridaIniciada = 1;
- KillTimer(CountTimer);
- return 1;
- }
- function StopRace()
- {
- KillTimer(rCounter);
- CorridaIniciada = 0;
- CorridaTick = 0;
- RaceBusy = 0x00;
- JoinCount = 0;
- FinishCount = 0;
- TempoProgresso = 0;
- ForEach(i, MAX_PLAYERS)
- {
- if(NaCorrida[i] == true)
- {
- DisablePlayerRaceCheckpoint(i);
- DestroyVehicle(CriarVehCorrida[i]);
- NaCorrida[i] = false;
- TextDrawHideForPlayer(i, CorridaInfo[i]);
- CPProgesso[i] = 0;
- KillTimer(InfoTimer[i]);
- }
- }
- if(CorrridasAutomaticas == true) CarregarNomeCorridas(), CarregarCorridasAutomaticas(NomeCorridas[random(TotalCorridas)]);
- return 1;
- }
- function RaceCounter()
- {
- if(CorridaIniciada == 1)
- {
- CorridaTempo--;
- if(JoinCount <= 0)
- {
- StopRace();
- SendClientMessageToAll(VERMELHO, "---------------------------------------------------------------------------------------");
- SendClientMessageToAll(VERMELHO, "");
- SendClientMessageToAll(VERMELHO, ">> Corrida Encerrada Por Nao Haver Competidores ...");
- SendClientMessageToAll(VERMELHO, "");
- SendClientMessageToAll(VERMELHO, "---------------------------------------------------------------------------------------");
- }
- }
- if(CorridaTempo <= 0)
- {
- StopRace();
- }
- return 1;
- }
- function TextInfo(playerid)
- {
- new
- string[128]
- ;
- if(JoinCount == 1) format(string, sizeof(string), "Corrida: ~w~%s~n~~p~~h~Checkpoint: ~w~%d/%d~n~~b~~h~CorridaTempo: ~w~%s~n~~y~Posicao: ~w~1/1~n~", NomeCorrida, CPProgesso[playerid], TotalCP, TempoConvertido(CorridaTempo));
- else format(string, sizeof(string), "Corrida: ~w~%s~n~~p~~h~Checkpoint: ~w~%d/%d~n~~b~~h~CorridaTempo: ~w~%s~n~~y~Posicao: ~w~%d/%d~n~", NomeCorrida, CPProgesso[playerid], TotalCP, TempoConvertido(CorridaTempo), Colocacao[playerid], JoinCount);
- TextDrawSetString(CorridaInfo[playerid], string);
- TextDrawShowForPlayer(playerid, CorridaInfo[playerid]);
- }
- function Camera(playerid, Float:X, Float:Y, Float:Z, Float:A, Mul)
- {
- SetPlayerCameraLookAt(playerid, X, Y, Z);
- SetPlayerCameraPos(playerid, X + (Mul * floatsin(-A, degrees)), Y + (Mul * floatcos(-A, degrees)), Z+6);
- }
- function IsPlayerInRace(playerid)
- {
- if(NaCorrida[playerid] == true) return true;
- else return false;
- }
- function ShowDialog(playerid, dialogid)
- {
- switch(dialogid)
- {
- case 599: ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, CreateCaption("Construir Nova Corrida"), "\
- Corrida Terrestre / Nautica\n\
- Corrida Aerea", "Next", "Exit");
- case 600: ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, CreateCaption("Construir Nova Corrida (Etapa 1/4)"), "\
- {F50000}Etapa 1:\n\
- \n\
- {A1A1A3}Bem Vindo a Modo 'Construção de Corrida'.\n\
- Aqui Voce Iniciar a Construir uma Nova Corrida, Insira um NOME para Sua Corrida, EX: RACE-1\n\n\
- >> Insira Um NOME para Sua Corrida e Pressione 'Next' Para Continuar.", "Next", "Back");
- case 601: ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, CreateCaption("Construir Nova Corrida (Etapa 1/4)"), "\
- {F50000}ERRO: Nome Da Corrida Muito Grande/Pequeno (Min. 1 - Max. 20)\n\n\
- {F50000}Etapa 1:\n\
- ********\n\
- {A1A1A3}Bem Vindo ao Modo 'Construção de Corrida'.\n\
- Aqui Voce Iniciar a Construir uma Nova Corrida, Insira um NOME para Sua Corrida, EX: RACE-1\n\n\
- >> Insira o Nome da Corrida e Pressione 'Next' Para Continuar", "Next", "Back");
- case 602: ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, CreateCaption("Construir Nova Corrida (Etapa 2/4)"), "\
- {F50000}Etapa 2:\n\
- \n\
- {A1A1A3}Insira o ID do Veiculo a Ser usado Na Corrida Ou o NOME Para Continuar Sua Construção.\n\n\
- >> Insira o ID ou o NOME Do Veiculo e Pressione 'Next' Para Continuar. 'Back' Para Voltar.", "Next", "Back");
- case 603: ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, CreateCaption("Construir Nova Corrida (Etapa 2/4)"), "\
- {F50000}ERRO: ID Invalido/Nome\n\n\
- {F50000}Etapa 2:\n\
- \n\
- {A1A1A3}ID Invalido! Insira o ID do Veiculo a Ser usado Na Corrida Ou o NOME Para Continuar Sua Construção.\n\n\
- >> Insira o ID ou o NOME Do Veiculo e Pressione 'Next' Para Continuar. 'Back' Para Voltar. ", "Next", "Back");
- case 604: ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, CreateCaption("Construir Nova Corrida (Etapa 3/4)"),
- "\
- {F50000}Etapa3:\n\
- \n\
- {A1A1A3}Agora Voce Tera que Setar as Posições do Primeiro e Segundo Lugar da Largada.\n\
- Nota: Clicando Em 'OK' Retorna em Modo Free. Aperte 'KEY_FIRE' Para Setar as Posições do Primeiro e Segundo Lugar. \n\
- Nota: Apos Setar as Posições, Voce ira para a Ultima Etapa da Construção\n\n\
- >> Pressione 'OK' Para Continuar. 'Back' Para Voltar.", "OK", "Back");
- case 605: ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, CreateCaption("Construir Nova Corrida (Etapa 4/4)"),
- "\
- {F50000}Etapa 4:\n\
- \n\
- {A1A1A3}Aqui Voce Setara os Check-Points Para Sua Corrida.\n\
- Para Setar os Check-Poits Pressione 'KEY_FIRE' No Lugar Desejado, o Check-Point Ira Salvar Automaticamente. \n\
- Ao Terminar Pressione 'ENTER' Para Finalizar Sua Corrida \n\n\
- >> Pressione 'OK' Para Continuar. 'Back' Para Voltar.", "OK", "Back");
- case 606: ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, CreateCaption("Construir Nova Corrida (Done)"),
- "\
- Você Criou uma nova Corrida. \n\n\
- >> Pressione 'Final' Para Terminar ou 'Exit' Para Sair Sem Salvar a Corrida ", "Final", "Exit");
- }
- return 1;
- }
- CreateCaption(arguments[])
- {
- new
- string[128 char]
- ;
- format(string, sizeof(string), "{03FF5F}» {F50000}Corrida", arguments);
- return string;
- }
- stock IsValidVehicle(vehicleid)
- {
- if(vehicleid < 400 || vehicleid > 611) return false;
- else return true;
- }
- ReturnVehicleID(vName[])
- {
- Loop(x, 211)
- {
- if(strfind(vNames[x], vName, true) != -1)
- return x + 400;
- }
- return -1;
- }
- TempoConvertido(seconds)
- {
- new tmp[16];
- new minutes = floatround(seconds/60);
- seconds -= minutes*60;
- format(tmp, sizeof(tmp), "%d:%02d", minutes, seconds);
- return tmp;
- }
- stock isNumeric(const string[])
- {
- new length=strlen(string);
- if (length==0) return false;
- for (new i = 0; i < length; i++)
- {
- if (
- (string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+')
- || (string[i]=='-' && i!=0)
- || (string[i]=='+' && i!=0)
- ) return false;
- }
- if (length==1 && (string[0]=='-' || string[0]=='+')) return false;
- return true;
- }
- forward GodModEvento();
- public GodModEvento()
- {
- for(new i; i < MAX_VEHICLES; ++i)
- {
- RepairVehicle(i);
- SetVehicleHealth(i, 1000.0);
- }
- return 1;
- }
Add Comment
Please, Sign In to add comment