Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: rObInX on Aug 30, 2015, 12:37 PM

Title: *.Vehicle returns something else.
Post by: rObInX on Aug 30, 2015, 12:37 PM
(http://i.imgur.com/kXYRjnI.png)
player.Vehicle returns some instance.
Is there any mistake from my side, in the execution?

Regards,
rObInX
Title: Re: *.Vehicle returns something else.
Post by: . on Aug 30, 2015, 12:41 PM
You're printing the address in memory where the vehicle instance is located. I can also notice that you're on a x64 bit system. Try plr.Vehicle.ID if that's what you want.
Title: Re: *.Vehicle returns something else.
Post by: rObInX on Aug 30, 2015, 12:45 PM
Thanks for the help.
Fixed btw.

<rObInX> !exec local plr = FindPlayer(0); AMessage( plr.Name + " " + GetVehicleNameFromModel( plr.Vehicle.Model ) );
P.S How can I set a player into a custom car?
I can't find it using FindVehicle.
Title: Re: *.Vehicle returns something else.
Post by: KAKAN on Aug 30, 2015, 01:24 PM
Use this(edit it 1st)
if (GetVehicleNameFromModel(vehicle.Model)== null ) MessagePlayer(">> [#FF0000]Entering in [#FFFFFF]"+GetVehicleNameFromCustomModel(vehicle.Model)+".",player);
else MessagePlayer(">> [#FF0000]Entering In [#FFFFFF]"+GetVehicleNameFromModel(vehicle.Model)+".",player);

Now function:-
function GetVehicleNameFromCustomModel(model)
{
switch(model)
{
case 6400: return "1st one"; /1st car name, edit the others too
case 6401: return "2nd one";
case 6402: return "3rd one";
case 6403: return "4th one"; //Add how many u want
default: return "Name not specified";
}
}

Credits:- @Bezstone
Title: Re: *.Vehicle returns something else.
Post by: Xmair on Aug 30, 2015, 01:32 PM
@KAKAN He didn't meant that, he means how can he put someone in a custom vehicle.
Title: Re: *.Vehicle returns something else.
Post by: Thijn on Aug 30, 2015, 03:14 PM
Like any other car. Spawn it, then use FindVehicle, then set player.Vehicle to that.
Title: Re: *.Vehicle returns something else.
Post by: rObInX on Aug 30, 2015, 04:58 PM
What I did was, added custom car but never spawned it.
And tried to set player as driver!

Thanks.