Gravestone Posted March 22, 2016 Share Posted March 22, 2016 My script enables god mode for the players who are not wanting to deathmatch. This code is supposed to take away weapons and allow the weapons which are in the allowed table. Need help in takeWeapon. ocal allowed = { [10] = true, [11] = true, [12] = true, [13] = true, [14] = true, [15] = true, [44] = true, [45] = true, [46] = true, [43] = true, } function disableWeaponOnGodMod (prev,new) if getElementData(localPlayer, "invincible") and not allowed[getPedWeapon(localPlayer)] then takeWeapon(localPlayer, not allowed[getPedWeapon(localPlayer)]) end end addEventHandler ( "onClientRender", root, disableWeaponOnGodMod ) Link to comment
Dimos7 Posted March 22, 2016 Share Posted March 22, 2016 take wepon is server side not clinet btw Link to comment
EstrategiaGTA Posted March 22, 2016 Share Posted March 22, 2016 local allowed = { [10] = true, [11] = true, [12] = true, [13] = true, [14] = true, [15] = true, [44] = true, [45] = true, [46] = true, [43] = true, } function disableWeaponOnGodMod (prev,new) if getElementData(source, "invincible") and not allowed[getPedWeapon(source)] then takeWeapon(source, not allowed[getPedWeapon(source)]) end end addEventHandler ( "onPlayerWeaponSwitch", root, disableWeaponOnGodMod ) Why do you use onClientRender? By the handler arguments you are using, prev and new, it seems you want to use onPlayerWeaponSwitch. 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