d43dr4 Posted December 2, 2012 Posted December 2, 2012 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 .
50p Posted December 2, 2012 Posted December 2, 2012 You can use split: ... local forbiddenIDs = split( ids, "," ); for i, ID in ipairs( forbiddenIDs ) do if tonumber( ID ) == currentWeaponID then -- take his weapon end end ...
d43dr4 Posted December 2, 2012 Author Posted December 2, 2012 Doesn't work .. Thx anyway Waiting for another script !
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