AddStaticVehicleEx
#1

What's the deal with AddStaticVehicleEx? In the wiki it says it only works when used in OnGameModeInit, but I have it in a command, something like this:
pawn Код:
CMD:train(playerid, params[]){
    //some code
    AddStaticVehicleEx(538, x, y, z, a, -1, -1, -1);
    //some other code
}
ID 538 is a train, which obviously can't be spawned with CreateVehicle. But I just used AddStaticVehicleEx in a command and it works perfectly fine. When I'm somewhere near the tracks and use /train, it spawns on the tracks and I can get in and drive it and all that. I can even get rid of it with DestroyVehicle even though I read somewhere that it wasn't possible to use that on vehicles created with AddStaticVehicleEx.

So why does the wiki tell me that AddStaticVehicleEx only works in OnGameModeInit, when it actually works fine elsewhere? Is it because I'm using ZCMD or something?
Reply
#2

I don't think ZCMD is the problem here.
But as you described, it says AddStaticVehicleEx works only in OnGameModeInit(). And ZCMD is under OnPlayerText().

The only way to fix this as I see is to make AddStaticVehicleEx in the OnGameModeInit().

So when the server starts, the train spawns. Spawning trains (that works) is not possible as I know.
Reply
#3

I know it says that. But I'm saying that on my server it actually DOES work under OnPlayerText. By that I mean I have AddStaticVehicleEx in the command and the train does spawn when I use that command, so from what I see it doesn't only work in OnGameModeInit..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)