Posts: 220
Threads: 37
Joined: May 2010
Reputation:
0
29.09.2011, 16:19
(
Последний раз редактировалось Audiophr3ak; 29.09.2011 в 19:12.
)
I have a problem with this:
public OnVehicleSpawn(vehicleid)
{
SetVehicleParamsEx(vehicleid,...............);
return 1;
}
Vehicle parameters won't work with this callback, whats the problem?
Posts: 970
Threads: 16
Joined: Aug 2009
Reputation:
0
If I'm not wrong, first you need to GetVehicleParamsEx and then try using Set.
Posts: 435
Threads: 15
Joined: Feb 2008
Reputation:
0
Well it depends on when you want some params set. You should use GetVehicleParamsEx first, then set. If you are wanting some params set when you first create a vehicle (say in OnGameModeInit) you need to do your get and set in OnGameModeInit seeing that OnVehicleSpawn does not seem to get called on newly created vehicles only when a vehicle Respawns. Not sure why the callback is named as such, would make more sense calling it OnVehicleRespawn.
Posts: 220
Threads: 37
Joined: May 2010
Reputation:
0
Weird... Im using SetVehicleToRespawn after CreateVehicle and also using GetVehicleParamsEx first but still won't work... -_-
public OnVehicleSpawn(vehicleid)
{
ChangeVehicleColor(vehicleid, vInfo[vehicleid][vC1], vInfo[vehicleid][vC2]);
if(vInfo[vehicleid][mod1] != 0) {AddVehicleComponent(vehicleid, vInfo[vehicleid][mod1]);}
if(vInfo[vehicleid][mod2] != 0) {AddVehicleComponent(vehicleid, vInfo[vehicleid][mod2]);}
if(vInfo[vehicleid][mod3] != 0) {AddVehicleComponent(vehicleid, vInfo[vehicleid][mod3]);}
if(vInfo[vehicleid][mod4] != 0) {AddVehicleComponent(vehicleid, vInfo[vehicleid][mod4]);}
if(vInfo[vehicleid][mod5] != 0) {AddVehicleComponent(vehicleid, vInfo[vehicleid][mod5]);}
if(vInfo[vehicleid][mod6] != 0) {AddVehicleComponent(vehicleid, vInfo[vehicleid][mod6]);}
if(vInfo[vehicleid][mod7] != 0) {AddVehicleComponent(vehicleid, vInfo[vehicleid][mod7]);}
if(vInfo[vehicleid][mod8] != 0) {AddVehicleComponent(vehicleid, vInfo[vehicleid][mod8]);}
if(vInfo[vehicleid][mod9] != 0) {AddVehicleComponent(vehicleid, vInfo[vehicleid][mod9]);}
if(vInfo[vehicleid][mod10] != 0) {AddVehicleComponent(vehicleid, vInfo[vehicleid][mod10]);}
if(vInfo[vehicleid][mod11] != 0) {AddVehicleComponent(vehicleid, vInfo[vehicleid][mod11]);}
if(vInfo[vehicleid][mod12] != 0) {AddVehicleComponent(vehicleid, vInfo[vehicleid][mod12]);}
if(vInfo[vehicleid][mod13] != 0) {AddVehicleComponent(vehicleid, vInfo[vehicleid][mod13]);}
if(vInfo[vehicleid][mod14] != 0) {AddVehicleComponent(vehicleid, vInfo[vehicleid][mod14]);}
if(vInfo[vehicleid][mod15] != 0) {AddVehicleComponent(vehicleid, vInfo[vehicleid][mod15]);}
if(vInfo[vehicleid][mod16] != 0) {AddVehicleComponent(vehicleid, vInfo[vehicleid][mod16]);}
if(vInfo[vehicleid][mod17] != 0) {AddVehicleComponent(vehicleid, vInfo[vehicleid][mod17]);}
if(vInfo[vehicleid][vPJ] != -1) {ChangeVehiclePaintjob(vehicleid, vInfo[vehicleid][vPJ]);}
if(vInfo[vehicleid][vCond] == 0) {SetVehicleVirtualWorld(vehicleid, 10);}
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 0, 0, 0, 0, 0, 0, 0);
return 1;
}
BTW im also using ManualVehicleEngine at OnGameModeInit
Posts: 2,268
Threads: 89
Joined: Apr 2009
Reputation:
0
Post your whole code then.
Which param are you setting?
I ask that because you could setting doors to 1, and expecting the doors to get opened.
Posts: 220
Threads: 37
Joined: May 2010
Reputation:
0
29.09.2011, 18:39
(
Последний раз редактировалось Audiophr3ak; 29.09.2011 в 19:48.
)
And also i had this problem at 0.3c version. This shi' don't wanna work after vehicle respawns too. It works only when im controlling em with commands.