[MySQL]: Vehicle Load
#1

Hello,
I've problem with my vehicle load system.
The script is :

PHP код:
stock ChargerVehicules()
{
    new 
dest[128];
    for (new 
v=1v<=2v++)
    {
        
InfosVehicules[v][Modele] = cache_get_field_content_int(0"Modele");
        
InfosVehicules[v][Couleur1] = cache_get_field_content_int(0"Couleur1");
        
InfosVehicules[v][Couleur2] = cache_get_field_content_int(0"Couleur2");
        
InfosVehicules[v][SpawnX] = cache_get_field_content_float(0"SpawnX");
        
InfosVehicules[v][SpawnY] = cache_get_field_content_float(0"SpawnY");
        
InfosVehicules[v][SpawnZ] = cache_get_field_content_float(0"SpawnZ");
        
InfosVehicules[v][SpawnAng] = cache_get_field_content_float(0"SpawnAng");
        
InfosVehicules[v][Metres] = cache_get_field_content_int(0"Metres");
        
InfosVehicules[v][Kilometres] = cache_get_field_content_int(0"Kilometres");
        
InfosVehicules[v][Prix] = cache_get_field_content_int(0"Prix");
        
InfosVehicules[v][Proprio] = cache_get_field_content(0"Proprietaire"dest);
        
AddStaticVehicleEx(InfosVehicules[v][Modele], InfosVehicules[v][SpawnX], InfosVehicules[v][SpawnY], InfosVehicules[v][SpawnZ], InfosVehicules[v][SpawnAng], InfosVehicules[v][Couleur1], InfosVehicules[v][Couleur2], -1);
         
SetVehicleNumberPlate(vInfosVehicules[v][Plaque]);
         
printf("%d chargй"v);
     }
    return 
1;

(In GameModeInit there is ChargerVehicule()

In MySQL log :

PHP код:
[14:44:29] [DEBUGmysql_connect host"127.0.0.1"user"root"database"samp"password"****"port3306autoreconnecttruepool_size2
[14:44:29] [DEBUGCMySQLHandle::Create creating new connection..
[
14:44:29] [DEBUGCMySQLHandle::CMySQLHandle constructor called
[14:44:29] [DEBUGCMySQLHandle::Create connection created (id1)
[
14:44:29] [DEBUGCMySQLConnection::Connect establishing connection to database...
[
14:44:29] [DEBUGCMySQLConnection::Connect connection was successful
[14:44:29] [DEBUGCMySQLConnection::Connect auto-reconnect has been enabled
[14:44:29] [DEBUGmysql_errno connection1
[14:44:29] [DEBUGCMySQLConnection::Connect establishing connection to database...
[
14:44:29] [DEBUGCMySQLConnection::Connect establishing connection to database...
on1
[14:44:29] [WARNINGcache_get_field_content_int no active cache
[14:44:29] [DEBUGCMySQLConnection::Connect connection was successful
[14:44:29] [DEBUGCMySQLConnection::Connect connection was successful
eur1
", connection: 1
[14:44:29] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[14:44:29] [WARNING] cache_get_field_content_int - no active cache
[14:44:29] [DEBUG] cache_get_field_content_int - row: 0, field_name: "
Couleur2", connection: 1
[14:44:29] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[14:44:29] [WARNING] cache_get_field_content_int - no active cache
[14:44:29] [DEBUG] cache_get_field_content_float - row: 0, field_name: "
SpawnX", connection: 1
[14:44:29] [WARNING] cache_get_field_content_float - no active cache
[14:44:29] [DEBUG] cache_get_field_content_float - row: 0, field_name: "
SpawnY", connection: 1
[14:44:29] [WARNING] cache_get_field_content_float - no active cache
[14:44:29] [DEBUG] cache_get_field_content_float - row: 0, field_name: "
SpawnZ", connection: 1
[14:44:29] [WARNING] cache_get_field_content_float - no active cache
[14:44:29] [DEBUG] cache_get_field_content_float - row: 0, field_name: "
SpawnAng", connection: 1
[14:44:29] [WARNING] cache_get_field_content_float - no active cache
[14:44:29] [DEBUG] cache_get_field_content_int - row: 0, field_name: "
Metres", connection: 1
[14:44:29] [WARNING] cache_get_field_content_int - no active cache
[14:44:29] [DEBUG] cache_get_field_content_int - row: 0, field_name: "
Kilometres", connection: 1
[14:44:29] [WARNING] cache_get_field_content_int - no active cache
[14:44:29] [DEBUG] cache_get_field_content_int - row: 0, field_name: "
Prix", connection: 1
[14:44:29] [WARNING] cache_get_field_content_int - no active cache
[14:44:29] [DEBUG] cache_get_field_content - row: 0, field_name: "
Proprietaire", connection: 1, max_len: 128
[14:44:29] [WARNING] cache_get_field_content - no active cache
[14:44:29] [DEBUG] cache_get_field_content_int - row: 0, field_name: "
Modele", connection: 1
[14:44:29] [WARNING] cache_get_field_content_int - no active cache
[14:44:29] [DEBUG] cache_get_field_content_int - row: 0, field_name: "
Couleur1", connection: 1
[14:44:29] [WARNING] cache_get_field_content_int - no active cache
[14:44:29] [DEBUG] cache_get_field_content_int - row: 0, field_name: "
Couleur2", connection: 1
[14:44:29] [WARNING] cache_get_field_content_int - no active cache
[14:44:30] [DEBUG] cache_get_field_content_float - row: 0, field_name: "
SpawnX", connection: 1
[14:44:30] [WARNING] cache_get_field_content_float - no active cache
[14:44:30] [DEBUG] cache_get_field_content_float - row: 0, field_name: "
SpawnY", connection: 1
[14:44:30] [WARNING] cache_get_field_content_float - no active cache
[14:44:30] [DEBUG] cache_get_field_content_float - row: 0, field_name: "
SpawnZ", connection: 1
[14:44:30] [WARNING] cache_get_field_content_float - no active cache
[14:44:30] [DEBUG] cache_get_field_content_float - row: 0, field_name: "
SpawnAng", connection: 1
[14:44:30] [WARNING] cache_get_field_content_float - no active cache
[14:44:30] [DEBUG] cache_get_field_content_int - row: 0, field_name: "
Metres", connection: 1
[14:44:30] [WARNING] cache_get_field_content_int - no active cache
[14:44:30] [DEBUG] cache_get_field_content_int - row: 0, field_name: "
Kilometres", connection: 1
[14:44:30] [WARNING] cache_get_field_content_int - no active cache
[14:44:30] [DEBUG] cache_get_field_content_int - row: 0, field_name: "
Prix", connection: 1
[14:44:30] [WARNING] cache_get_field_content_int - no active cache
[14:44:30] [DEBUG] cache_get_field_content - row: 0, field_name: "
Proprietaire", connection: 1, max_len: 128
[14:44:30] [WARNING] cache_get_field_content - no active cache 
I don't understand where problem is.. I asked u !
The vehicles isn't load..

Can u help me ?
Thanks a lot.

PS: Sorry for my bad english, i'm french student!
Reply
#2

You cannot just get the data of a field without executing the query (with SELECT clause) first. And if there are rows, then get the data and store them to the variables.

EDIT:
About threaded queries: https://sampforum.blast.hk/showthread.php?tid=337810
And here's an example to get an idea: http://forum.sa-mp.com/showpost.php?...&postcount=103
Reply
#3

I see, thx you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)