Jump to content

Forbidden Weapons ... HELP !


d43dr4

Recommended Posts

Hello guys,

I have a probleme or a bug on a script , that script can forbid some weapons by their ids

When you get this forbidden weapon it will auto hiden from you weapons ..

But there is a problem ..

As exemple :

When i forbid a weapon id is : 38 (Minigun) The weapons that contain numbers 3 (Nightstick) and 8 (Katana) will forbidden else .

What should i do !?

Here is the "meta.xml" file

<meta> 
    <info author="Tockra" version="1.2" type="misc" name="Forbid Weapons (runs with freeroam and other Resources)" description="You can forbid some weapons on your server by changing the settings.xml" /> 
    <script src="start.lua" type="server" /> 
</meta> 

and the "settings.xml" file :

<settings> 
    <WeaponIDs>38,37,36,10,11,39,40,4,9</WeaponIDs> 
</settings> 

and the "start.lua" file :

local settingFile = xmlLoadFile ( "settings.xml" ) 
local node = xmlFindChild(settingFile,"WeaponIDs",0) 
local ids = tostring(xmlNodeGetValue ( node )) 
function forbidWeapons( previousWeaponID, currentWeaponID ) 
    local s,st = string.find(ids,tostring(currentWeaponID) ) 
    if(s) then 
        setTimer(takeWeapon,50,1,source,currentWeaponID) 
    end 
end 
  
addEventHandler ( "onPlayerWeaponSwitch", getRootElement(), forbidWeapons ) 

Please Help me .. how can fix it ?

If u have another script for this function please give me .

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