yesyesok Posted March 30, 2015 Share Posted March 30, 2015 Hey in my race gamemode I wanted to make others players vehicle invisible. Like when I'm playing, I should only be.able to see my vehicle not other players vehicle. I will be nice if it's posted with an example. Link to comment
yesyesok Posted March 30, 2015 Author Share Posted March 30, 2015 Can you post an example pls ? Link to comment
WhoAmI Posted March 30, 2015 Share Posted March 30, 2015 addCommandHandler ( "invisible", function ( player ) for _, v in pairs ( getElementsByType ( "player" ) ) do if ( v ~= player ) then local vehicle = getPedOccupiedVehicle ( v ) if ( isElement ( vehicle ) ) then setElementAlpha ( vehicle, 0 ) end end end end ) This will make invisible other player's vehicle if you type /invisible. Also there is resource for race server https://community.multitheftauto.com/index.php?p= ... s&id=10179 Link to comment
ALw7sH Posted March 30, 2015 Share Posted March 30, 2015 It's better to change the other cars dimension if you want a full hide and this is better to get more fps Link to comment
yesyesok Posted March 30, 2015 Author Share Posted March 30, 2015 It's better to change the other cars dimension if you want a full hide and this is better to get more fps addCommandHandler ( "invisible", function ( player ) for _, v in pairs ( getElementsByType ( "player" ) ) do if ( v ~= player ) then local vehicle = getPedOccupiedVehicle ( v ) if ( isElement ( vehicle ) ) then setElementDimension ( vehicle, 1 ) setElementDimension ( player, 1 ) end end end end ) Like this? Link to comment
#DRAGON!FIRE Posted March 30, 2015 Share Posted March 30, 2015 addCommandHandler ( "invisible", function ( player ) for _,v in pairs ( getElementsByType ( "player" ) ) do if ( v ~= player ) then if ( getPedOccupiedVehicle ( v ) ) then setElementDimension ( getPedOccupiedVehicle ( v ), 564 ) setElementDimension ( v, 564 ) end end end end ) Link to comment
yesyesok Posted March 31, 2015 Author Share Posted March 31, 2015 addCommandHandler ( "invisible", function ( player ) for _,v in pairs ( getElementsByType ( "player" ) ) do if ( v ~= player ) then if ( getPedOccupiedVehicle ( v ) ) then setElementDimension ( getPedOccupiedVehicle ( v ), 564 ) setElementDimension ( v, 564 ) end end end end ) Thanks I've one question it won't effect the race gamemode right? Player will still be able to view checkpoints and complete races Link to comment
yesyesok Posted March 31, 2015 Author Share Posted March 31, 2015 I don't think so. So you mean if i change the dimenstion of other players, it won't effect the gamemode? Link to comment
yesyesok Posted April 1, 2015 Author Share Posted April 1, 2015 addeventHandler ( "invisible", source, function ( player ) for _, v in pairs ( getElementsByType ( "player" ) ) do if ( v ~= player ) then local vehicle = getPedOccupiedVehicle ( v ) if ( isElement ( vehicle ) ) then setElementAlpha ( vehicle, 0 ) end end end ) not working Link to comment
WhoAmI Posted April 1, 2015 Share Posted April 1, 2015 addCommandHandler ( "invisible", function ( player ) for _, v in pairs ( getElementsByType ( "player" ) ) do if ( v ~= player ) then local vehicle = getPedOccupiedVehicle ( v ) if ( isElement ( vehicle ) ) then setElementAlpha ( vehicle, 0 ) end end end end ) But I think it should be client-side... Not sure. Try also: addCommandHandler ( "invisible", function ( ) for _, v in pairs ( getElementsByType ( "player" ) ) do if ( v ~= localPlayer ) then local vehicle = getPedOccupiedVehicle ( v ) if ( isElement ( vehicle ) ) then setElementAlpha ( vehicle, 0 ) end end end end ) Check also this code client-side. Link to comment
yesyesok Posted April 1, 2015 Author Share Posted April 1, 2015 addCommandHandler ( "invisible", function ( player ) for _, v in pairs ( getElementsByType ( "player" ) ) do if ( v ~= player ) then local vehicle = getPedOccupiedVehicle ( v ) if ( isElement ( vehicle ) ) then setElementAlpha ( vehicle, 0 ) end end end end ) I Don't want a command for that it should work when the resource that, the reason i used addeventhandler Link to comment
WhoAmI Posted April 1, 2015 Share Posted April 1, 2015 Try it clientside addEventHandler ( "onClientResourceStart", resourceRoot, function ( ) for _, v in pairs ( getElementsByType ( "player" ) ) do if ( v ~= localPlayer ) then local vehicle = getPedOccupiedVehicle ( v ) if ( isElement ( vehicle ) ) then setElementAlpha ( vehicle, 0 ) end end end end ) Link to comment
ALw7sH Posted April 1, 2015 Share Posted April 1, 2015 it must be client side, otherwise the players wont see the map objects expect who hide them Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now