Jump to content

Destroy Weapon


Function

Recommended Posts

Please guys how can I destroy a weapon when a player is on nodm mode and tries to set a weapon.

 

function noDeathmatch(thePlayer)
if getElementData(thePlayer,"invincible") then
setElementData(thePlayer,"invincible",false)
setPlayerHudComponentVisible(thePlayer,"weapon",true)
setPlayerHudComponentVisible(thePlayer,"ammo",true)
toggleControl(thePlayer,"next_weapon",true)
toggleControl(thePlayer,"previous_weapon",true)
toggleControl(thePlayer,"fire",true)
toggleControl(thePlayer,"aim_weapon",true)
toggleControl(thePlayer,"vehicle_fire",true)
toggleControl(thePlayer,"vehicle_secondary_fire",true)
outputChatBox("#ffffff[DEATHMATCH] #ff6464You have disabled the no deathmatch mode.",thePlayer,255,255,255,true)
else
setElementData(thePlayer,"invincible",true)
setElementHealth(thePlayer,1000)
setPedArmor(thePlayer,100)
setPedWeaponSlot(thePlayer,0)
setPlayerHudComponentVisible(thePlayer,"weapon",false)
setPlayerHudComponentVisible(thePlayer,"ammo",false)
toggleControl(thePlayer,"next_weapon",false)
toggleControl(thePlayer,"previous_weapon",false)
toggleControl(thePlayer,"fire",false)
toggleControl(thePlayer,"aim_weapon",false)
toggleControl(thePlayer,"vehicle_fire",false)
toggleControl(thePlayer,"vehicle_secondary_fire",false)
outputChatBox("#ffffff[DEATHMATCH] #ff6464You have enabled the no deathmatch mode.",thePlayer,255,255,255,true) 
end 
end
addCommandHandler("nodm",noDeathmatch) 

 

Edited by Function
Link to comment
1 hour ago, Function said:

Can you explain it better please, I think I need to start with a new function right?

No, and take all weapons - takeAllWeapons(player)

And check getElementData, on dm player or not, after that u use takeAllWeapon and people haven't weapons

Edited by nikitafloy
Link to comment

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