SA-MP Forums Archive
Not creating the vehicle mysql - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Not creating the vehicle mysql (/showthread.php?tid=577060)



Not creating the vehicle mysql - pabloalber84 - 08.06.2015

I am creating the script to create vehicle mysql, and create one command, with the next code mysql (All variables has been definided):
PHP код:
    new Query[500];
    
format(Querysizeof(Query),"INSERT INTO `vehiculos` (`PosX`, `PosY`, `PosZ`) VALUES ('%f', '%f', '%f')"X2Y2Z2);
    
mysql_tquery(ConecctionQuery,  "CrearVehiculoConceMysql""ddd"playeriddealerid2); 
The problem is: Not create the vehicle.
The callback "CrearVehiculoConceMysql" is the next:
PHP код:
forward CrearVehiculoConceMysql(playeriddealeridVehConceID); 
In the callback, asign the vehicle variable, and save with mysql:
PHP код:
public CrearVehiculoConceMysql(playeriddealeridVehConceID)
{
new 
id = -1;
VehicleIDMYSQL[id] = cache_insert_id();
id VehicleIDMYSQL[id];
// ETC etc
return 1;

Yes asigned all variables [In the old time, i am creating the code, in other method, and no problem], but now fails to save variables.


Re: Not creating the vehicle mysql - extender1987 - 08.06.2015

You have to create tables on ''vehiculos''
For example if in your script is MAX_VEHICLES 100 you need to create 100 tables


Respuesta: Re: Not creating the vehicle mysql - pabloalber84 - 08.06.2015

Quote:
Originally Posted by extender1987
Посмотреть сообщение
You have to create tables on ''vehiculos''
For example if in your script is MAX_VEHICLES 100 you need to create 100 tables
Not is MAX_VEHICLES, and not create 100 tables ._. , i am create the tables with the script, not manually.


Re: Respuesta: Re: Not creating the vehicle mysql - extender1987 - 08.06.2015

mysql is not working like io_read files .txt ...
you have to create like this INSERT INTO `vehiculos` (`PosX`, `PosY`, `PosZ`
INSERT INTO `vehiculos` (`PosX`, `PosY`, `PosZ`
INSERT INTO `vehiculos` (`PosX`, `PosY`, `PosZ`etc etc in your phpmyadmin SQL


Re: Not creating the vehicle mysql - Vince - 08.06.2015

Quote:
Originally Posted by extender1987
Посмотреть сообщение
You have to create tables on ''vehiculos''
For example if in your script is MAX_VEHICLES 100 you need to create 100 tables
Are you even serious? No, you don't.

@OP: write code in English if you expect any useful help. It's hard to understand code without context. I can only tell you that this is wrong:
PHP код:
new id = -1;
VehicleIDMYSQL[id] = cache_insert_id();
id VehicleIDMYSQL[id]; 
What you're writing is effectively this:
PHP код:
VehicleIDMYSQL[-1] = cache_insert_id(); 
Which is wrong and will give a runtime error. I don't understand the context so I cannot (won't) give any additional information.