03.11.2011, 22:47
Hello, I'm very sorry for my frequently posting, but I just got stuck with this one, have searched for some solutions, but couldn't find...
So I'm making a Racing system for my server, one that's easy to work with...
Some months ago I used rRyder's race system, but it had a random race system, and that was not really what I wanted...
Ok so I'm at the part where the races should load, and come in the array that I made for the race:
So I can easly work with it throughout my GM...
since I used rRyder's racing system I made some races with it so I still have the .txt files from my races I made then, and I wanna use them....
ok so here's the loadrace function:
Ok, Now this is what the .txt file looks like for my karting race(currently I'm testing everything with only 1 race)
So, I tried to load every Checkpoint in the printf stuff to see if it's correct...
well I get 17*3 printf messages wich is good, but every Pos of the chord is 0.000000
and every race name that should be displayed in the printf thing is a smiley...
I know, that's very weird...
I use SII for the file operating...
So please anybody help so I get the right chords in the printf thing and not just 0.0000 ...
Thanks in advance
2/3 reps for helper
EDIT: I just went ingame testing this code:
to check if the racename was read correct in the LoadRaces command
well this outputs a clientmessage with nothing in it...
so just a space in the chat meaning that the smiley problem was probably caused by incorrect reading of the race name... but that's not the main problem...
So I'm making a Racing system for my server, one that's easy to work with...
Some months ago I used rRyder's race system, but it had a random race system, and that was not really what I wanted...
Ok so I'm at the part where the races should load, and come in the array that I made for the race:
pawn Код:
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];
since I used rRyder's racing system I made some races with it so I still have the .txt files from my races I made then, and I wanna use them....
ok so here's the loadrace function:
pawn Код:
//==============================================================================
//------------------------------------------------------------------------------
//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
well I get 17*3 printf messages wich is good, but every Pos of the chord is 0.000000
and every race name that should be displayed in the printf thing is a smiley...
I know, that's very weird...
I use SII for the file operating...
So please anybody help so I get the right chords in the printf thing and not just 0.0000 ...
Thanks in advance
2/3 reps for helper
EDIT: I just went ingame testing this code:
pawn Код:
if(!strcmp("/racename", cmdtext, true))
{
new string[128];
format(string, sizeof(string), "%s", rInfo[0][rName]);
SendClientMessage(playerid, COLOR_SEXYGREEN, string);
return 1;
}
well this outputs a clientmessage with nothing in it...
so just a space in the chat meaning that the smiley problem was probably caused by incorrect reading of the race name... but that's not the main problem...