#1

Hello. I'm doing race system and I have a little problem. I'm trying to do that player could select track on GUI and here it's a problem. When I load all tracks from database GUI shows only one track witch is the biggest ID. No matter how much tracks I have it only shows one. I don't know what else to do so I ask help here. Here is code:

stock ShowPlayerRaceSelectTrackMenu(playerid)
{
new Tracks[256];
for(new i = 0; i < sInfo[MaxRaces]; i++)
{
format(Tracks,256,"%s\n", rInfo[i][Name]);
}
ShowPlayerDialog(playerid,34,DIALOG_STYLE_LIST,"Ar range race",Tracks,"Select","Back");
}

forward LoadRace();
public LoadRace()
{
new query[1024];
format(query,1024,"SELECT * FROM race");
mysql_query(query);
mysql_store_result();
new RaceID;
while(mysql_fetch_row(line))
{
sInfo[MaxRaces]++;
mysql_get_field("race_id", sql);
RaceID = strval(sql);

mysql_get_field("name", sql);
format(rInfo[RaceID][Name], 32, "%s", sql);

mysql_get_field("cp_0_x", sql);
rCP[RaceID][0][CPx] = floatstr(sql);
mysql_get_field("cp_0_y", sql);
rCP[RaceID][0][CPy] = floatstr(sql);
mysql_get_field("cp_0_z", sql);
rCP[RaceID][0][CPz] = floatstr(sql);
mysql_get_field("cp_0_type", sql);
rCP[RaceID][0][CpType] = strval(sql);
mysql_get_field("cp_0_veh", sql);
rCP[RaceID][0][CpVeh] = strval(sql);

//else code..
}
return 1;
}
Reply
#2

You may only be able to load one at a time. I don't know the SQL system that much to help. But, what plugin are you using?
Reply
#3

I'm using g-stylezzz plugin. With the SQL is all good, server loads all tracks, I printed it. Bus something wrong with GUI. ;/
Reply
#4

Give me some time to look into gui. I've never really messed with it.
Reply
#5

I did command with same function like GUI, but its also shows one track.. I'm confused. ;/
Reply
#6

When I put this in LoadRace callback I get in server_log two different tracks with different ID, because I only have two tracks.
printf("track %s id:%d loaded", rInfo[RaceID][Name],RaceID);
So server loads tracks but only shows one.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)