Posts: 7,801
Threads: 187
Joined: Feb 2010
Reputation:
0
21.01.2012, 01:09
(
Последний раз редактировалось Scenario; 21.01.2012 в 01:49.
)
I use CreateVehicle after loading vehicles from a MySQL DB. The vehicles get created, but it doesn't seem that OnVehicleSpawn is being called. Is this supposed to happen when using CreateVehicle? The only want OnVehicleSpawn is called is when the vehicle dies and respawns.
Posts: 1,849
Threads: 96
Joined: Apr 2010
Reputation:
0
CreateObject has a respawn delay. Call them under OnGameModeInIt. When ever a vehicle will die it will respawn back.
I think you already know that Cop!
Posts: 7,801
Threads: 187
Joined: Feb 2010
Reputation:
0
Did I say CreateObject, I meant CreateVehicle.
Posts: 2,938
Threads: 162
Joined: May 2010
I don't know, but specially for my server, I want OnVehicleSpawn to be called with CreateVehicle, so I just do this
pawn Код:
stock CreateVehicleEx(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay)
{
new id = CreateVehicle(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay);
if(!Iter_Contains(Vehicles, id))
{
Iter_Add(Vehicles, id);
}
CallRemoteFunction("OnVehicleSpawn", "i", id);
return id;
}
#define CreateVehicle CreateVehicleEx
if you use 0.3c & vehicle params in OnVehicleSpawn do
pawn Код:
SetTimerEx("OnVehicleSpawn", 5, false, "i", id);
Posts: 2,938
Threads: 162
Joined: May 2010
remember if it's 0.3c you need the timer, because the bug was fixed in 0.3d.
Otherwise, I have no idea why it's not working for you o.0