Game Development Community

Vehicle Selection

by Jon · in Technical Issues · 09/23/2004 (11:33 pm) · 1 replies

Hello, I'm trying to make a vehicle selection menu and I'm having problems. I looked at the player selection thread (scroll to last two threads) and followed it and tried to modify it to work with my vehicle. My selection gui is real simple for right now I have different buttons for the vehicles and set btnVehicle1's command = $vehicleChoice(declared on the client) = '/vehicle1/'; and also tried putting variable = $vehicleChoice. I then set the

%car = new WheeledVehicle() {
dataBlock = $vehicleChoice;
...
...
}

in the game.cs file, this doesn't work when playing on a server and everyone ends up with the same vehicle. When I followed the player selection thread in Gonzo T. Clowns post where in joinServerGui.gui file he adds a parameter in the %conn.setConnectArgs($pref::Player::Name, $vehicleChoice); Then in the common/server/clientConnection.cs in the GameConnection::onConnect(%client, %name, %vehicle) I've tried doing "client.vehicle = %vehicle" then in game.cs

%car = new WheeledVehicle() {
dataBlock = %this.vehicle;
...
...
}

and nothing. I've checked the parameter that I'm passing to the onConncect function, %vehicle and I get nothing. I thought from the %conn.setConnectArgs($pref::Player::Name, $vehicleChoice); I was passing the parameter to the onConnect function as %vehicle.
Anythoughts here?

I've also tried sending a CommandToServer. I set it up by right after I did the %conn.setConnectArgs($pref::Player::Name); (took out extra param) I did CommandToServer('SetVehicle',$vehicleChoice); then on the server side in the common/server/clientConnection.cs file i have
$sVehicle = "";
function ServerCmdSetVihicle(%client, %vehicle)
{
$sVehicle = %vehicle;
}

and then back in the GameConnection::onConnect() I do "%client.vehicle = $sVehicle;" For some reason I'm not even getting into the ServerCmdSetVehicle.... Any thoughts on this or pointers or anything?

Thanks ahead of time!

#1
09/24/2004 (9:14 pm)
Ok... I got it working... pay no attention to the CommandToServer stuff... I realized that I didn't modify the startMissionGui.gui file's SM_StartMission() there is another %conn.setConnectArgs and I wasn't passing the $vehicleChoice as a second parameter... but it works! and I can choice a different car and frag my friends!!! Lovin it!