• My code doesn't work : Lua errror
    7 replies, posted
Hello My code for bute to display the rank of the person [CODE]surface.CreateFont("Douille", { font = "Arial", size = 27.5, weight = 600, antialias = true, }) hook.Add( "HUDPaint", "Years") if ( Player( 2 ):IsUserGroup( "superadmin" ) ) then local e = LocalPlayer():GetEyeTrace().Entity if !( e and e:IsValid() and e:IsPlayer() ) then return end local pos = e:GetPos() pos.z = pos.z + 61 pos = pos:ToScreen() draw.SimpleText( "Fondator", "Douille", pos.x, pos.y, Color( 255, 253, 0, 255 ) ) end [/CODE] Lua error : [ERROR] lua/autorun/client/hud_grp.lua:22: attempt to call method 'IsUserGroup' (a nil value) 1. unknown - lua/autorun/client/hud_grp.lua:22 [Douille'|6|STEAM_0:1:95882178] Lua Error: [ERROR] lua/autorun/client/hud_grp.lua:22: attempt to call method 'IsUserGroup' (a nil value) 1. unknown - lua/autorun/client/hud_grp.lua:22 Thank's you for helping x)
what defines "Player(2)"?
Whole code is just bad. Here: [CODE]surface.CreateFont("Douille", { font = "Arial", size = 27.5, weight = 600, antialias = true, }) hook.Add( "HUDPaint", "Years", function() if ( LocalPlayer():IsUserGroup( "superadmin" ) ) then local e = LocalPlayer():GetEyeTrace().Entity if !( IsValid( e ) and e:IsPlayer() ) then return end local pos = e:GetPos() pos.z = pos.z + 61 pos = pos:ToScreen() draw.SimpleText( "Fondator", "Douille", pos.x, pos.y, Color( 255, 253, 0, 255 ) ) end ) [/CODE]
[QUOTE=Robotboy655;48401423]Whole code is just bad. Here: [CODE]surface.CreateFont("Douille", { font = "Arial", size = 27.5, weight = 600, antialias = true, }) hook.Add( "HUDPaint", "Years", function() if ( LocalPlayer():IsUserGroup( "superadmin" ) ) then local e = LocalPlayer():GetEyeTrace().Entity if !( IsValid( e ) and e:IsPlayer() ) then return end local pos = e:GetPos() pos.z = pos.z + 61 pos = pos:ToScreen() draw.SimpleText( "Fondator", "Douille", pos.x, pos.y, Color( 255, 253, 0, 255 ) ) end ) [/CODE][/QUOTE] Yes it's work but : Fondator that mark even if the person is user . Thank's you :) [editline]7th August 2015[/editline] no body ?
No people ? I need help pleas..... Thanks ;)
[QUOTE=Douille2113;48402846]No people ? I need help pleas..... Thanks ;)[/QUOTE] I'm guessing you want it to display 'Fondator' on anyone in the superadmin usergroup? [code] surface.CreateFont("Douille", { font = "Arial", size = 27.5, weight = 600, antialias = true, }) hook.Add("HUDPaint", "fondatormeansfounder", function() local e = LocalPlayer():GetEyeTrace.Entity if !(IsValid(e) and e:IsPlayer() and e:IsUserGroup("superadmin")) then return end local pos = e:GetPos() pos.z = pos.z + 61 pos = pos:ToScreen() draw.SimpleText("Fondator", "Doulle",pos.x,pos.y,Color(255,253,0,255)) end) [/code] If not (And you want to display 'Fondator' on every player if you're superadmin.. (why)), Robotboy forgot an end: [code] surface.CreateFont("Douille", { font = "Arial", size = 27.5, weight = 600, antialias = true, }) hook.Add( "HUDPaint", "Years", function() if ( LocalPlayer():IsUserGroup( "superadmin" ) ) then local e = LocalPlayer():GetEyeTrace().Entity if !( IsValid( e ) and e:IsPlayer() ) then return end local pos = e:GetPos() pos.z = pos.z + 61 pos = pos:ToScreen() draw.SimpleText( "Fondator", "Douille", pos.x, pos.y, Color( 255, 253, 0, 255 ) ) end end ) [/code]
[QUOTE=Coffeee;48403134]I'm guessing you want it to display 'Fondator' on anyone in the superadmin usergroup? [code] surface.CreateFont("Douille", { font = "Arial", size = 27.5, weight = 600, antialias = true, }) hook.Add("HUDPaint", "fondatormeansfounder", function() local e = LocalPlayer():GetEyeTrace.Entity if !(IsValid(e) and e:IsPlayer() and e:IsUserGroup("superadmin")) then return end local pos = e:GetPos() pos.z = pos.z + 61 pos = pos:ToScreen() draw.SimpleText("Fondator", "Doulle",pos.x,pos.y,Color(255,253,0,255)) end) [/code] If not (And you want to display 'Fondator' on every player if you're superadmin.. (why)), Robotboy forgot an end: [code] surface.CreateFont("Douille", { font = "Arial", size = 27.5, weight = 600, antialias = true, }) hook.Add( "HUDPaint", "Years", function() if ( LocalPlayer():IsUserGroup( "superadmin" ) ) then local e = LocalPlayer():GetEyeTrace().Entity if !( IsValid( e ) and e:IsPlayer() ) then return end local pos = e:GetPos() pos.z = pos.z + 61 pos = pos:ToScreen() draw.SimpleText( "Fondator", "Douille", pos.x, pos.y, Color( 255, 253, 0, 255 ) ) end end ) [/code][/QUOTE] I want people to see the founder above the head of a superadmin . and not of a user
[QUOTE=Douille2113;48403403]I want people to see the founder above the head of a superadmin . and not of a user[/QUOTE] Yeah, which is what the first code I posted does edit: you're fucking welcome
Sorry, you need to Log In to post a reply to this thread.