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
[QUOTE]
local Currentweapon = LocalPlayer():GetActiveWeapon():GetPrintName()
local mag_left = LocalPlayer():GetActiveWeapon():Clip1()
draw.DrawText(Currentweapon, MainFont, HUD.PosX + 1135, HUD.PosY + 125, HUD.WeaponColor , TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
draw.DrawText(mag_left, MainFont, HUD.PosX + 1355, HUD.PosY + 125, HUD.AmmoColor, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
[/QUOTE]
I think its might be a way i am calling for the [B]Clip1 [/B]and the [B]GetPrintName [/B]but i am unsure. Any ideas ?
Thank you all very much for reading this :D
Martyn
Make sure you check if the weapon is valid first. Being jailed sets your weapon to NULL.
[code]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[/code]
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++ ?
[QUOTE=MartynFitz;51008994]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++ ?[/QUOTE]
[url]https://wiki.garrysmod.com/page/Specific_Operators[/url]
Ah thank you smithy that was what i was looking for earlier.
Posted Solve, Thank you all for replying
Sorry, you need to Log In to post a reply to this thread.