Jump to content

Ayuda/Help with Race-Ghost [HELP PLEASE]


Charango

Recommended Posts

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 by Guest
Link to comment

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...