diegofkda Posted March 28, 2011 Share Posted March 28, 2011 (edited) Maybe this will sound stupid, but I want to know how to add an event with getPedOccupiedVehicle... vehicle = getPedOccupiedVehicle (getLocalPlayer()) function damageproof() setVehicleDamageProof (vehicle, true) end addEventHandler ("onClientResourceStart", root, damageproof) Idk if is that correct, but it is just an example, (it isnt correct yes I know) it isnt working, it is a "bad argument"... the same thing happens with all, so i think that "vehicle" needs something to work with events, so I want to know what it needs. Edited March 28, 2011 by Guest Link to comment
Castillo Posted March 28, 2011 Share Posted March 28, 2011 onClientResourceRestart? that event doesn't exist P.S: Why you put getPedOccupiedVehicle out of function? Link to comment
Moderators Citizen Posted March 28, 2011 Moderators Share Posted March 28, 2011 And if is in the function, you have to warpPedIntoVehicle before that this code is executed ( you can warp him in "onPlayerJoin" ) Link to comment
Dre-+- Posted March 28, 2011 Share Posted March 28, 2011 function damageproof() vehicle = getPedOccupiedVehicle (getLocalPlayer()) setVehicleDamageProof (vehicle, true) end addEventHandler ("onClientPlayerVehicleEnter, getLocalPlayer(), damageproof) BTW: in original script you forgot add string: root = getRootElement() Link to comment
Kenix Posted March 28, 2011 Share Posted March 28, 2011 gme = getLocalPlayer() function damageproof() local vehicle = getPedOccupiedVehicle (gme) setVehicleDamageProof (vehicle, true) end addEventHandler ("onClientPlayerVehicleEnter", getLocalPlayer(), damageproof) Link to comment
proracer Posted March 28, 2011 Share Posted March 28, 2011 function damageproof() vehicle = getPedOccupiedVehicle (getLocalPlayer()) setVehicleDamageProof (vehicle, true) end addEventHandler ("onClientPlayerVehicleEnter, getLocalPlayer(), damageproof) BTW: in original script you forgot add string: root = getRootElement() root is already defined as a keyword in MTA: MTA Wiki:Note: all resources have a predefined global variable called root that has the root element as value. The variable exists server side as well as client side. Link to comment
diegofkda Posted March 28, 2011 Author Share Posted March 28, 2011 function damageproof() vehicle = getPedOccupiedVehicle (getLocalPlayer()) setVehicleDamageProof (vehicle, true) end addEventHandler ("onClientPlayerVehicleEnter, getLocalPlayer(), damageproof) BTW: in original script you forgot add string: root = getRootElement() root is already defined as a keyword in MTA: MTA Wiki:Note: all resources have a predefined global variable called root that has the root element as value. The variable exists server side as well as client side. LOL i failed "onClientResourceRestart", its just Start ! Ok ty all Link to comment
diegofkda Posted March 28, 2011 Author Share Posted March 28, 2011 onClientResourceRestart?that event doesn't exist P.S: Why you put getPedOccupiedVehicle out of function? Yes I failed. I put "getPedOccupiedVehicle" out of function because I failed again. I made this question when I was... sleepy lol. 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