Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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);
- if(!dini_Exists(rFile)) return 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;
- 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment