I got this code from someone and i keep getting a usermessage error. Here is the code:
serverside
[lua]
AddCSLuaFile("client/cl_debuff.lua")
local CONFIG_NMSPEED = 240
local CONFIG_NRSPEED = 160
local CONFIG_MSPEED = CONFIG_NMSPEED/2
local CONFIG_RSPEED = CONFIG_NRSPEED/2
hook.Add("PlayerDeath","co2_debuff+redscreen",function(p)
if p:IsSuperAdmin() then return true end
p.co2_debuff = true
p:SetNWBool("g_redscreen",true)
umsg.Start("g_redscreen",p);
umsg.Bool(true);
umsg.End();
end)
hook.Add("PlayerSpawn","co2_debuff&redscreen",function(p)
if p.co2_debuff and not p:IsSuperAdmin() then
p.co2_debuffat = CurTime()+60
timer.Simple(0.1,function()
if IsValid(p) then
p:SetWalkSpeed(CONFIG_MSPEED)
p:SetRunSpeed(CONFIG_RSPEED)
p:StripWeapons()
p:ChatPrint("You've turned into a ghost.")
end
end)
timer.Simple(60,function()
if IsValid(p) and p.co2_debuffat <= CurTime() then
p.co2_debuff = false
p:SetWalkSpeed(CONFIG_NMSPEED)
p:SetRunSpeed(CONFIG_NRSPEED)
p:Spawn()
p:ChatPrint("You are no longer a ghost.")
umsg.Start("g_redscreen",p);
umsg.Bool(false);
umsg.End();
end
end)
end
end)
hook.Add("PlayerCanPickupItem","co2_debuff_pickup",function(p)
if p.g_debuff then return false end
end)
hook.Add("PlayerCanPickupWeapon","co2_debuff_pickup",function(p)
if p.g_debuff then return false end
end)
[/lua]
and then client side
[lua]
if CLIENT then
LOLREDSCREEN = true
usermessage.Hook("g_redscreen",function( um )
LOLREDSCREEN = um:ReadBool()
end)
hook.Add("HUDPaint","g_debuff",function()
if LOLREDSCREEN then
surface.SetDrawColor(255,0,0,100)
surface.DrawRect(0,0,ScrW(),ScrH())
end
end)
end
[/lua]
Please Help! I would like to have my server up by tonight.
doesn't look broken to me... Where are you putting these files, and are they included properly?
Sorry, you need to Log In to post a reply to this thread.