Hevo_Master
Пользователь
- Регистрация
- 6 Май 2018
- Сообщения
- 7
- Реакции
- 0
- Баллы
- 13
[「.uimodel」|2|STEAM_0:0:60283591] Lua Error:
[ERROR] gamemodes/darkrp/gamemode/modules/hud/cl_hud.lua:140: attempt to call method 'Clip1' (a nil value)
1. Main - gamemodes/darkrp/gamemode/modules/hud/cl_hud.lua:140
2. DrawHUD - gamemodes/darkrp/gamemode/modules/hud/cl_hud.lua:293
3. unknown - gamemodes/darkrp/gamemode/modules/hud/cl_hud.lua:422
Происходит данная ошибка после смерти персонажа.
Сам код:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
138 /**/ if not LocalPlayer():getDarkRPVar( "Arrested" ) then
139 /**/ local mag_left = LocalPlayer():GetActiveWeapon():Clip1()
140 /**/ local mag_extra = LocalPlayer():GetAmmoCount(ply:GetActiveWeapon():GetPrimaryAmmoType())
141 /**/ local wep = ply:GetActiveWeapon()
142 /**/ local wname = wep:GetPrintName()
143 /**/ /// Weapon Info /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////**/
144 /**/ if !IsValid(ply:GetActiveWeapon()) then return end
145 /**/ if (ply:GetActiveWeapon():Clip1() == NULL or ply:GetActiveWeapon() == "Camera") then return end
146 /**/ CPoly(main,ScrW() - 255,ScrH() - 60,220,20,Color(0,0,0,115),30)
147 /**/ draw.DrawText( wname, "main_font", ScrW() - 140,ScrH() - 42, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
148 /**/ if mag_left < 5 then acolor = Color(math.abs(math.sin(CurTime() * 2)) * 255,0,0,115) end
149 /**/ if mag_left < 0 then
150 /**/ return
151 /**/ else
152 /**/ CPoly(main,ScrW() - 255,ScrH() - 92,100,20,acolor,10)
153 /**/ draw.DrawText( mag_left.." / "..mag_extra, "ammo_font", ScrW() - 195,ScrH() - 78, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
154 /**/ end
155 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
156 end
157end
[ERROR] gamemodes/darkrp/gamemode/modules/hud/cl_hud.lua:140: attempt to call method 'Clip1' (a nil value)
1. Main - gamemodes/darkrp/gamemode/modules/hud/cl_hud.lua:140
2. DrawHUD - gamemodes/darkrp/gamemode/modules/hud/cl_hud.lua:293
3. unknown - gamemodes/darkrp/gamemode/modules/hud/cl_hud.lua:422
Происходит данная ошибка после смерти персонажа.
Сам код:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
138 /**/ if not LocalPlayer():getDarkRPVar( "Arrested" ) then
139 /**/ local mag_left = LocalPlayer():GetActiveWeapon():Clip1()
140 /**/ local mag_extra = LocalPlayer():GetAmmoCount(ply:GetActiveWeapon():GetPrimaryAmmoType())
141 /**/ local wep = ply:GetActiveWeapon()
142 /**/ local wname = wep:GetPrintName()
143 /**/ /// Weapon Info /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////**/
144 /**/ if !IsValid(ply:GetActiveWeapon()) then return end
145 /**/ if (ply:GetActiveWeapon():Clip1() == NULL or ply:GetActiveWeapon() == "Camera") then return end
146 /**/ CPoly(main,ScrW() - 255,ScrH() - 60,220,20,Color(0,0,0,115),30)
147 /**/ draw.DrawText( wname, "main_font", ScrW() - 140,ScrH() - 42, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
148 /**/ if mag_left < 5 then acolor = Color(math.abs(math.sin(CurTime() * 2)) * 255,0,0,115) end
149 /**/ if mag_left < 0 then
150 /**/ return
151 /**/ else
152 /**/ CPoly(main,ScrW() - 255,ScrH() - 92,100,20,acolor,10)
153 /**/ draw.DrawText( mag_left.." / "..mag_extra, "ammo_font", ScrW() - 195,ScrH() - 78, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
154 /**/ end
155 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
156 end
157end