Vehicle.SetGhost (and to a certain extent, Vehicle.GetGhost)

Started by Fuzzie, Jan 11, 2015, 07:29 AM

Previous topic - Next topic

Fuzzie

What happened to Vehicle.SetGhost? It's not in the wiki but it is in the source code. Does it also have anything to do with making this possible? If no, then how do I achieve what storm did and what Vehicle.SetGhost was suppose to do?

Sebastian

Did you even try that function ?
You didn't, because if you would have tried it you would have know that it works just like Stormeus shown in his video.

About the wiki... it is very uncomplete. When I will have more free-time, I will try to complete it as much as I can.

Fuzzie

I wouldn't have made this topic if I haven't already tried it out already. So accusing me of not trying is probably not wise. My code was very simple. player.Vehicle.SetGhost( true ); I got an error message saying that SetGhost() isn't a member variable of Vehicle. That and the fact it wasn't in the wiki lead me to believe something happened with it.

Danix


.

Quote from: Danix on Jan 11, 2015, 01:58 PMTry this:
player.Vehicle.IsGhost=true;

You shouldn't chain anything on player.Vehicle because it might return null. Make sure to at least check before doing that.
if (player.Vehicle != null) player.Vehicle.IsGhost=true;
.

Danix

Quote from: S.L.C on Jan 11, 2015, 02:15 PM
Quote from: Danix on Jan 11, 2015, 01:58 PMTry this:
player.Vehicle.IsGhost=true;
You shouldn't chain anything on player.Vehicle because it might return null. Make sure to at least check before doing that.
if (player.Vehicle != null) player.Vehicle.IsGhost=true;
I am indeed aware of that, but he asked for the correct usage, not the whole code.

MatheuS

FindVehicle(ID).IsGhost=true/false;

FindVehicle(1).IsGhost=true;
if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

Fuzzie

Thanks to everyone who helped but a guy already told me on my server. Still, thanks though.

@S.L.C: I was just testing some feature so I didn't include some of the usual checking stuff. :P

.

I was just pointing that out. You never know when a newbie will come around and use that code without knowing.
.

DizzasTeR

Thanks to Fuzzie, you saved a hell of codes to be implemented in my script which I'm working on by just showing me this function and that video.