[Tutorial] Users Can Spawn Cars On PVE Servers
Search :
Code:
if (strncmp(cmd, "/vspawn", 7) == 0 && plr->profile_.ProfileData.isDevAccount) return Cmd_VehicleSpawn(plr, cmd);
Add Below :
Code:
//RageZone Unique
if (strncmp(cmd, "/spawncar", 7) == 0 && plr->loadout_->GameMapId == GBGameInfo::MAPID_WZ_PVE)
return Cmd_VehicleSpawn(plr, cmd);
Search: You Will See This Code
Code:
int ServerGameLogic::Cmd_VehicleSpawn(obj_ServerPlayer* plr, const char* cmd)
{
char buf[128];
int vehicleType = 0;
if(2 != sscanf(cmd, "%s %d", buf, &vehicleType))
return 1;
if (vehicleType < 0 || vehicleType > 3)
return 1;
r3dVector position = plr->GetPosition();
position.x += 3.0f;
char name[28];
sprintf(name, "Vehicle_%d_%p", obj_Vehicle::s_ListOfAllActiveVehicles.size() + 1, this);
obj_Vehicle* vehicle = (obj_Vehicle*)srv_CreateGameObject("obj_Vehicle", name, position);
vehicle->SetNetworkID(gServerLogic.GetFreeNetId());
vehicle->NetworkLocal = true;
vehicle->spawnObject = 0;
vehicle->spawnIndex = -1;
vehicle->SetVehicleType((obj_Vehicle::VehicleTypes)vehicleType);
vehicle->SetRotationVector(plr->GetRotationVector());
vehicle->OnCreate();
r3dOutToLog("[%s] Admin has spawned a vehicle.\n", plr->userName);
return 0;
}
Make it Look Like
Code:
int ServerGameLogic::Cmd_VehicleSpawn(obj_ServerPlayer* plr, const char* cmd)
{
char buf[128];
int vehicleType = 0;
if(2 != sscanf(cmd, "%s %d", buf, &vehicleType))
return 1;
if (vehicleType < 0 || vehicleType > 2)
return 1;
r3dVector position = plr->GetPosition();
position.x += 4.0f;
char name[28];
sprintf(name, "Vehicle_%d_%p", obj_Vehicle::s_ListOfAllActiveVehicles.size() + 1, this);
obj_Vehicle* vehicle = (obj_Vehicle*)srv_CreateGameObject("obj_Vehicle", name, position);
vehicle->SetNetworkID(gServerLogic.GetFreeNetId());
vehicle->NetworkLocal = true;
vehicle->spawnObject = 0;
vehicle->spawnIndex = -1;
vehicle->SetVehicleType((obj_Vehicle::VehicleTypes)vehicleType);
vehicle->SetRotationVector(plr->GetRotationVector());
vehicle->OnCreate();
r3dOutToLog("[%s] spawned a vehicle.\n", plr->userName);
return 0;
}
Build Server
Then Users Can Spawn Cars On WZ_PVE With /spawncar Command
//PunisherZ Developer
Re: [Tutorial] Users Can Spawn Cars On PVE Servers
Re: [Tutorial] Users Can Spawn Cars On PVE Servers
Work DoommoV3 ??
----------------------------------------------------------
just to show that he has changed in the above code
Code:
int ServerGameLogic::Cmd_VehicleSpawn(obj_ServerPlayer* plr, const char* cmd)
{
char buf[128];
int vehicleType = 0;
if(2 != sscanf(cmd, "%s %d", buf, &vehicleType))
return 1;
if (vehicleType < 0 || vehicleType > 2) // 3
return 1;
r3dVector position = plr->GetPosition();
position.x += 4.0f; // 3.0f
char name[28];
sprintf(name, "Vehicle_%d_%p", obj_Vehicle::s_ListOfAllActiveVehicles.size() + 1, this);
obj_Vehicle* vehicle = (obj_Vehicle*)srv_CreateGameObject("obj_Vehicle", name, position);
vehicle->SetNetworkID(gServerLogic.GetFreeNetId());
vehicle->NetworkLocal = true;
vehicle->spawnObject = 0;
vehicle->spawnIndex = -1;
vehicle->SetVehicleType((obj_Vehicle::VehicleTypes)vehicleType);
vehicle->SetRotationVector(plr->GetRotationVector());
vehicle->OnCreate();
r3dOutToLog("[%s] spawned a vehicle.\n", plr->userName); // Admin has spawned a vehicle.
return 0;
}
Re: [Tutorial] Users Can Spawn Cars On PVE Servers
how to spawn delay for 5 minute