enum RaceInfo
{
rName[50], // Race name
rCheckPoint_X[MAX_RACE_CPS],
rCheckPoint_Y[MAX_RACE_CPS],
rCheckPoint_Z[MAX_RACE_CPS],
rPrice, // Enter Price
rRecordS, //in seconds
rRecordM, // In minuts
rReward, //prize
rTimeLimitS, //Time until race stops in seconds
rTimeLimitM, //Time until race stops in minuts
rCheckPoints, //Total amount of checkpoints that the race has
rRacing[SERVER_SLOT], //Is a player racing
rInRange[SERVER_SLOT], //Is a player ready to start a race
}
new rInfo[1][RaceInfo];
//==============================================================================
//------------------------------------------------------------------------------
//Race System
//------------------------------------------------------------------------------
//==============================================================================
LoadRaces()
{
new
rNameFile[64],
string[64],
cNameX[64],
cNameY[64],
cNameZ[64];
format(rNameFile, sizeof(rNameFile), "/[NS]Custom/Races/Karting.txt");
INI_Open(rNameFile);
for(new i; i< sizeof rInfo; i++) //Loop trough all the available races
{
rInfo[i][rName] = INI_ReadString(string, "rName", sizeof(string));
rInfo[i][rCheckPoints] = INI_ReadInt("CPS");
for(new j; j < rInfo[i][rCheckPoints]; j++) //Loop trough all the races checkpoints
{
format(cNameX, sizeof(cNameX), "CP_%i_PosX", j);
format(cNameY, sizeof(cNameY), "CP_%i_PosY", j);
format(cNameZ, sizeof(cNameZ), "CP_%i_PosZ", j);
rInfo[i][rCheckPoint_X][j] = INI_ReadInt(cNameX);
rInfo[i][rCheckPoint_Y][j] = INI_ReadInt(cNameY);
rInfo[i][rCheckPoint_Z][j] = INI_ReadInt(cNameZ);
printf("---%s---", rInfo[i][rName]);
printf("Loaded Race CP %i X: %f", j, rInfo[i][rCheckPoint_X][j]); // I use that to check if it works
printf("Loaded Race CP %i Y: %f", j, rInfo[i][rCheckPoint_Y][j]);
printf("Loaded Race CP %i Z: %f", j, rInfo[i][rCheckPoint_Z][j]);
printf("----------------------");
}
}
}
rName=Karting CPS=18 CP_0_PosX=2580.299072 CP_0_PosY=1854.159057 CP_0_PosZ=10.104173 CP_1_PosX=2578.720458 CP_1_PosY=1824.538696 CP_1_PosZ=10.104088 CP_2_PosX=2545.646972 CP_2_PosY=1832.246948 CP_2_PosZ=10.103754 CP_3_PosX=2578.969238 CP_3_PosY=1793.060058 CP_3_PosZ=10.104261 CP_4_PosX=2597.251220 CP_4_PosY=1725.112548 CP_4_PosZ=10.104139 CP_5_PosX=2604.353515 CP_5_PosY=1666.608032 CP_5_PosZ=10.104134 CP_6_PosX=2627.864257 CP_6_PosY=1718.481933 CP_6_PosZ=10.298575 CP_7_PosX=2610.017333 CP_7_PosY=1799.246337 CP_7_PosZ=10.104269 CP_8_PosX=2597.930175 CP_8_PosY=1894.951171 CP_8_PosZ=10.308683 CP_9_PosX=2568.328857 CP_9_PosY=1876.226562 CP_9_PosZ=10.106081 CP_10_PosX=2583.936523 CP_10_PosY=1828.699462 CP_10_PosZ=10.104165 CP_11_PosX=2546.406250 CP_11_PosY=1831.118652 CP_11_PosZ=10.104111 CP_12_PosX=2575.179931 CP_12_PosY=1798.425292 CP_12_PosZ=10.104249 CP_13_PosX=2587.133300 CP_13_PosY=1693.558471 CP_13_PosZ=10.104183 CP_14_PosX=2630.399902 CP_14_PosY=1715.198242 CP_14_PosZ=10.307922 CP_15_PosX=2612.045166 CP_15_PosY=1821.158569 CP_15_PosZ=10.104297 CP_16_PosX=2590.833251 CP_16_PosY=1895.690063 CP_16_PosZ=10.314939 CP_17_PosX=2568.510009 CP_17_PosY=1876.408325 CP_17_PosZ=10.105906
if(!strcmp("/racename", cmdtext, true))
{
new string[128];
format(string, sizeof(string), "%s", rInfo[0][rName]);
SendClientMessage(playerid, COLOR_SEXYGREEN, string);
return 1;
}
rCheckPoint_X[MAX_RACE_CPS],
rCheckPoint_Y[MAX_RACE_CPS],
rCheckPoint_Z[MAX_RACE_CPS],
These
pawn Код:
|