Scripting A New HUD For Darkrp

Hello Everyone,

I am currently running into an issue i have searched round seen how other developer script Darkrp HUD. However, the problem is that when the client gets jailed within the server the HUD scripts stop running.

The server and the client logs sent me to 2 different lines

I think its might be a way i am calling for the **Clip1 **and the **GetPrintName **but i am unsure. Any ideas ?

Thank you all very much for reading this :smiley:

Martyn

Make sure you check if the weapon is valid first. Being jailed sets your weapon to NULL.


local weapon = LocalPlayer():GetActiveWeapon()

if ( weapon ~= NULL ) then
   draw.DrawText(weapon:GetPrintName(), MainFont, HUD.PosX + 1135, HUD.PosY + 125, HUD.WeaponColor	, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
   draw.DrawText(weapon:Clip1(), MainFont, HUD.PosX + 1355, HUD.PosY + 125, HUD.AmmoColor, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
end

Thank you for replying so quickly Code_gs. It is now working with your line added and a few different changes. Could i ask if ~= means the same as == within c++ ?

Ah thank you smithy that was what i was looking for earlier.

Posted Solve, Thank you all for replying