SA-MP Forums Archive
Can't hide HUD with TogglePlayerSpectating? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Can't hide HUD with TogglePlayerSpectating? (/showthread.php?tid=598084)



Can't hide HUD with TogglePlayerSpectating? - Riwerry - 08.01.2016

Hello, I was reading that it is possible to hide hud with TogglePlayerSpectating. I've set it to 1 in OnPlayerConnect, but hud is still showing, so I've created new test gamemode where I have only this and HUD is still shown:

pawn Код:
#include "a_samp"

main()
{
   
}

public OnPlayerConnect(playerid)
{
    TogglePlayerSpectating(playerid, 1);
        return 1;
}



Re: Can't hide HUD with TogglePlayerSpectating? - Darkwood17 - 08.01.2016

I found this:
Код:
new _HUDtimer[MAX_PLAYERS] = {-1, ... };

stock HidePlayerHUD(playerid)
{
     return (_HUDtimer[playerid] = SetTimerEx("RepeatLevel", 1000, 1, "d", playerid));
}

forward public RepeatLevel(playerid);

public RepeatLevel(playerid)
{
   return (SetPlayerDrunkLevel(playerid, 2001)) ;
}

stock ShowPlayerHUD(playerid)
{ 
    if(_HUDtimer[playerid] != -1) KillTimer _HUDtimer[playerid]) ;
}
Credits to RajatPawar for this code.
Simply use HidePlayerHUD(playerid) to hide the hud and ShowPlayerHUD(playerid) to show it again.


Re: Can't hide HUD with TogglePlayerSpectating? - Riwerry - 08.01.2016

Okay, so I've tried drunk level hide method, in code updated drunk level to higher than 5000 according to wiki.
Quote:

While the drunk level is above 5000, the player's HUD (radar etc.) will be hidden.

Still not working, my screen is drunk when I test it, but hud is still on.

//EDIT: Hah I found the problem, problem wasn't in script but I had installed ****** for testing purposes it was blocking it. Thanks.