Jump to content

[Help] Simple Ghostmode Script


BieHDC

Recommended Posts

Can you tell me if this will work?

Because i have no chance to test :/

-- Client Side 
-- Ghostmode Example from Wiki 
  
function ghostmode_on() 
    local v = getPedOccupiedVehicle(localPlayer) -- Get her's Vehicle ID 
    for index,vehicle in ipairs(getElementsByType("vehicle")) do --LOOP through all Vehicles 
        setElementCollidableWith(vehicle, v, false) -- Set the Collison off with the Other vehicles. 
    end 
    outputChatBox("You are now a Ghost ,thePlayer) 
end 
addEventHandler("onGamemodeMapStart", getRootElement(), ghostmode_on) 
  
 

Edited by Guest
Link to comment
-- Client Side 
-- Ghostmode Example from Wiki 
  
function ghostmode_on() 
    local v = getPedOccupiedVehicle(localPlayer) -- Get her's Vehicle ID 
    for index,vehicle in ipairs(getElementsByType("vehicle")) do --LOOP through all Vehicles 
        setElementCollidableWith(vehicle, v, false) -- Set the Collison off with the Other vehicles. 
    end 
    outputChatBox("You are now a Ghost") 
end 
addEventHandler("onGamemodeMapStart", getRootElement(), ghostmode_on) 

Link to comment
  
  
function ghostmode_on() 
    local v = getPedOccupiedVehicle(getLocalPlayer()) -- Get her's Vehicle ID 
    for index,vehicle in ipairs(getElementsByType("vehicle")) do --LOOP through all Vehicles 
        setElementCollidableWith(vehicle, v, false) -- Set the Collison off with the Other vehicles. 
    end 
    outputChatBox("You are now a Ghost") 
end 
addEvent("onGamemodeMapStart",true) 
addEventHandler("onGamemodeMapStart", getRootElement(), ghostmode_on) 

Link to comment

use

"onClientMapStarting" -- it's triggered by "race" itself. But onClientMapStarting is to fast for your script (there will be no vehicles , bk race only after onClientMapStarting create's them).

You could search the start command (3,2,1,GO) and runn your script when the countDown start's if i am right there is an Event for it .

"onRaceStateChanging" whit first elemet as string "GridCountdown"

function ghostmode_on(what) 
  
  if what  == "GridCountdown"   then 
outputChatBox("Starting GhostMode") 
  
    local v = getPedOccupiedVehicle(getLocalPlayer()) -- Get her's Vehicle ID 
    for index,vehicle in ipairs(getElementsByType("vehicle")) do --LOOP through all Vehicles 
        setElementCollidableWith(vehicle, v, false) -- Set the Collison off with the Other vehicles. 
    end 
    outputChatBox("You are now a Ghost") 
end 
 end 
addEvent("onRaceStateChanging" ,true) 
addEventHandler("onRaceStateChanging" , getRootElement(),  ghostmode_on) 

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...