Jump to content

help


TorNix~|nR

Recommended Posts

Posted

Guys, in this code, the " inValidWeapons " disabled the weapons for the panel

I want to disabled it only for the players, not for the source

help please

local inValidWeapons = {[1] = true , [4] = true , [5] = true , [8] = true , [9] = true , [38] = true , [34] = true , [36] = true ,  [37] = true}

addEvent("AdminPanel.giveWeap", true)
function giveWeap(plr, getText) 
	if plr and isElement(plr) then 
		if getText then 
			local wep = getWeaponIDFromName(getText)
			if not wep then
				wep = getText
			end 
                if inValidWeapons[tonumber(wep)] then
				return 
			end
			local ammo = ((plr == client) and 5000) or 90
                        giveWeapon(plr, wep, ammo, true)
		end 
	end 
end 
addEventHandler("AdminPanel.giveWeap", root, giveWeap)

 

76561198387870432.png

ZI ZOMBIE INFECTION: mtasa://5.196.7.163:22003

560x95_FFFFFF_FF9900_000000_000000.png

  • Moderators
Posted

Do you want it disabled only for players, not admins? By source do you mean an admin calling this event?

If so you can do this

if inValidWeapons[tonumber(wep)] and (client ~= plr) then
	return 
end

It's the same you do for ammo to give 5000 ammo instead of 90

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