While sql
#1

Hello,

I tried this, but that does not work..

Код:
mysql_function_query(g_Handle, "SELECT * FROM vehicules", true, "SQL_Load_Vehicules", "");

forward SQL_Load_Vehicules();
public SQL_Load_Vehicules()
{
	new nb=0, rows, fields, donnees[50];

	while(cache_get_data(rows, fields, g_Handle))
	{
	    nb++;
		
	    cache_get_field_content(0, "idVehicule", donnees);  	Vehicules[nb][vIdVehicule] = strval(donnees);
	    cache_get_field_content(0, "pX", donnees);  			Vehicules[nb][vPx] = floatstr(donnees);
	    cache_get_field_content(0, "pY", donnees);  			Vehicules[nb][vPy] = floatstr(donnees);
	    cache_get_field_content(0, "pZ", donnees);  			Vehicules[nb][vPz] = floatstr(donnees);
	    cache_get_field_content(0, "couleur1", donnees);  		Vehicules[nb][vCouleur1] = strval(donnees);
	    cache_get_field_content(0, "couleur2", donnees);  		Vehicules[nb][vCouleur2] = strval(donnees);

		AddStaticVehicleEx(Vehicules[nb][vIdVehicule], Vehicules[nb][vPx], Vehicules[nb][vPy], Vehicules[nb][vPz], Vehicules[nb][vAngle], Vehicules[nb][vCouleur1], Vehicules[nb][vCouleur2], -1);
	}
	
	totalvehicules = nb;
	return 1;
}
How can it be done?
Help Me, thank you
Reply
#2

Help please
Reply
#3

This is not how it works with caching enabled.

pawn Код:
public SQL_Load_Vehicules()
{
    new
        rows,
        fields,
        donnees[50];
   
    cache_get_data(rows, fields, g_Handle);
   
    for(new nb; nb < rows; nb++)
    {
        cache_get_field_content(nb, "idVehicule", donnees);     Vehicules[nb][vIdVehicule] = strval(donnees);
        cache_get_field_content(nb, "pX", donnees);             Vehicules[nb][vPx] = floatstr(donnees);
        cache_get_field_content(nb, "pY", donnees);             Vehicules[nb][vPy] = floatstr(donnees);
        cache_get_field_content(nb, "pZ", donnees);             Vehicules[nb][vPz] = floatstr(donnees);
        cache_get_field_content(nb, "couleur1", donnees);       Vehicules[nb][vCouleur1] = strval(donnees);
        cache_get_field_content(nb, "couleur2", donnees);       Vehicules[nb][vCouleur2] = strval(donnees);
       
        AddStaticVehicleEx(Vehicules[nb][vIdVehicule], Vehicules[nb][vPx], Vehicules[nb][vPy], Vehicules[nb][vPz], Vehicules[nb][vAngle], Vehicules[nb][vCouleur1], Vehicules[nb][vCouleur2], -1);
        totalvehicules++;
    }
    return 1;
}
Reply
#4

Код:
public SQL_Load_Vehicules()
{
	new nb=0, rows, fields, donnees[50];
	cache_get_data(rows, fields, g_Handle);

	for(new i = 0; i < rows; i++)
 	{
	    // Variables
	    cache_get_field_content(i, "idSQL", donnees);  			Vehicules[nb][vIdSQL] = strval(donnees);
	    cache_get_field_content(i, "idVehicule", donnees);  	Vehicules[nb][vIdVehicule] = strval(donnees);
	    cache_get_field_content(i, "idProprio", donnees);  		Vehicules[nb][vIdProprio] = strval(donnees);

	    cache_get_field_content(i, "pX", donnees);  			Vehicules[nb][vPx] = floatstr(donnees);
	    cache_get_field_content(i, "pY", donnees);  			Vehicules[nb][vPy] = floatstr(donnees);
	    cache_get_field_content(i, "pZ", donnees);  			Vehicules[nb][vPz] = floatstr(donnees);

	    cache_get_field_content(i, "couleur1", donnees);  		Vehicules[nb][vCouleur1] = strval(donnees);
	    cache_get_field_content(i, "couleur2", donnees);  		Vehicules[nb][vCouleur2] = strval(donnees);
	    cache_get_field_content(i, "lock", donnees);  			Vehicules[nb][vLock] = strval(donnees);

		// On ajoute le vйhicule
		AddStaticVehicleEx(Vehicules[nb][vIdVehicule], Vehicules[nb][vPx], Vehicules[nb][vPy], Vehicules[nb][vPz], Vehicules[nb][vAngle], Vehicules[nb][vCouleur1], Vehicules[nb][vCouleur2], -1);

		// Information vйhicule
		SetVehicleParamsEx(nb, 0, 0, 0, 0, 0, 0, 0);

		// Moteur OFF
		Vehicules[nb][vMoteurOn] = 0;
    }

	totalvehicules = nb;
	return 1;
}
Quote:

[12:35:00] weburl = "www.sa-mp.com" (string)
[12:35:00]
[12:35:00] Server Plugins
[12:35:00] --------------
[12:35:00] Loading plugin: mysql.dll
[12:35:00]

> MySQL plugin R7 successfully loaded.

[12:35:00] Loaded.
[12:35:00] Loading plugin: streamer.dll
[12:35:00]

*** Streamer Plugin v2.6.1 by Incognito loaded ***

[12:35:00] Loaded.
[12:35:00] Loaded 2 plugins.

[12:35:00]
[12:35:00] Filterscripts
[12:35:00] ---------------
[12:35:00] Loaded 0 filterscripts.

[12:35:00] [MYSQL] Connection reussie
[12:35:00] Load vehicules...
[12:35:00]
[12:35:00] ---------------------------------
[12:35:00] xxxxxxxxxxxxxxxxxxxx | By Noliax8
[12:35:00] ---------------------------------
[12:35:00]
[12:35:00] Number of vehicle models: 0
Why ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)