Charango Posted January 22, 2013 Share Posted January 22, 2013 (edited) Spanish - Español Hola, quiero ponerle a mi Race Ghost Driver (DM), un comando o algo por el estilo para que cada player pueda ocultarlo/mostrarlo, alguien sabe como puedo hacerlo? Saludos. English - Inglés Hello, I want to put in my Ghost Race Driver (DM), a command or something so that each player can hide/show, anyone know how I can do? Greetings. Edited January 24, 2013 by Guest Link to comment
Anderl Posted January 22, 2013 Share Posted January 22, 2013 "Ghost Race Driver" - what's it? Your own gamemode? Any default gamemode? If that's MTA default race gamemode, there's a command already built-in. Not sure but I guess it's "gm" ( means ghost mode ). Link to comment
Charango Posted January 22, 2013 Author Share Posted January 22, 2013 The "Ghost Race Driver" is an add-on for Race Gamemode (More info: https://community.multitheftauto.com/index.php?p= ... ils&id=665) and I want to have a command to hide/show the ghost driver individually, I mean that a player put the command and hide the ghost driver only for this player. Greetings. Link to comment
Castillo Posted January 22, 2013 Share Posted January 22, 2013 You can move them to another dimension. setElementDimension Link to comment
Charango Posted January 23, 2013 Author Share Posted January 23, 2013 I did this, local me = getLocalPlayer() function toggleGhost() setElementData(me, "hideGhost", not getElementData(me, "hideGhost"), false) local e = getElementData(me, "hideGhost") outputChatBox('[HIDE] Ghost are '.. ( e and "hidden" or "visible" ), 255, 100, 100, true) end addCommandHandler("hg", toggleGhost) bindKey("k", "down", toggleGhost) function hideGhost(GhostPlayback) local vehicle = GhostPlayback if vehicle then if getElementDimension(vehicle) ~= 999 or getElementDimension(GhostPlayback) ~= 999 or getElementInterior(GhostPlayback) ~= 999 or getElementInterior(vehicle) ~= 999 then setElementDimension(vehicle, 999) setElementDimension(GhostPlayback, 999) setElementInterior(vehicle, 999) setElementInterior(GhostPlayback, 999) end end end function showGhost(GhostPlayback) local vehicle = GhostPlayback if vehicle then if getElementDimension(vehicle) ~= 0 or getElementDimension(GhostPlayback) ~= 0 or getElementInterior(GhostPlayback) ~= 0 or getElementInterior(vehicle) ~= 0 then setElementDimension(vehicle, 0) setElementDimension(GhostPlayback, 0) setElementInterior(vehicle, 0) setElementInterior(GhostPlayback, 0) end end end The code where I got the line "GhostPlayback" is this, GhostPlayback = {} GhostPlayback.__index = GhostPlayback addEvent( "onClientGhostDataReceive", true ) addEvent( "clearMapGhost", true ) function GhostPlayback:create( recording, ped, vehicle ) local result = { ped = ped, vehicle = vehicle, recording = recording, isPlaying = false, startTick = nil, } setElementCollisionsEnabled( result.ped, false ) setElementCollisionsEnabled( result.vehicle, false ) setElementFrozen( result.vehicle, true ) setElementAlpha( result.ped, 100 ) setElementAlpha( result.vehicle, 100 ) return setmetatable( result, self ) end It does not work, hit the "k" I get "[HIDE] Ghost are hidden", "[HIDE] are visible Ghost" but ghost driver is still visible. In "debugscript" not get errors. Do not know what to do, please help. Greetings. Link to comment
Charango Posted January 25, 2013 Author Share Posted January 25, 2013 Someone who could help me? Tell me what I'm doing wrong? Please Regards, Link to comment
Castillo Posted January 25, 2013 Share Posted January 25, 2013 You should start from scratch, it would be easier. Link to comment
Charango Posted January 25, 2013 Author Share Posted January 25, 2013 How to start from scratch? i don't understand. Link to comment
Castillo Posted January 25, 2013 Share Posted January 25, 2013 Well, to make such script you need only some functions & basic lua knowledge: bindKey getElementsByType getPedOccupiedVehicle setElementDimension 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