Ok so the weird thing about this not working is the fact that it causes no lua errors or anything like that. However, when the command is entered in the chat box it doesn't do anything, it doesn't even say invalid command or anything like that. I'm not quite sure what's wrong since i can't pinpoint the error since it really doesn't cause an error as far as lua's concerned. Here's the bit of lua code that deals with this:
local function BuyAmmo(ply, args)
if args == "" then return "" end
if RPArrestedPlayers[ply:SteamID()] then return "" end
if CfgVars["noguns"] == 1 then
Notify(ply, 1, 4, string.format(LANGUAGE.disabled, "ammo", ""))
return ""
end
if args ~= "rifle" and args ~= "shotgun" and args ~= "pistol" and args ~= "9MM-AMMO"
and args ~= "4.5MM-AMMO" and args ~= "4.6MM-AMMO" and args ~= "5MM-AMMO" and args ~= "5.7MM-AMMO"
and args ~= "3.57MM-AMMO" and args ~= "5.56MM-AMMO" and args ~= "7.62MM-AMMO" then
Notify(ply, 1, 4, string.format(LANGUAGE.unavailable, "ammo"))
return ""
end
if not ply:CanAfford(GetGlobalInt("ammo" .. args .. "cost")) then
Notify(ply, 1, 4, string.format(LANGUAGE.cant_afford, "ammo"))
return ""
end
if args == "rifle" then
ply:GiveAmmo(80, "smg1")
elseif args == "shotgun" then
ply:GiveAmmo(50, "buckshot")
elseif args == "pistol" then
ply:GiveAmmo(50, "pistol")
elseif args == "9MM-AMMO" then
ply:GiveAmmo(50, "ent_mad_ammo_9mm")
elseif args == "4.5MM-AMMO" then
ply:GiveAmmo(50, "ent_mad_ammo_45")
elseif args == "4.6MM-AMMO" then
ply:GiveAmmo(50, "ent_mad_ammo_46mm")
elseif args == "5MM-AMMO" then
ply:GiveAmmo(50, "ent_mad_ammo_50")
elseif args == "5.7MM-AMMO" then
ply:GiveAmmo(50, "ent_mad_ammo_57mm")
elseif args == "3.57MM-AMMO" then
ply:GiveAmmo(50, "ent_mad_ammo_357")
elseif args == "5.56MM-AMMO" then
ply:GiveAmmo(50, "ent_mad_ammo_556mm")
elseif args == "7.62MM-AMMO" then
ply:GiveAmmo(50, "ent_mad_ammo_762mm")
end
local cost = GetGlobalInt("ammo" .. args .. "cost")
Notify(ply, 1, 4, string.format(LANGUAGE.you_bought_x, args, CUR..tostring(cost)))
ply:AddMoney(-cost)
return ""
end
AddChatCommand("/buyammo", BuyAmmo)
Sorry, you need to Log In to post a reply to this thread.