SkiZo Posted January 4, 2017 Share Posted January 4, 2017 Hello , I Created A script ! it's work but the problem that ! the minigun not allowed in all the server how can i make it not allowed only in "Challenges area" Challenges area ! Deathmatch Make you make event vs other player ! Use any gun but not minigun !! this is the script --- --- function antiminigun ( previousWeaponID, currentWeaponID ) --when a player switches his weapon if currentWeaponID == 38 then local name = getClientName ( source ) local weapon = getWeaponNameFromID ( currentWeaponID ) outputChatBox ( "You Can not use This Weapon in this Area", source, 255, 100, 0,true ) PN = getPlayerFromNick (name) toggleControl (source, "fire", false) else toggleControl (source, "fire", true) end end addEventHandler ( "onPlayerWeaponSwitch", getRootElement(), antiminigun ) -- -- this is the area local skintable = { [10] = true, [11] = true, [12] = true, [13] = true, [14] = true, [15] = true, [17] = true, [16] = true, [18] = true, [19] = true, [20] = true, [21] = true, [22] = true, [24] = true} --Zombie Skinszone1 = createColCuboid ( 112.9927444458, 1337.1772460938, 10, 170, 150, 255 ) safeZoneRadar = createRadarArea ( 112.9927444458, 1337.1772460938, 170, 150, 0, 0, 0, 0 ) setElementData (safeZoneRadar, "zombieProof", true) function outZone(hitPlayer,thePlayer) function inZone(hitPlayer,thePlayer) local skin = getElementModel (hitPlayer) if not skintable[getElementModel(hitPlayer)] then --if not zombie toggleControl (hitPlayer, "fire", true) toggleControl (hitPlayer, "next_weapon", true) toggleControl (hitPlayer, "previous_weapon", true) toggleControl (hitPlayer, "prelaus_weapon", true) toggleControl (hitPlayer, "aim_weapon", true) toggleControl (hitPlayer, "vehicle_fire", false) else --if zombie killPed (hitPlayer) --kill zombie end end addEventHandler( "onColShapeHit", zone1, inZone ) local skin = getElementModel (hitPlayer) toggleControl (hitPlayer, "fire", true) toggleControl (hitPlayer, "next_weapon", true) toggleControl (hitPlayer, "previous_weapon", true) toggleControl (hitPlayer, "prelaus_weapon", true) toggleControl (hitPlayer, "aim_weapon", true) toggleControl (hitPlayer, "vehicle_fire", true) if skintable[getElementModel(hitPlayer)] then killPed (hitPlayer) --kill zombie end end addEventHandler( "onColShapeLeave", zone1, outZone ) Link to comment
iPrestege Posted January 4, 2017 Share Posted January 4, 2017 (edited) You can simply use isElementWithinColShape with onPlayerWeaponSwitch to toggleControl. @S.W.A.T Edited January 4, 2017 by iPrestege typo Link to comment
SkiZo Posted January 4, 2017 Author Share Posted January 4, 2017 Can You Edit it ? :\ Link to comment
iPrestege Posted January 4, 2017 Share Posted January 4, 2017 addEventHandler ( 'onPlayerWeaponSwitch',root, function ( _,aMyWeapon ) if isElementWithinColShape( source,zone1 ) and aMyWeapon == 38 then toggleControl( source,'fire',false ); else toggleControl( source,'fire',true ); end end ); remove the antiminigun function and use this ^^ @S.W.A.T Link to comment
SkiZo Posted January 4, 2017 Author Share Posted January 4, 2017 (edited) [2017-01-04 19:41:48] WARNING: ChallengeArea\safetyzone.lua:39: Bad argument @ 'isElementWithinColShape' [Expected colshape at argument 2, got nil] [DUP x4] Thank You Very Much It's Work Thank You Thank you !! @iPrestege Edited January 4, 2017 by S.W.A.T Nothing littel mistake :v Link to comment
iPrestege Posted January 4, 2017 Share Posted January 4, 2017 You're welcome not a problem just i thought your colshape variable is 'zone1' because it's in the event anyways glad to hear that enjoy. Link to comment
SkiZo Posted January 4, 2017 Author Share Posted January 4, 2017 Yeah Was Named Only 'zone' but i change it to 'zone1' and every thing is good thanks again !! if i wonna to add other gun like Sniper i use aMyWeapon == 38 or aMyWeapon ==34 then ??? And If I Wonna to add That output chat and be visible to that player who use MiniGun shoold i add outputChatBox ( "You Can not use This Weapon in this Event", source, 255, 100, 0,true ) or outputChatBox ( "You Can not use This Weapon in this Event", hitPlayer, 255, 100, 0,true ) ???? @iPrestege Link to comment
iPrestege Posted January 4, 2017 Share Posted January 4, 2017 Yes use or aMyWeapon == weaponID and about the message just change hitPlayer with source because it's the player in the event. 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