Jump to content

Help Me In This Script !!


SkiZo

Recommended Posts

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

:$ 
[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 :D 
Thank You Thank you !! :) 

@iPrestege

Edited by S.W.A.T
Nothing littel mistake :v
Link to comment

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

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