[Tutorial] Multiple Vehicle Models (Command)

m70b1jr#9501
Joined
May 18, 2013
Messages
852
Reaction score
328
Tired of only having the buggy?
Well to spawn in different vehicles, look in WarZ_Server.SLN and search
Code:
if(strncmp(cmd, "/vehicle", 4) == 0)
        {
            obj_Vehicle* obj =     (obj_Vehicle*)srv_CreateGameObject("obj_Vehicle", "obj_Vehicle", plr->GetPosition());
            sprintf(obj->vehicle_Model,"Data\\ObjectsDepot\\Vehicles\\drivable_buggy_02.sco");
            obj->SetNetworkID(GetFreeNetId());
            obj->NetworkLocal = true;
            obj->bOn = false;
            obj->OnCreate();
        }

Then add below
Code:
[COLOR=#ff0000]else[/COLOR] if(strncmp(cmd, "/NAMEOFCOMMANDYOUWANT", 4) == 0)
        {
            obj_Vehicle* obj =     (obj_Vehicle*)srv_CreateGameObject("obj_Vehicle", "obj_Vehicle", plr->GetPosition());
            sprintf(obj->vehicle_Model,"Data\\ObjectsDepot\\Vehicles\\zombie_killer.sco"); //Or model of driveable vehicle)
            obj->SetNetworkID(GetFreeNetId());
            obj->NetworkLocal = true;
            obj->bOn = false;
            obj->OnCreate();
        }

REMEMBER TO LIKE!
 
Last edited:
Re: [TUTORIAL] Multiple Vehicle Models (Command)

I added these commands. :blushing:


I modified / car1 / car2 / car3 so on ...... :P:


The results ......, whether CAR1 or CAR2, I brush out of the same car.:junglejane:
 
So let's analyze this:

You say everybody should do this?:
else if(strncmp(cmd, "/vehicle", 4) == 0)
{
obj_Vehicle* obj = (obj_Vehicle*)srv_CreateGameObject("obj_Vehicle", "obj_Vehicle", plr->GetPosition());
sprintf(obj->vehicle_Model,"Data\\ObjectsDepot\\Vehicles\\zombie_killer.sco"); //Or model of driveable vehicle)
obj->SetNetworkID(GetFreeNetId());
obj->NetworkLocal = true;
obj->bOn = false;
obj->OnCreate();
}
else if(strncmp(cmd, "/vehicle", 4) == 0)
{
obj_Vehicle* obj = (obj_Vehicle*)srv_CreateGameObject("obj_Vehicle", "obj_Vehicle", plr->GetPosition());
sprintf(obj->vehicle_Model,"Data\\ObjectsDepot\\Vehicles\\tank.sco"); //Or model of driveable vehicle)
obj->SetNetworkID(GetFreeNetId());
obj->NetworkLocal = true;
obj->bOn = false;
obj->OnCreate();
}
else if(strncmp(cmd, "/vehicle", 4) == 0)
{
obj_Vehicle* obj = (obj_Vehicle*)srv_CreateGameObject("obj_Vehicle", "obj_Vehicle", plr->GetPosition());
sprintf(obj->vehicle_Model,"Data\\ObjectsDepot\\Vehicles\\driveable_buggy_01.sco"); //Or model of driveable vehicle)
obj->SetNetworkID(GetFreeNetId());
obj->NetworkLocal = true;
obj->bOn = false;
obj->OnCreate();
}

So the code makes something like this

check if given command equals "vehicle" does it? okay then spawn zombie_killer
if not check if it equals with "vehicle" does it? no ? why? because it CAN'T! BECAUSE THE IF BEFORE WAS FALSE.
 
I always get the same vehicle

Ofc u do, because the Vehicle Model is hardcoded into;
Code:
BOOL obj_Vehicle::Load(const char *fname)

This needs to be rewritten complete, to let the Server handle the Vehicle Spawn, and the Client just load the right meshes.
 
I think I did something wrong I'll try again with a different command name. is possible to place normal vehicles tb this way?
sorry my english
 
I did in a different way and be able to change my vehicle. only that it is turning with the wheel brings the '-'X
xD


 
I did in a different way and be able to change my vehicle. only that it is turning with the wheel brings the '-'X
xD



You don't understand, this is for you can spawn for exemple, a buggy, a striker and a killer, with diferent commands '-'
 
you do not understand. friend with the tutorial above I had not gotten results using q otherwise. only the invez the front wheel to rotate brings that is turning.
 
Check the _drivedata.xml for the Vehicle what u want to use.
 
Back