GerardWay Posted October 12, 2013 Share Posted October 12, 2013 Could someone please help me out with this? The peds are showing, but they can be killed. function peds() ped1 = createPed (285, 201.2998, 1922.59961, 17.6, 0, 0, 180.005) ped2 = createPed (280, 209.7, 1922.69995, 17.6, 0, 0, 180) ped3 = createPed (282, 218.7, 1922.90002, 17.6, 0, 0, 176) ped4 = createPed (15, 190.10000610352, 1922.8000488281, 17.60000038147, 0, 0, 180.005493) end addEventHandler ("onResourceStart", resourceRoot, peds) function pedDamage() cancelEvent() end addEventHandler ( "onClientPedDamage", ped1, pedDamage ) addEventHandler ( "onClientPedDamage", ped2, pedDamage ) addEventHandler ( "onClientPedDamage", ped3, pedDamage ) addEventHandler ( "onClientPedDamage", ped4, pedDamage ) Link to comment
Discord Moderators Zango Posted October 12, 2013 Discord Moderators Share Posted October 12, 2013 You are using a clientside event in a serverside script. onClientPedDamage can only be used clientside. edit, with an example: serverside: function setPedInvincible (ped, bInvincible) if (ped) and (getElementType(ped) == 'ped') then setElementData (ped, 'invincible', bInvincible) return true end return false end clientside: function cancelPedDamage () if (not getElementData(source, 'invincible')) then return false end return cancelEvent () end addEventHandler ('onClientResourceStart', resourceRoot, function () addEventHandler ('onClientPedDamage', root, cancelPedDamage) end ) Link to comment
Desaster Posted October 13, 2013 Share Posted October 13, 2013 create your ped and name it for example : thePed and add this addEventHandler("onClientPedDamage", thePed, function () cancelEvent() end) Link to comment
myonlake Posted October 13, 2013 Share Posted October 13, 2013 create your ped and name it for example : thePed and add this addEventHandler("onClientPedDamage", thePed, function () cancelEvent() end) Or simply just; addEventHandler("onClientPedDamage", thePed, cancelEvent) 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