BieHDC Posted August 14, 2013 Posted August 14, 2013 (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 August 14, 2013 by Guest
tosfera Posted August 14, 2013 Posted August 14, 2013 This will work, 100%. IF the onGamemodeMapStart is a valid eventHandler.
BieHDC Posted August 14, 2013 Author Posted August 14, 2013 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
tosfera Posted August 14, 2013 Posted August 14, 2013 its a client-sided script cause the setelementCollidableWith is a client-side function.
BieHDC Posted August 14, 2013 Author Posted August 14, 2013 ok thx^ but i dont get chatbox output edit: with command handler it works :c
BieHDC Posted August 14, 2013 Author Posted August 14, 2013 can i also use OnClientPlayerSpawn or OnClientResourceStart ?
BieHDC Posted August 14, 2013 Author Posted August 14, 2013 But why then works with command handler to show message?
bandi94 Posted August 14, 2013 Posted August 14, 2013 https://wiki.multitheftauto.com/wiki/RU/Resource:Race
manve1 Posted August 14, 2013 Posted August 14, 2013 -- 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)
BieHDC Posted August 14, 2013 Author Posted August 14, 2013 does it need admin? also doesnt work with admin
bandi94 Posted August 14, 2013 Posted August 14, 2013 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)
bandi94 Posted August 14, 2013 Posted August 14, 2013 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 ??
bandi94 Posted August 15, 2013 Posted August 15, 2013 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)
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