--MOD BELOW
needsmenu = {}
for userid = 1, _MaxPlayers() do
needsmenu[ userid ] = 1
-- ULib.tsay(0,"needsmenu table is set.")
end
--[[ Currently Unused
function setneeds(userid)
if not needsmenu[userid] then
ULib.tsay(0,_PlayerInfo(userid,"name") .. " already has the menu.")
return
else
-- If he already got the menu, he doesnt need it again
ULib.tsay(0,_PlayerInfo(userid,"name") .. " needs the menu.")
needsmenu[userid] = true
giveneeds(userid)
end
end
]]--
function wait2(userid)
if needsmenu[userid] >= 1 then
AddTimer(2,0,giveneeds,userid)
end
end
function giveneeds(userid)
if _PlayerInfo(userid, "connected") then
--[[ if needsmenu[userid] >= 2 then
ULib.tsay(userid,_PlayerInfo(userid,"name") .. ", the next time you die and spawn you will receive the eSWEP menu.")
if ULib.mainUcl:query(userid,ACCESS_MENU) then ULib.tsay(userid,"BTW, you will get the admin menu") end
needsmenu[userid] = needsmenu[userid] - 1 ]]--
if needsmenu[userid] == 1 then
-- ULib.tsay(0,_PlayerInfo(userid,"name") .. " is being sent the client menu")
eSWEP.sendclient(userid)
if ULib.mainUcl:query(userid, ACCESS_MENU) then
-- ULib.tsay(0,_PlayerInfo(userid,"name") .. " has access and is being sent the menu.")
eSWEP.sendadmin(userid)
needsmenu[userid] = 0
else
-- ULib.tsay(0,_PlayerInfo(userid,"name") .. " doesn't have access and isn't getting the menu")
needsmenu[userid] = 0
end
elseif needsmenu[userid] == 0 then
-- ULib.tsay(userid,"You already have the menu!")
end
end
end
function nomoreneeds(name,userid)
-- ULib.tsay(0,name .. " has disconnected, resetting the table for that userid")
needsmenu[userid] = 2
end
CONCOMMAND("eSWEPcrate", cc_eSWEPcrate)
CONCOMMAND("eSWEPspawn", cc_eSWEPspawn)
CONCOMMAND("eSWEP_resend", cc_eSWEP_resend)
HookEvent("eventPlayerSpawn", wait2)
HookEvent("eventPlayerDisconnect", nomoreneeds)