Jump to content

[Help] Simple Ghostmode Script


BieHDC

Recommended Posts

Posted (edited)

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
Posted

i think yes, but i dont found anything about this handler in wiki, but it exists, but i dont know if client or server.

and debugscript 3 gave no outputs

Posted
-- 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) 

Posted
  
  
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) 

Posted

You are using it with "Race" gamemode right ?

Race gamemode has it's own "ghost mode" function so maybe it's over writing your function.

Atleast you get the outputChatBox ??

Posted

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) 

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