Attempted to create unknown entity type csgo_bowie_slaughter! NULL Ent in GiveNamedItem! Recieved cs
3 replies, posted
So I am trying to make a system that gives me a random skin for a knife when I enter a command. It definitely reads the list, because it prints what I got, but it doesn't actually give me the knife, here is the error it gives me:
[LUA]
Attempted to create unknown entity type csgo_bowie_slaughter! NULL Ent in GiveNamedItem!
[/LUA]
Here is all of my code:
init.lua
[LUA]
if SERVER then
include("sh_init.lua")
end
if CLIENT then
include("cl_init.lua")
end
[/LUA]
cl_init.lua
[LUA]
include("shared.lua")
ply = LocalPlayer()
if ply:IsUserGroup("VIP") then
WalletMax = 15
else
if ply:IsUserGroup("VIP+") then
WalletMax = 20
else
WalletMax = 10
end
end
function SetupDataTables()
self:NetworkVar( "String", 1, "keys")
self:NetworkVar( "String", 2, "WalletMax")
end
keys = file.Read("keys.txt")
if keys == nil then
keys = 0
file.Write( "keys.txt", keys )
end
if keys != 0 then
keys = file.Read("keys.txt")
end
function KeyTimerFunc()
timer.Create( "KeyTimer", 1, 0, 0, AddKey())
end
function AddKey()
--default time is 3 hours, or 216000
if keys == WalletMax then
Entity( 1 ):PrintMessage( HUD_PRINTTALK, "Key Wallet Full!" )
timer.Stop("KeyTimer")
else
keys = keys + 1
timer.Start("KeyTimer")
file.Write( "keys.txt", keys )
end
end
hook.Add( "Initialize", KeyTimerFunc )
hook.Add( "HUDPaint", HUDDraw)
function HudDraw()
draw.DrawText( keys.." Keys", "TargetID", 50, 15, Color( 0, 0, 0, 255 ), TEXT_ALIGN_CENTER )
draw.RoundedBox( 10, 20, 10, 60, 30, Color( 0, 0, 0, 100 ) ) -- Draw a blue button
end
concommand.Add( "AddKeys", function()
if keys == WalletMax then
Entity( 1 ):PrintMessage( HUD_PRINTTALK, "Key Wallet Full!" )
else
keys = keys + 1
file.Write( "keys.txt", keys )
end
end )
concommand.Add( "AddFiveKeys", function()
if keys == WalletMax then
Entity( 1 ):PrintMessage( HUD_PRINTTALK, "Key Wallet Full!" )
else
keys = keys + 5
if keys > WalletMax then
keys = keys - 5
end
file.Write( "keys.txt", keys )
end
end )
concommand.Add( "ClearKeys", function()
keys = 0
file.Write( "keys.txt", keys )
end )
concommand.Add( "OpenMenu", function()
local Frame = vgui.Create( "DFrame" )
Frame:SetTitle( "Advanced Knife System" )
Frame:SetSize( 300, 300 )
Frame:Center()
Frame:MakePopup()
Frame.Paint = function( self, w, h ) -- 'function Frame:Paint( w, h )' works too
draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 255 ) ) -- Draw a red box instead of the frame
end
local Button = vgui.Create( "DButton", Frame )
Button:SetText( "Use Key" )
Button:SetTextColor( Color( 255, 255, 255 ) )
Button:SetPos( 100, 100 )
Button:SetSize( 100, 30 )
Button.Paint = function( self, w, h )
draw.RoundedBox( 0, 0, 0, w, h, Color( 41, 128, 185, 250 ) ) -- Draw a blue button
end
Button.DoClick = function()
if keys == 0 then
Entity( 1 ):PrintMessage( HUD_PRINTTALK, "Not enough keys." )
else
hook.Call("GiveSkinH")
end
end
end )
[/LUA]
sh_init.lua
[LUA]
//hi
include("shared.lua")
skins = file.Read("allknives.txt")
tbl = string.Explode( '\n', skins, false )
concommand.Add("GiveMeTheGun", function(ply, recievedskin)
recievedskin = table.Random( tbl )
ply:Give( recievedskin )
ply:PrintMessage( HUD_PRINTTALK, "Recieved "..recievedskin.."!" )
end)
[/lua]
shared.lua
[lua]
function GiveSkin()
RunConsoleCommand("GiveMeTheGun")
keys = keys - 1
file.Write( "keys.txt", keys )
Entity( 1 ):PrintMessage( HUD_PRINTTALK, "Used 1 Key!" )
end
hook.Add("GiveSkinH", GiveSkin)
[/lua]
There is probaly no weapon named csgo_bowie_slaughter
[QUOTE=rtm516;50739122]There is probaly no weapon named csgo_bowie_slaughter[/QUOTE]
there should be if I have the addon installed, right?
[QUOTE=obesewhale;50739150]there should be if I have the addon installed, right?[/QUOTE]
Maybe the weapon in the addon is not called exactly "csgo_bowie_slaughter".
Sorry, you need to Log In to post a reply to this thread.