OnGameModeInit only working to mysql_connect -
Antonio [G-RP] - 12.01.2011
So, after finishing my vehicle code (which only includes a spawn, insert to mysql and a few other small things) I figured out that OnGameModeInit isn't loading past mysql_connect (as it connects, shown below)
Код:
[19:42:08] MySQL: Connected (0) to _____________@ _____________via TCP/IP. MySQL version 5.0.51a-24+lenny4.
What I see might be the problem is that it loads ONE (1) of the vehicles from the database, and stops, and loads nothing below it under OnGameModeInit.
I'm not sure what the problem could be, but currently the server is dead because I cannot even connect right now without going to 0,0,0 and having no commands.
Any help would be greatly appreciated! Thankyou very much.
Re: OnGameModeInit only working to mysql_connect -
Krx17 - 12.01.2011
Maybe it's a problem with your vehicles. Commend out the mysql code and see if it works.
Re: OnGameModeInit only working to mysql_connect -
Joe Staff - 12.01.2011
Make sure you're not breaking any Array limits.
example
pawn Код:
new MyArray[32];
MyArray[54]=24;
This causes that problem, so check your loops to make sure you're not doing this. Also make sure that your MySQL table contains no 'NULL' entries
Re: OnGameModeInit only working to mysql_connect -
Antonio [G-RP] - 12.01.2011
Is this my array: ?
If so, I'm not breaking any array limits.
Also, I don't have any NULL entries. I really hate this problem.
Re: OnGameModeInit only working to mysql_connect -
Kyosaur - 12.01.2011
Quote:
Originally Posted by Antonio [G-RP]
Is this my array: ?
If so, I'm not breaking any array limits.
Also, I don't have any NULL entries. I really hate this problem.
|
Post some code man, i really dont know what you expect us to do without it :P.
Re: OnGameModeInit only working to mysql_connect -
Antonio [G-RP] - 12.01.2011
Fixed.
Re: OnGameModeInit only working to mysql_connect -
Krx17 - 12.01.2011
Show us the actual loadcars function. You know, where it actually creates a vehicle.
Re: OnGameModeInit only working to mysql_connect -
Antonio [G-RP] - 12.01.2011
Creating vehicle has nothing to do with it. That function has worked for ever now.
I'm not releasing all my code on the forums either -.-
Re: OnGameModeInit only working to mysql_connect -
Kyosaur - 12.01.2011
Quote:
Originally Posted by Antonio [G-RP]
Alright haha :P
This is the beginning of the LoadCars function. The rest is unneeded to post, as it all works correctly.
pawn Код:
public LoadCars() { new resultline[1024]; new car[28][64]; new query[256];
printf("Loading Cars..."); mysql_real_escape_string("SELECT VEHid,model,x,y,z,o,color1,color2,respawndelay, ownable, ownerid, factionid, jobid, engine, fuel, locked, trunkopen, hoodopen, \ trunkinv1, trunkinv2, trunkinv3, trunkinv4, trunkinv5, trunkqnt1, trunkqnt2, trunkqnt3, trunkqnt4, trunkqnt5 FROM vehicles ORDER BY VEHid ASC", query);
printf(" SQL: %s",query); mysql_query(query); mysql_store_result();
new carid; while(mysql_fetch_row(resultline)==1) {
As posted in the starter, the connection proof.
Also, this shows that it stops loading after the first car, although I doubt it's even spawning the first car at all.
Код:
[19:42:08] Loading Cars...
[19:42:08] SQL: SELECT VEHid,model,x,y,z,o,color1,color2,respawndelay, ownable, ownerid, factionid, jobid, engine, fuel, locked, trunkopen, hoodopen, trunkinv1, trunkinv2, trunkinv3, trunkinv4, trunkinv5, trunkqnt1, trunkqnt2, trunkqnt3, trunkqnt4, trunkqnt5 FROM vehicles ORDER BY VEHid ASC
[19:42:08] 1|596|1601.45|-1683.92|5.6132|90.1938|0|1|900000|0|0|1|0|0|100|0|0|0|0|0|0|0|0|0|0|0|0|0
[19:42:08] Number of vehicle models: 0
|
Well i have no idea why you're escaping that string, there is NO reason to at all. You only need to do that if a user gives physical input into the query (ie in a register or login command).
Post the entire function, i dont see the problem yet and i think its somewhere inside you're loop :P.
Re: OnGameModeInit only working to mysql_connect -
Antonio [G-RP] - 12.01.2011
Fixed.