simple level system, i can make they block weapon for certain level?
0 replies, posted
the simple level system only show level...xp.. and anymore
i can make they block sandbox weapons type RPG,AR2.. Crossbow to certain level ?
[url]http://steamcommunity.com/sharedfiles/filedetails/?id=856490057[/url]
type player try get a weapon and print msg "you need be level 40 to unlock"
and i want make appear in scoreboard(i use sui scoreboard)
type [url]http://imgur.com/a/QaO5x[/url]
i need help, i don't know much about lua, only the basic,
I'm working night and day so my server is the best in Brazil,
And it is thanks to you that help me here that I am getting.
:)
IF be need i can past the addon here
cl_init.lua
[CODE]
surface.CreateFont( "FontBig", {
font = "Bebas Neue",
size = 30,
weight = 0,
antialias = true
} )
surface.CreateFont( "FontNormal", {
font = "Bebas Neue",
size = 24,
weight = 0,
antialias = true
} )
local function HUD()
local level = LocalPlayer():GetLevel() or 1
local exp = LocalPlayer():GetExp() or 0
local prestige = LocalPlayer():GetPrestige() or 0
local maxexp = Exp.Levels[level].ReqExp and Exp.Levels[level].ReqExp or 0
local percentage = (exp/maxexp)*100
local length = (Hud_Bar.BgLength)/100*percentage
draw.RoundedBox( 0, Hud_Bar.BgPosW, Hud_Bar.BgPosH, Hud_Bar.BgLength, Hud_Bar.BgHeight, Hud_Bar.BgColor )
draw.SimpleText( "c", "marlett", Hud_Bar.BgPosW, Hud_Bar.BgPosH, color_white )
draw.SimpleText( "f", "marlett", Hud_Bar.BgPosW + Hud_Bar.BgLength - 13, Hud_Bar.BgPosH + 17, color_white )
if length < 5 then
draw.RoundedBox( 0, Hud_Bar.FgPosW, Hud_Bar.FgPosH, length + 5, Hud_Bar.FgHeight, Hud_Bar.FgColor )
draw.RoundedBox( 0, Hud_Bar.FgPosW, Hud_Bar.FgPosH, length + 5, Hud_Bar.FgHeight - 15, Hud_Bar.FgColor )
else
draw.RoundedBox( 0, Hud_Bar.FgPosW, Hud_Bar.FgPosH, length - 7, Hud_Bar.FgHeight, Hud_Bar.FgColor )
draw.RoundedBox( 0, Hud_Bar.FgPosW, Hud_Bar.FgPosH, length - 7, Hud_Bar.FgHeight - 15, Hud_Bar.FgColor )
end
if prestige > 0 then
draw.SimpleText( "Level: " .. level .. " (" .. prestige .. ")", "FontNormal", Hud_Bar.TextLvlPosW, Hud_Bar.TextLvlPosH, Hud_Bar.TextLvlColor, Hud_Bar.TextLvlAlign, Hud_Bar.TextLvlAlign )
else
draw.SimpleText( "Level: " .. level, "FontNormal", Hud_Bar.TextLvlPosW, Hud_Bar.TextLvlPosH, Hud_Bar.TextLvlColor, Hud_Bar.TextLvlAlign, Hud_Bar.TextLvlAlign )
end
draw.SimpleText( exp .. "/" .. maxexp, "FontBig", Hud_Bar.TextExpPosW, Hud_Bar.TextExpPosH, Hud_Bar.TextExpColor, Hud_Bar.TextExpAlign, Hud_Bar.TextExpAlign )
end
hook.Add( 'HUDPaint', 'HUD', HUD )
[/CODE]
sv_init.lua
[CODE]
util.AddNetworkString( "ExpMsg" )
util.AddNetworkString( "ExpNotify" )
local function Init()
local file, dir = file.Find( "perks/*.lua", "LUA" )
for _, files in pairs( file ) do
include( "perks/" .. files )
end
local query = "CREATE TABLE IF NOT EXISTS experience ( steamid varchar(20), prestige int, level int, exp int )"
local result = sql.Query( query )
end
hook.Add( 'Initialize', 'Init', Init )
local function Check( ply )
CheckPlayer( ply )
if Exp.Config.UseTimer then
timer.Create( "GiveExp_" .. ply:UniqueID(), Exp.Config.ExpInterval * 60, 0, function()
ply:GiveExp( Exp.Config.ExpPerMinutes )
end )
end
end
hook.Add( 'PlayerInitialSpawn', 'FirstSpawn', Check )
local function SaveOnDisc( ply )
if timer.Exists( "GiveExp_" .. ply:UniqueID() ) then timer.Destroy( "GiveExp_" .. ply:UniqueID() ) end
ply:Save()
MsgN( "[Experience] Saved " .. ply:Nick() )
end
hook.Add( 'PlayerDisconnected', 'SavePlayer', SaveOnDisc )
local function OnKill( victim, weapon, killer )
local exp = 0
if #player.GetAll() < Exp.Config.MinPlayers then return end
if not Exp.Config.ExpOnKills then return end
if killer:IsPlayer() and victim:IsPlayer() and killer ~= victim then
if Exp.Config.Gamemode == 1 then
if GetRoundState() == ROUND_POST then return end
if killer:IsRole( ROLE_TRAITOR ) and victim:IsRole( ROLE_INNOCENT ) then
exp = Exp.Config.InnoKillExp
elseif killer:IsRole( ROLE_TRAITOR ) and victim:IsRole( ROLE_DETECTIVE ) then
exp = Exp.Config.DeteKillExp
elseif killer:IsRole( ROLE_INNOCENT ) and victim:IsRole( ROLE_TRAITOR ) then
exp = Exp.Config.TraitorKillExp
elseif killer:IsRole( ROLE_DETECTIVE ) and victim:IsRole( ROLE_TRAITOR ) then
exp = Exp.Config.TraitorKillExp
end
if exp > 0 then
killer:GiveExp( exp )
end
else
killer:GiveExp( Exp.Config.Exp )
end
end
end
hook.Add( 'PlayerDeath', 'GiveExp', OnKill )
[/CODE]
have more files [url]http://imgur.com/a/4ZMC0[/url]
[url]http://imgur.com/a/0fH8x[/url]
Sorry, you need to Log In to post a reply to this thread.