SA-MP Forums Archive
Vehicle doesn't reload - 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: Vehicle doesn't reload (/showthread.php?tid=613165)



Vehicle doesn't reload - justjamie - 25.07.2016

Hello.
My vehicles doesnt reload at all.
What did i do wrong here?
PHP Code:
stock ReloadVehicle(i)
{
    
DestroyVehicle(i);
    new 
query1[128]; mysql_format(connectionquery1sizeof(query1), "SELECT * FROM Vehicles WHERE id = '%i'"); mysql_tquery(connectionquery1"LoadVehicle","d",i);

PHP Code:
forward LoadVehicle(id);
public 
LoadVehicle(id)
{
      
Vehicle[id][vModel] = cache_get_field_content_int(0"vModel");
      
Vehicle[id][vColor1] = cache_get_field_content_int(0"vColor1");
      
Vehicle[id][vColor2] = cache_get_field_content_int(0"vColor2");
      
Vehicle[id][vX] = cache_get_field_content_float(0"vX");
      
Vehicle[id][vY] = cache_get_field_content_float(0"vY");
      
Vehicle[id][vZ] = cache_get_field_content_float(0"vZ");
      
Vehicle[id][vA] = cache_get_field_content_float(0"vA");
      new 
owner[25];
      
cache_get_field_content(0"vOwner"owner);
        
myStrcpy(Vehicle[id][vOwner], owner);
        new 
sampid CreateVehicle(Vehicle[id][vModel], Vehicle[id][vX], Vehicle[id][vY], Vehicle[id][vZ], Vehicle[id][vA], Vehicle[id][vColor1], Vehicle[id][vColor2], -10);
         new 
enginelightsalarmdoorsbonnetbootobjective;
      
GetVehicleParamsEx(sampidenginelightsalarmdoorsbonnetbootobjective);
      
SetVehicleParamsEx(sampid0lightsalarmdoorsbonnetbootobjective);
      return 
1;

(And yes, the vehicle is already loaded, and the car id is equal to the mysql id.