Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Criando Creditos pelo Rei Ayanami e Extreme_
- [FS] Corrida Race Construir
- Não retire meu creditos -_-
- Meu discord e FuriaDaNoite#2316
- CORRIDA 3°
- [NOVOS ADICIONAR]
- Adicionar Corrida TextDraw
- Adicionar Ckeckpoint Pequeno
- Adicionar dinheiro aleatório
- Adicionar Comandos Fixed: /sairrace
- Adicionar Comandos: /eventos
- */
- #include <a_samp>
- #include <Dini_race>
- #include <zcmd>
- #pragma unused \
- ret_memcpy
- #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 MAX_RACE_CHECKPOINTS_EACH_RACE \
- 120
- #define MAX_RACES \
- 100
- #define COUNT_DOWN_TILL_RACE_START \
- 31 // segundo
- #define MAX_RACE_TIME \
- 300 // segundo
- #define RACE_CHECKPOINT_SIZE \
- 5.10
- #define DEBUG_RACE \
- 1
- #define GREY \
- 0xAFAFAFAA
- #define GREEN \
- 0x9FFF00FF
- #define RED \
- 0xE60000FF
- #define YELLOW \
- 0xFFFF00AA
- #define WHITE \
- 0xFFFFFFAA
- #define SD ShowPlayerDialog
- #define DIALOG_BEGIN 905
- #define DM DIALOG_STYLE_MSGBOX
- #define CM_MAX_PLAYERS (20) // maximo jogador 20 slots
- new EntrarSlots;
- 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"}
- },
- BuildRace,
- BuildRaceType,
- BuildVehicle,
- BuildCreatedVehicle,
- BuildModeVID,
- BuildName[30],
- bool: BuildTakeVehPos,
- BuildVehPosCount,
- bool: BuildTakeCheckpoints,
- BuildCheckPointCount,
- RaceBusy = 0x00,
- RaceName[30],
- RaceVehicle,
- RaceType,
- TotalCP,
- Float: RaceVehCoords[2][4],
- Float: CPCoords[MAX_RACE_CHECKPOINTS_EACH_RACE][4],
- CreatedRaceVeh[MAX_PLAYERS],
- Index,
- PlayersCount[2],
- CountTimer,
- CountAmount,
- bool: Joined[MAX_PLAYERS],
- RaceTick,
- RaceStarted,
- CPProgess[MAX_PLAYERS],
- Position,
- FinishCount,
- JoinCount,
- rCounter,
- RaceTime,
- Text: RaceInfo[MAX_PLAYERS],
- InfoTimer[MAX_PLAYERS],
- RacePosition[MAX_PLAYERS],
- RaceNames[MAX_RACES][128],
- TotalRaces,
- bool: AutomaticRace,
- TimeProgress
- ;
- public OnFilterScriptExit()
- {
- BuildCreatedVehicle = (BuildCreatedVehicle == 0x01) ? (DestroyVehicle(BuildVehicle), BuildCreatedVehicle = 0x00) : (DestroyVehicle(BuildVehicle), BuildCreatedVehicle = 0x00);
- KillTimer(rCounter);
- KillTimer(CountTimer);
- Loop(i, MAX_PLAYERS)
- {
- DisablePlayerRaceCheckpoint(i);
- TextDrawDestroy(RaceInfo[i]);
- DestroyVehicle(CreatedRaceVeh[i]);
- Joined[i] = false;
- KillTimer(InfoTimer[i]);
- }
- JoinCount = 0;
- FinishCount = 0;
- TimeProgress = 0;
- AutomaticRace = false;
- return 1;
- }
- //>>>>>>>>>>>>>>>> COMANDOS <<<<<<<<<<<<<<<<<<<
- CMD:eventos(playerid)
- {
- new string[618];
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, RED, "{ffffff}» {ff2400}Voce nao e uma administrador!");
- strcat(string, "{ff2400}Corrida Evento {02F6E5}3°\n\n");
- strcat(string, "{ffffff}/startautorace {02F6E5}Iniciar corrida aleatoria automaticamente\n");
- strcat(string, "{ffffff}/stopautorace {02F6E5}Fechar Corrida Desativado\n");
- strcat(string, "{ffffff}/iniciarrace {02F6E5}nome do corrida mapas\n");
- strcat(string, "{ffffff}/relogarace {02F6E5}para corrida relogar automaticamente\n");
- strcat(string, "{ffffff}/stoprace {02F6E5}corrida aleatoria automaticamente novamente\n");
- strcat(string, "{ffffff}/criarace {02F6E5}Construir na corrida\n");
- strcat(string, "{ffffff}/addveh {02F6E5}Adicionar posicao Veiculos\n");
- strcat(string, "{ffffff}/addcp {02F6E5}Adicionar Posicao Ckeckpoint\n");
- strcat(string, "{ffffff}/endcp {02F6E5}Final Linha Posicao Ckeckpoint\n\n");
- strcat(string, "{ff2400}Creditos By FuriaDaNoite & Mateus Santos\n");
- SD(playerid, DIALOG_BEGIN, DM, "Menu Evento", string, "Ok", "");
- return 1;
- }
- CMD:criarace(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, RED, "» Voce nao e uma administrador!!");
- if(BuildRace != 0) return SendClientMessage(playerid, RED, "<!> There's already someone building a race!");
- if(RaceBusy == 0x01) return SendClientMessage(playerid, RED, "<!> Espere primeiro ate a corrida terminar!");
- if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, RED, "<!> Por favor, deixe seu veiculo primeiro!");
- BuildRace = playerid+1;
- ShowDialog(playerid, 599);
- return 1;
- }
- CMD:iniciarace(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, RED, "» Voce nao e uma administrador!!");
- if(AutomaticRace == true) return SendClientMessage(playerid, RED, "<!> Nao e possivel. A corrida automatica esta habilitada!");
- if(BuildRace != 0) return SendClientMessage(playerid, RED, "<!> Alguem esta construindo uma corrida!");
- if(RaceBusy == 0x01 || RaceStarted == 1) return SendClientMessage(playerid, RED, "<!> Ha uma corrida atualmente. Espere primeiro ate a corrida terminar!");
- if(isnull(params)) return SendClientMessage(playerid, RED, "<!> /iniciarace [nome corrida]");
- LoadRace(playerid, params);
- return 1;
- }
- CMD:relogarace(playerid, params[])
- {
- new pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, sizeof(pName));
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, RED, "» Voce nao e uma administrador!!");
- if(RaceBusy == 0x00 || RaceStarted == 0) return SendClientMessage(playerid, RED, "<!> Nao ha corrida para parar!");
- return StopRace();
- }
- CMD:stoprace(playerid, params[])
- {
- new pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, sizeof(pName));
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, RED, "» Voce nao e uma administrador!!");
- KillTimer(CountTimer);
- if(RaceBusy == 0x00 || RaceStarted == 0) return StopRace();
- return 1;
- }
- CMD:entermp(playerid, params[])
- {
- new string[800], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, sizeof(pName));
- if(RaceStarted == 1) return SendClientMessage(playerid, RED, "{30D5C8}» {ffffff}Por favor espere ate o final do evento.");
- if(RaceBusy == 0x00) return SendClientMessage(playerid, RED, "{30D5C8}» {ffffff}Corrida esta Desativado.");
- if(Joined[playerid] == true) return SendClientMessage(playerid, RED, "{30D5C8}» {ffffff}Voce ja entrou no lobby.");
- if(EntrarSlots >= CM_MAX_PLAYERS) return SendClientMessage(playerid, 0xE74C3CFF, "ERROR: {FFFFFF}Voce nao pode participar do evento Race porque esta cheio.");
- EntrarSlots++;
- format(string, sizeof(string), "{08E8DE}» {FFFFFF}Jogador {08E8DE}%s {FFFFFF}Entrou na corrida Mapas: {08E8DE}%s{FFFFFF} {09e9de}[%d/%d]", pName, RaceName, EntrarSlots, CM_MAX_PLAYERS);
- SendClientMessageToAll(GREEN, string);
- Joined[playerid] = true;
- return 1;
- }
- CMD:startautorace(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, RED, "» Voce nao e uma administrador!");
- if(RaceBusy == 0x01 || RaceStarted == 1) return SendClientMessage(playerid, RED, "<!> Calma Corrida Ira Acabado segundo temporario evento");
- if(AutomaticRace == true) return SendClientMessage(playerid, RED, "<!> ja foi Ativado!");
- LoadRaceNames();
- LoadAutoRace(RaceNames[random(TotalRaces)]);
- AutomaticRace = true;
- SendClientMessage(playerid, GREEN, ">> Voce Iniciando Automaticar Aleartorio Race MP!");
- //if(RaceBusy == 0x00) return SendClientMessage(playerid, RED, "<!> Nao ha corrida para parar!");
- return 1;
- }
- CMD:stopautorace(playerid, params[])
- {
- new string[500];
- format(string, sizeof(string), "{08E8DE}» {FFFFFF}CORRIDA ESTA DESATIVADO!");
- SendClientMessageToAll(GREEN, string);
- if(AutomaticRace == false) //return SendClientMessage(playerid, RED, "{08E8DE}» {FFFFFF}CORRIDA ESTA DESATIVADO!");
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, RED, "» Voce nao e uma administrador!!");
- AutomaticRace = false;
- if(RaceBusy == 0x00) return SendClientMessage(playerid, RED, "<!> Nao ha corrida para parar!");
- return 1;
- }
- CMD:sairrace(playerid, params[])
- {
- new string[500], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, sizeof(pName));
- if(Joined[playerid] == true)
- {
- JoinCount--;
- Joined[playerid] = false;
- DestroyVehicle(CreatedRaceVeh[playerid]);
- DisablePlayerRaceCheckpoint(playerid);
- TextDrawHideForPlayer(playerid, RaceInfo[playerid]);
- CPProgess[playerid] = 0;
- KillTimer(InfoTimer[playerid]);
- format(string, sizeof(string), "{08E8DE}» {FFFFFF}Jogador {08E8DE}%s {FFFFFF}Saiu na corrida", pName);
- SendClientMessageToAll(WHITE, string);
- EntrarSlots = 0;
- TogglePlayerControllable(playerid, true);
- SetCameraBehindPlayer(playerid);
- #if defined RACE_IN_OTHER_WORLD
- SetPlayerVirtualWorld(playerid, 0);
- #endif
- } else return SendClientMessage(playerid, RED, "<!> Voce nao esta em uma corrida!");
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch(dialogid)
- {
- case 599:
- {
- if(!response) return BuildRace = 0;
- switch(listitem)
- {
- case 0: BuildRaceType = 0;
- case 1: BuildRaceType = 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(BuildName, inputtext, 0, strlen(inputtext), sizeof(BuildName));
- 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]);
- BuildModeVID = strval(inputtext);
- BuildCreatedVehicle = (BuildCreatedVehicle == 0x01) ? (DestroyVehicle(BuildVehicle), BuildCreatedVehicle = 0x00) : (DestroyVehicle(BuildVehicle), BuildCreatedVehicle = 0x00);
- BuildVehicle = CreateVehicle(strval(inputtext), pPos[0], pPos[1], pPos[2], pPos[3], random(126), random(126), (60 * 60));
- PutPlayerInVehicle(playerid, BuildVehicle, 0);
- BuildCreatedVehicle = 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]);
- BuildModeVID = ReturnVehicleID(inputtext);
- BuildCreatedVehicle = (BuildCreatedVehicle == 0x01) ? (DestroyVehicle(BuildVehicle), BuildCreatedVehicle = 0x00) : (DestroyVehicle(BuildVehicle), BuildCreatedVehicle = 0x00);
- BuildVehicle = CreateVehicle(ReturnVehicleID(inputtext), pPos[0], pPos[1], pPos[2], pPos[3], random(126), random(126), (60 * 60));
- PutPlayerInVehicle(playerid, BuildVehicle, 0);
- BuildCreatedVehicle = 0x01;
- ShowDialog(playerid, 604);
- }
- }
- case 604:
- {
- if(!response) return ShowDialog(playerid, 602);
- SendClientMessage(playerid, GREEN, "{ffffff}>> Va para a linha de partida na estrada a esquerda e pressione {ff2400}'/addveh' {ffffff}e faca o mesmo com o bloqueio certo.");
- SendClientMessage(playerid, GREEN, "{ffffff}>> Quando isso for feito, voce vera uma caixa de dialogo para continuar.");
- BuildVehPosCount = 0;
- BuildTakeVehPos = true;
- }
- case 605:
- {
- if(!response) return ShowDialog(playerid, 604);
- SendClientMessage(playerid, GREEN, "{ffffff}>> Comece a fazer checkpoints agora clicando {ff2400}'/addcp'");
- SendClientMessage(playerid, GREEN, "{ffffff}>> IMPORTANTE: Pressione {ff2400}'/endcp' {ffffff}quando voce terminar com os pontos de verificacao! Se nao reagir, pressione novamente e novamente.");
- BuildCheckPointCount = 0;
- BuildTakeCheckpoints = true;
- }
- case 606:
- {
- if(!response) return ShowDialog(playerid, 606);
- BuildRace = 0;
- BuildCheckPointCount = 0;
- BuildVehPosCount = 0;
- BuildTakeCheckpoints = false;
- BuildTakeVehPos = false;
- BuildCreatedVehicle = (BuildCreatedVehicle == 0x01) ? (DestroyVehicle(BuildVehicle), BuildCreatedVehicle = 0x00) : (DestroyVehicle(BuildVehicle), BuildCreatedVehicle = 0x00);
- return 1;
- }
- }
- return 1;
- }
- //------------------------------------------------
- public OnPlayerDisconnect(playerid)
- {
- new string[400], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, sizeof(pName));
- if(Joined[playerid] == true)
- {
- JoinCount--;
- Joined[playerid] = false;
- DestroyVehicle(CreatedRaceVeh[playerid]);
- DisablePlayerRaceCheckpoint(playerid);
- TextDrawHideForPlayer(playerid, RaceInfo[playerid]);
- CPProgess[playerid] = 0;
- KillTimer(InfoTimer[playerid]);
- format(string, sizeof(string), "{08E8DE}» {FFFFFF}Jogador {08E8DE}%s {FFFFFF}saiu na corrida lobby.", pName);
- SendClientMessageToAll(-1, string);
- EntrarSlots = 0;
- #if defined RACE_IN_OTHER_WORLD
- SetPlayerVirtualWorld(playerid, 0);
- #endif
- }
- TextDrawDestroy(RaceInfo[playerid]);
- if(BuildRace == playerid+1) BuildRace = 0;
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- //Sistema de corrida Evento - Textdraw
- RaceInfo[playerid] = TextDrawCreate(13.294108, 271.666687, " ");
- TextDrawAlignment(RaceInfo[playerid], 1);
- TextDrawBackgroundColor(RaceInfo[playerid], 255);
- TextDrawFont(RaceInfo[playerid], 1);
- TextDrawLetterSize(RaceInfo[playerid], 0.449999, 1.600000);
- TextDrawTextSize(RaceInfo[playerid], 200.588256, 110.416664);
- TextDrawColor(RaceInfo[playerid], -1);
- TextDrawUseBox(RaceInfo[playerid], 1);
- TextDrawBoxColor(RaceInfo[playerid], 255);
- TextDrawSetOutline(RaceInfo[playerid], 0);
- TextDrawSetProportional(RaceInfo[playerid], 1);
- TextDrawSetShadow(RaceInfo[playerid], 1);
- return 1;
- }
- //Corrida: veiculos de saida na porta - automático saiu lobby
- public OnPlayerDeath(playerid)
- {
- new string[400], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, sizeof(pName));
- if(Joined[playerid] == true)
- {
- JoinCount--;
- Joined[playerid] = false;
- DestroyVehicle(CreatedRaceVeh[playerid]);
- DisablePlayerRaceCheckpoint(playerid);
- TextDrawHideForPlayer(playerid, RaceInfo[playerid]);
- CPProgess[playerid] = 0;
- KillTimer(InfoTimer[playerid]);
- format(string, sizeof(string), "{08E8DE}» {FFFFFF}Jogador {08E8DE}%s {FFFFFF}saiu na corrida lobby", pName);
- SendClientMessageToAll(WHITE, string);
- EntrarSlots = 0;
- #if defined RACE_IN_OTHER_WORLD
- SetPlayerVirtualWorld(playerid, 0);
- #endif
- }
- if(BuildRace == playerid+1) BuildRace = 0;
- return 1;
- }
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- if(CPProgess[playerid] == TotalCP -1)
- {
- new
- TimeStamp,
- TotalRaceTime,
- string[256],
- rFile[256],
- pName[MAX_PLAYER_NAME],
- rTime[3],
- Prize[2],
- TempTotalTime,
- TempTime[3]
- ;
- Position++;
- GetPlayerName(playerid, pName, sizeof(pName));
- TimeStamp = GetTickCount();
- TotalRaceTime = TimeStamp - RaceTick;
- ConvertTime(var, TotalRaceTime, rTime[0], rTime[1], rTime[2]);
- switch(Position)
- {
- case 1: Prize[0] = (random(random(250000)) + 250000), Prize[1] = 30;
- case 2: Prize[0] = (random(random(10000)) + 10000), Prize[1] = 20;
- case 3: Prize[0] = (random(random(1000)) + 1000), Prize[1] = 10;
- case 4: Prize[0] = (random(random(8000)) + 8000), Prize[1] = 7;
- case 5: Prize[0] = (random(random(8000)) + 8000), Prize[1] = 6;
- case 6: Prize[0] = (random(random(8000)) + 8000), Prize[1] = 5;
- case 7: Prize[0] = (random(random(8000)) + 8000), Prize[1] = 4;
- case 8: Prize[0] = (random(random(8000)) + 8000), Prize[1] = 3;
- case 9: Prize[0] = (random(random(8000)) + 8000), Prize[1] = 2;
- case 10: Prize[0] = (random(random(8000)) + 8000), Prize[1] = 1;
- default: Prize[0] = random(random(50000)), Prize[1] = 0;
- }
- new GranaExp = random(100000);// < Dinheiro Aleatorio
- GivePlayerMoney(playerid, GranaExp);
- format(string, sizeof(string), "{08E8DE}» {FFFFFF}Jogador {08E8DE}%s {FFFFFF}tomar um {08E8DE}%d {FFFFFF}lugar.", pName, Position);
- SetPlayerVirtualWorld(playerid, 0);
- EntrarSlots = 0;
- //SetPlayerPos(playerid, 1753.7681,-1894.2273,13.5571);
- SendClientMessageToAll(WHITE, string);
- if(FinishCount <= 10)
- {
- format(rFile, sizeof(rFile), "/rRaceSystem/%s.RRACE", RaceName);
- format(string, sizeof(string), "BestRacerTime_%d", TimeProgress);
- TempTotalTime = dini_Int(rFile, string);
- ConvertTime(var1, TempTotalTime, TempTime[0], TempTime[1], TempTime[2]);
- if(TotalRaceTime <= dini_Int(rFile, string) || TempTotalTime == 0)
- {
- dini_IntSet(rFile, string, TotalRaceTime);
- format(string, sizeof(string), "BestRacer_%d", TimeProgress);
- format(string, sizeof(string), "BestRacer_%d", TimeProgress);
- dini_Set(rFile, string, pName);
- TimeProgress++;
- }
- }
- FinishCount++;
- //GivePlayerMoney(playerid, Prize[0]);
- SetPlayerScore(playerid, GetPlayerScore(playerid) + Prize[1]);
- DisablePlayerRaceCheckpoint(playerid);
- TextDrawHideForPlayer(playerid, RaceInfo[playerid]);
- CPProgess[playerid]++;
- if(FinishCount >= JoinCount) return StopRace();
- }
- else
- {
- CPProgess[playerid]++;
- CPCoords[CPProgess[playerid]][3]++;
- RacePosition[playerid] = floatround(CPCoords[CPProgess[playerid]][3], floatround_floor);
- SetCP(playerid, CPProgess[playerid], CPProgess[playerid]+1, TotalCP, RaceType);
- PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
- }
- return 1;
- }
- CMD:addveh(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, RED, "» Voce nao e uma administrador!!");
- new string[256], rFile[256], Float: vPos[4];
- if(BuildRace == playerid+1)
- {
- if(BuildTakeVehPos == true)
- {
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, RED, ">> Voce precisa estar em um veiculo");
- format(rFile, sizeof(rFile), "rRaceSystem/%s.RRACE", BuildName);
- GetVehiclePos(GetPlayerVehicleID(playerid), vPos[0], vPos[1], vPos[2]);
- GetVehicleZAngle(GetPlayerVehicleID(playerid), vPos[3]);
- dini_Create(rFile);
- dini_IntSet(rFile, "vModel", BuildModeVID);
- dini_IntSet(rFile, "rType", BuildRaceType);
- format(string, sizeof(string), "vPosX_%d", BuildVehPosCount), dini_FloatSet(rFile, string, vPos[0]);
- format(string, sizeof(string), "vPosY_%d", BuildVehPosCount), dini_FloatSet(rFile, string, vPos[1]);
- format(string, sizeof(string), "vPosZ_%d", BuildVehPosCount), dini_FloatSet(rFile, string, vPos[2]);
- format(string, sizeof(string), "vAngle_%d", BuildVehPosCount), dini_FloatSet(rFile, string, vPos[3]);
- format(string, sizeof(string), ">>Posicionar veiculos '%d' Adicionar linha de veiculos", BuildVehPosCount+1);
- SendClientMessage(playerid, YELLOW, string);
- BuildVehPosCount++;
- }
- if(BuildVehPosCount >= 2)
- {
- BuildVehPosCount = 0;
- BuildTakeVehPos = false;
- ShowDialog(playerid, 605);
- }
- }
- return 1;
- }
- CMD:addcp(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, RED, "» Voce nao e uma administrador!!");
- new string[256], rFile[256], Float: vPos[4];
- if(BuildTakeCheckpoints == true)
- {
- if(BuildCheckPointCount > MAX_RACE_CHECKPOINTS_EACH_RACE) return SendClientMessage(playerid, RED, ">> Voce atingiu a quantidade maxima de ckeckpoint!");
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, RED, ">> Voce precisa estar em um veiculo");
- format(rFile, sizeof(rFile), "rRaceSystem/%s.RRACE", BuildName);
- GetVehiclePos(GetPlayerVehicleID(playerid), vPos[0], vPos[1], vPos[2]);
- format(string, sizeof(string), "CP_%d_PosX", BuildCheckPointCount), dini_FloatSet(rFile, string, vPos[0]);
- format(string, sizeof(string), "CP_%d_PosY", BuildCheckPointCount), dini_FloatSet(rFile, string, vPos[1]);
- format(string, sizeof(string), "CP_%d_PosZ", BuildCheckPointCount), dini_FloatSet(rFile, string, vPos[2]);
- format(string, sizeof(string), ">> Adicionar ckeckpoint '%d' hora de inicio!", BuildCheckPointCount+1);
- SendClientMessage(playerid, YELLOW, string);
- BuildCheckPointCount++;
- }
- return 1;
- }
- CMD:endcp(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, RED, "» Voce nao e uma administrador!!");
- new string[256], rNameFile[256], rFile[256];
- if(BuildTakeCheckpoints == true)
- {
- ShowDialog(playerid, 606);
- format(rNameFile, sizeof(rNameFile), "rRaceSystem/RaceNames/RaceNames.txt");
- TotalRaces = dini_Int(rNameFile, "TotalRaces");
- TotalRaces++;
- dini_IntSet(rNameFile, "TotalRaces", TotalRaces);
- format(string, sizeof(string), "Race_%d", TotalRaces-1);
- format(rFile, sizeof(rFile), "rRaceSystem/%s.RRACE", BuildName);
- dini_Set(rNameFile, string, BuildName);
- dini_IntSet(rFile, "TotalCP", BuildCheckPointCount);
- Loop(x, 10)
- {
- format(string, sizeof(string), "BestRacerTime_%d", x);
- dini_Set(rFile, string, "0");
- format(string, sizeof(string), "BestRacer_%d", x);
- dini_Set(rFile, string, "noone");
- }
- }
- return 1;
- }
- function LoadRaceNames()
- {
- new
- rNameFile[64],
- string[64]
- ;
- format(rNameFile, sizeof(rNameFile), "/rRaceSystem/RaceNames/RaceNames.txt");
- TotalRaces = dini_Int(rNameFile, "TotalRaces");
- Loop(x, TotalRaces)
- {
- format(string, sizeof(string), "Race_%d", x), strmid(RaceNames[x], dini_Get(rNameFile, string), 0, 20, sizeof(RaceNames));
- //printf(">> Loaded Races: %s", RaceNames[x]);
- }
- return 1;
- }
- function LoadAutoRace(rName[])
- {
- new
- rFile[256],
- string[256]
- ;
- format(rFile, sizeof(rFile), "/rRaceSystem/%s.RRACE", rName);
- strmid(RaceName, rName, 0, strlen(rName), sizeof(RaceName));
- RaceVehicle = dini_Int(rFile, "vModel");
- RaceType = dini_Int(rFile, "rType");
- TotalCP = dini_Int(rFile, "TotalCP");
- #if DEBUG_RACE == 1
- //printf("VehicleModel: %d", RaceVehicle);
- //printf("RaceType: %d", RaceType);
- // printf("TotalCheckpoints: %d", TotalCP);
- #endif
- Loop(x, 2)
- {
- format(string, sizeof(string), "vPosX_%d", x), RaceVehCoords[x][0] = dini_Float(rFile, string);
- format(string, sizeof(string), "vPosY_%d", x), RaceVehCoords[x][1] = dini_Float(rFile, string);
- format(string, sizeof(string), "vPosZ_%d", x), RaceVehCoords[x][2] = dini_Float(rFile, string);
- format(string, sizeof(string), "vAngle_%d", x), RaceVehCoords[x][3] = dini_Float(rFile, string);
- #if DEBUG_RACE == 1
- //printf("VehiclePos %d: %f, %f, %f, %f", x, RaceVehCoords[x][0], RaceVehCoords[x][1], RaceVehCoords[x][2], RaceVehCoords[x][3]);
- #endif
- }
- Loop(x, TotalCP)
- {
- format(string, sizeof(string), "CP_%d_PosX", x), CPCoords[x][0] = dini_Float(rFile, string);
- format(string, sizeof(string), "CP_%d_PosY", x), CPCoords[x][1] = dini_Float(rFile, string);
- format(string, sizeof(string), "CP_%d_PosZ", x), CPCoords[x][2] = dini_Float(rFile, string);
- #if DEBUG_RACE == 1
- // printf("RaceCheckPoint %d: %f, %f, %f", x, CPCoords[x][0], CPCoords[x][1], CPCoords[x][2]);
- #endif
- }
- Position = 0;
- FinishCount = 0;
- JoinCount = 0;
- Loop(x, 2) PlayersCount[x] = 0;
- CountAmount = COUNT_DOWN_TILL_RACE_START;
- RaceTime = MAX_RACE_TIME;
- RaceBusy = 0x01;
- CountTimer = SetTimer("CountTillRace", 999, 1);
- TimeProgress = 0;
- return 1;
- }
- function LoadRace(playerid, rName[])
- {
- new
- rFile[256],
- string[256]
- ;
- format(rFile, sizeof(rFile), "/rRaceSystem/%s.RRACE", rName);
- if(!dini_Exists(rFile)) return SendClientMessage(playerid, RED, "<!> Race doesn't exist!"), printf("Race \"%s\" doesn't exist!", rName);
- strmid(RaceName, rName, 0, strlen(rName), sizeof(RaceName));
- RaceVehicle = dini_Int(rFile, "vModel");
- RaceType = dini_Int(rFile, "rType");
- TotalCP = dini_Int(rFile, "TotalCP");
- #if DEBUG_RACE == 1
- // printf("VehicleModel: %d", RaceVehicle);
- // printf("RaceType: %d", RaceType);
- // printf("TotalCheckpoints: %d", TotalCP);
- #endif
- Loop(x, 2)
- {
- format(string, sizeof(string), "vPosX_%d", x), RaceVehCoords[x][0] = dini_Float(rFile, string);
- format(string, sizeof(string), "vPosY_%d", x), RaceVehCoords[x][1] = dini_Float(rFile, string);
- format(string, sizeof(string), "vPosZ_%d", x), RaceVehCoords[x][2] = dini_Float(rFile, string);
- format(string, sizeof(string), "vAngle_%d", x), RaceVehCoords[x][3] = dini_Float(rFile, string);
- #if DEBUG_RACE == 1
- //printf("VehiclePos %d: %f, %f, %f, %f", x, RaceVehCoords[x][0], RaceVehCoords[x][1], RaceVehCoords[x][2], RaceVehCoords[x][3]);
- #endif
- }
- Loop(x, TotalCP)
- {
- format(string, sizeof(string), "CP_%d_PosX", x), CPCoords[x][0] = dini_Float(rFile, string);
- format(string, sizeof(string), "CP_%d_PosY", x), CPCoords[x][1] = dini_Float(rFile, string);
- format(string, sizeof(string), "CP_%d_PosZ", x), CPCoords[x][2] = dini_Float(rFile, string);
- #if DEBUG_RACE == 1
- // printf("RaceCheckPoint %d: %f, %f, %f", x, CPCoords[x][0], CPCoords[x][1], CPCoords[x][2]);
- #endif
- }
- Position = 0;
- FinishCount = 0;
- JoinCount = 0;
- Loop(x, 2) PlayersCount[x] = 0;
- Joined[playerid] = true;
- CountAmount = COUNT_DOWN_TILL_RACE_START;
- RaceTime = MAX_RACE_TIME;
- RaceBusy = 0x01;
- TimeProgress = 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], RACE_CHECKPOINT_SIZE);
- else SetPlayerRaceCheckpoint(playerid, 0, CPCoords[PrevCP][0], CPCoords[PrevCP][1], CPCoords[PrevCP][2], CPCoords[NextCP][0], CPCoords[NextCP][1], CPCoords[NextCP][2], RACE_CHECKPOINT_SIZE);
- }
- 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], RACE_CHECKPOINT_SIZE);
- else SetPlayerRaceCheckpoint(playerid, 3, CPCoords[PrevCP][0], CPCoords[PrevCP][1], CPCoords[PrevCP][2], CPCoords[NextCP][0], CPCoords[NextCP][1], CPCoords[NextCP][2], RACE_CHECKPOINT_SIZE);
- }
- return 1;
- }
- function SetupRaceForPlayer(playerid)
- {
- CPProgess[playerid] = 0;
- CPCoords[playerid][3] = 0;
- SetCP(playerid, CPProgess[playerid], CPProgess[playerid]+1, TotalCP, RaceType);
- if(IsOdd(playerid)) Index = 1;
- else Index = 0;
- switch(Index)
- {
- case 0:
- {
- if(PlayersCount[0] == 1)
- {
- RaceVehCoords[0][0] -= (6 * floatsin(-RaceVehCoords[0][3], degrees));
- RaceVehCoords[0][1] -= (6 * floatcos(-RaceVehCoords[0][3], degrees));
- CreatedRaceVeh[playerid] = CreateVehicle(RaceVehicle, RaceVehCoords[0][0], RaceVehCoords[0][1], RaceVehCoords[0][2]+2, RaceVehCoords[0][3], random(126), random(126), (60 * 60));
- SetPlayerPos(playerid, RaceVehCoords[0][0], RaceVehCoords[0][1], RaceVehCoords[0][2]+2);
- SetPlayerFacingAngle(playerid, RaceVehCoords[0][3]);
- PutPlayerInVehicle(playerid, CreatedRaceVeh[playerid], 0);
- }
- }
- case 1:
- {
- if(PlayersCount[1] == 1)
- {
- RaceVehCoords[1][0] -= (6 * floatsin(-RaceVehCoords[1][3], degrees));
- RaceVehCoords[1][1] -= (6 * floatcos(-RaceVehCoords[1][3], degrees));
- CreatedRaceVeh[playerid] = CreateVehicle(RaceVehicle, RaceVehCoords[1][0], RaceVehCoords[1][1], RaceVehCoords[1][2]+2, RaceVehCoords[1][3], random(126), random(126), (60 * 60));
- SetPlayerPos(playerid, RaceVehCoords[1][0], RaceVehCoords[1][1], RaceVehCoords[1][2]+2);
- SetPlayerFacingAngle(playerid, RaceVehCoords[1][3]);
- PutPlayerInVehicle(playerid, CreatedRaceVeh[playerid], 0);
- }
- }
- }
- switch(Index)
- {
- case 0:
- {
- if(PlayersCount[0] != 1)
- {
- CreatedRaceVeh[playerid] = CreateVehicle(RaceVehicle, RaceVehCoords[0][0], RaceVehCoords[0][1], RaceVehCoords[0][2]+2, RaceVehCoords[0][3], random(126), random(126), (60 * 60));
- SetPlayerPos(playerid, RaceVehCoords[0][0], RaceVehCoords[0][1], RaceVehCoords[0][2]+2);
- SetPlayerFacingAngle(playerid, RaceVehCoords[0][3]);
- PutPlayerInVehicle(playerid, CreatedRaceVeh[playerid], 0);
- PlayersCount[0] = 1;
- }
- }
- case 1:
- {
- if(PlayersCount[1] != 1)
- {
- CreatedRaceVeh[playerid] = CreateVehicle(RaceVehicle, RaceVehCoords[1][0], RaceVehCoords[1][1], RaceVehCoords[1][2]+2, RaceVehCoords[1][3], random(126), random(126), (60 * 60));
- SetPlayerPos(playerid, RaceVehCoords[1][0], RaceVehCoords[1][1], RaceVehCoords[1][2]+2);
- SetPlayerFacingAngle(playerid, RaceVehCoords[1][3]);
- PutPlayerInVehicle(playerid, CreatedRaceVeh[playerid], 0);
- 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), "~b~Tempo_de_Corrida: ~r~%s ", TimeConvert(RaceTime));
- else format(string, sizeof(string), "~b~Tempo_de_Corrida: ~r~%s ", TimeConvert(RaceTime), JoinCount);
- TextDrawSetString(RaceInfo[playerid], string);
- TextDrawShowForPlayer(playerid, RaceInfo[playerid]);
- JoinCount++;
- return 1;
- }
- function CountTillRace(playerid)
- {
- switch(CountAmount)
- {
- case 0:
- {
- ForEach(i, MAX_PLAYERS)
- {
- if(Joined[i] == false)
- {
- }
- }
- StartRace(playerid);
- }
- case 1..30:
- {
- new
- string[900]
- ;
- format(string, sizeof(string), "~b~AGUARDE CONTAGEM VOLTAR SEGUNDO: ~r~%d", CountAmount);
- ForEach(i, MAX_PLAYERS)
- {
- if(Joined[i] == true)
- {
- GameTextForPlayer(i, string, 1000, 5);
- PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
- }
- }
- }
- case 90, 80, 70, 60, 50, 40, 31, 200, 100:
- {
- new
- string[300]
- ;
- new GranaExp = random(100000);// < Dinheiro Aleatorio
- printf("> Mapas: %s (Corrida) Preco: %i$ /entermp. ", RaceName, GranaExp);
- format(string, sizeof(string), "{08E8DE}» {FFFFFF}Mapas: {08E8DE}%s{FFFFFF}({08E8DE}Corrida{FFFFFF}) {FFFFFF}Preco: {08E8DE}%i$ /entermp. ", RaceName, GranaExp);
- SendClientMessageToAll(GREEN, string);
- EntrarSlots = 0;
- }
- }
- return CountAmount--;
- }
- function StartRace(playerid)
- {
- new string[200];
- ForEach(i, MAX_PLAYERS)
- {
- if(Joined[i] == true)
- {
- IsPlayerInAnyVehicle(i);
- SetupRaceForPlayer(i);
- SetVehicleVirtualWorld(GetPlayerVehicleID(i), 1);
- SetPlayerVirtualWorld(i, 1);
- for(i=0; i<30; i++)
- {
- SendClientMessage(playerid,-1," ");
- }
- format(string, sizeof(string), "~g~GO GO GO");
- GameTextForPlayer(i, string, 5000, 1);
- PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
- }
- }
- rCounter = SetTimer("RaceCounter", 900, 1);
- RaceTick = GetTickCount();
- RaceStarted = 1;
- KillTimer(CountTimer);
- return 1;
- }
- function StopRace()
- {
- KillTimer(rCounter);
- RaceStarted = 0;
- RaceTick = 0;
- RaceBusy = 0x00;
- JoinCount = 0;
- FinishCount = 0;
- TimeProgress = 0;
- ForEach(i, MAX_PLAYERS)
- {
- if(Joined[i] == true)
- {
- DisablePlayerRaceCheckpoint(i);
- DestroyVehicle(CreatedRaceVeh[i]);
- Joined[i] = false;
- TextDrawHideForPlayer(i, RaceInfo[i]);
- CPProgess[i] = 0;
- KillTimer(InfoTimer[i]);
- }
- }
- if(AutomaticRace == true) LoadRaceNames(), LoadAutoRace(RaceNames[random(TotalRaces)]);
- return 1;
- }
- function RaceCounter()
- {
- if(RaceStarted == 1)
- {
- RaceTime--;
- if(JoinCount <= 0)
- {
- StopRace();
- }
- }
- if(RaceTime <= 0)
- {
- StopRace();
- }
- return 1;
- }
- function TextInfo(playerid)
- {
- new
- string[128]
- ;
- if(JoinCount == 1) format(string, sizeof(string), "~b~Tempo_de_Corrida: ~r~%s", TimeConvert(RaceTime));
- else format(string, sizeof(string), "~b~Tempo_de_Corrida: ~r~%s", TimeConvert(RaceTime), JoinCount);
- TextDrawSetString(RaceInfo[playerid], string);
- TextDrawShowForPlayer(playerid, RaceInfo[playerid]);
- }
- function IsPlayerInRace(playerid)
- {
- if(Joined[playerid] == true) return true;
- else return false;
- }
- function ShowDialog(playerid, dialogid)
- {
- switch(dialogid)
- {
- case 599: ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, CreateCaption("Construir uma nova corrida "), "\
- Normal Corrida\n\
- Aviao Corrida", "Proxima", "Sair");
- case 600: ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, CreateCaption("Construir uma nova corrida (Passo 1/4)"), "\
- Passo 1:\n\
- ********\n\
- Bem vindo ao race 'Construir uma nova corrida'.\n\
- Antes de comecar, preciso saber o nome (e.g. Corrida#1) do para salva-lo sob.\n\n\
- >> De o NOME abaixo e pressione 'Proxima' Continuar.", "Proxima", "Voltar");
- case 601: ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, CreateCaption("Construir uma nova corrida (Passo 1/4)"), "\
- ERRO: Nome muito curto ou muito longo! (min. 1 - max. 20)\n\n\n\
- Passo 1:\n\
- ********\n\
- Bem vindo ao race 'Construir uma nova corrida'.\n\
- Antes de comecar, preciso saber o nome (e.g. Corrida#1) do para salva-lo sob.\n\n\
- >> De o NOME abaixo e pressione 'Proxima' continuar.", "Proxima", "Voltar");
- case 602: ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, CreateCaption("Construir uma nova corrida (Passo 2/4)"), "\
- Passo 2:\n\
- ********\n\
- Por favor, forneca o ID ou NOME do veiculo que sera usado na corrida que Voce Esta criando agora.\n\n\
- >> Forneca a ID ou NOME do veiculo abaixo e pressione 'Proxima' Continuar. 'Voltar' mudar algo.", "Proxima", "Voltar");
- case 603: ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, CreateCaption("Construir uma nova corrida (Step 2/4)"), "\
- ERRO: Veiculo Invalido ID/Nome\n\n\n\
- Passo 2:\n\
- ********\n\
- Por favor, forneca o ID ou NOME do veiculo que sera usado na corrida que Voce Esta criando agora.\n\n\
- >> Forneca a ID ou NOME do veiculo abaixo e pressione 'Proxima' Continuar. 'Voltar' mudar algo.", "Proxima", "Voltar");
- case 604: ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, CreateCaption("Construir uma nova corrida (Step 3/4)"),
- "\
- Passo 3:\n\
- ********\n\
- {ffffff}Estamos quase terminando! Agora va para a linha de partida, onde o primeiro e o segundo carro devem estar.\n\
- Nota: Quando Voce clica 'OK' Voce estara livre. Usar {ff2400}'/ADDVEH' {ffffff}para definir a primeira posicao e a segunda posicao.\n\
- Nota: Depois de obter essas posicoes, Voce vera automaticamente uma caixa de dialogo para continuar o assistente.\n\n\
- >> pressione 'OK' para fazer as coisas acima. 'Voltar' mudar algo.", "OK", "Voltar");
- case 605: ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, CreateCaption("Construir uma nova corrida (Step 4/4)"),
- "\
- Passo 4:\n\
- ********\n\
- {ffffff}Bem-vindo a ultima etapa. Nesta etapa, Voce deve definir os pontos de verificacao; entao se Voce clicar 'OK' Voce pode definir os pontos de verificacao.\n\
- Voce pode definir os pontos de verificacao com {ff2400}'/ADDCP'. {ffffff}Cada checkpoint que Voce definir ira salvar.\n\
- Voce tem que digite {ff2400}/ENDCP{ffffff} quando Voce terminar com tudo. Sua corrida Esta disponivel entao!\n\n\
- >> pressione 'OK' para fazer as coisas acima. 'Voltar' mudar algo.", "OK", "Voltar");
- case 606: ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, CreateCaption("Construir uma nova corrida (Complete)"),
- "\
- Voce criou sua corrida e ela Esta pronta para ser usada agora.\n\n\
- >> pressione 'Terminar' para terminar. 'Sair' - Nao tem efeito.", "Terminar", "Sair");
- }
- return 1;
- }
- CreateCaption(arguments[])
- {
- new
- string[128 char]
- ;
- format(string, sizeof(string), "Race System - %s", 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;
- }
- // ~~~~~~~~~~~~~ Verificamos se é numero ~~~~~~~~~~~~~
- stock IsNumeric(const string[]) {
- for (new i = 0, j = strlen(string); i < j; i++)
- {
- if (string[i] > '9' || string[i] < '0') return 0;
- }
- return 1;
- }
- TimeConvert(seconds)
- {
- new tmp[16];
- new minutes = floatround(seconds/60);
- seconds -= minutes*60;
- format(tmp, sizeof(tmp), "%d:%02d", minutes, seconds);
- return tmp;
- }
Add Comment
Please, Sign In to add comment