local bodyarmormodel = ClientsideModel( "models/props_c17/column02a.mdl" )
bodyarmormodel:SetNoDraw( true )
hook.Add( "PostPlayerDraw", "armordraw", function(ply)
if not IsValid(ply) or not ply:Alive() then return end
local attach_id = ply:LookupAttachment( "chest" )
if not attach_id then return end
local attach = ply:GetAttachment( attach_id )
if not attach then return end
local pos = attach.Pos
local ang = attach.Ang
bodyarmormodel:SetModelScale(0.1, 0)
pos = pos + ( ang:Forward() * -4 )
ang:RotateAroundAxis( ang:Right(), 0 )
bodyarmormodel:SetPos( pos )
bodyarmormodel:SetAngles( ang )
bodyarmormodel:SetRenderOrigin( pos )
bodyarmormodel:SetRenderAngles( ang )
bodyarmormodel:SetupBones()
bodyarmormodel:DrawModel()
bodyarmormodel:SetRenderOrigin()
bodyarmormodel:SetRenderAngles()
end )
That is my clientside code which is in autorun.
The error is:
[ERROR] addons/minecraft/lua/autorun/cl_armordraw.lua:1: attempt to call global 'ClientsideModel' (a nil value)
1. unknown - addons/minecraft/lua/autorun/cl_armordraw.lua:1
But it seems to work fine, I'm not sure how to change the code to make it work (I've taken this snippet from the pubg gamemode)
This script is running on the shared state, ClientsideModel is a client side method. The error is coming from the server because ClientsideModel does not exist on the server state.
Make a new folder called "client" in the "autorun" folder and put "cl_armordraw.lua" in "client".
References:
States
ClientsideModel
oh i thought cl_ meant it became clientside, thx ill try this
Sorry, you need to Log In to post a reply to this thread.