Author Topic: Hud radar control  (Read 2634 times)

Motley

  • Full Member
  • ***
  • Posts: 253
  • Karma: +32/-34
    • View Profile
Hud radar control
« on: December 07, 2017, 02:31:21 am »
Okay well, There was a stronger reason behind having this.
Code: [Select]
GetHUDItemEnabledIs broken, I originally had this as a method for detections, I wasn't really extremely worried about the scripting method, I just wanted it to work right.

You could redo this to be horizontal if you wanted it to be, Nice snippet for playing with the original hood related data ;)

Code: [Select]
//----------------------------------------------------------

/*
    Turn off all radar related data.
    This system is outdated but we will keep it anywho, never updated
    Used for flashing the origanal radar and much more

*/


class Player_Progress {

/*
    Used as a method to unlock stuff for a player
    But can be used for on/off methods
*/
    // Hud Related
    Radar = false;
    Clock = false;

    Money = false;
    Armour = false;
    Health = false;
    Weapon = false;
    Wanted = false;
    // Hud Related

    function Set_Radar(bool) {
       
        if (bool == true )
        {
            Radar = true;
            ::SetHUDItemEnabled( ::HUD_RADAR, Radar)
        }
        else {
            Radar = false;
            ::SetHUDItemEnabled( ::HUD_RADAR, Radar)
        }
       
    }

    function Set_Armour(bool) {
       
        if (bool == true )
        {
            Armour = true;
            ::SetHUDItemEnabled( ::HUD_ARMOUR, Armour)
        }
        else {
            Armour = false;
            ::SetHUDItemEnabled( ::HUD_ARMOUR, Armour)
        }
       
    }

    function Set_Health(bool) {
       
        if (bool == true )
        {
            Health = true;
            ::SetHUDItemEnabled( ::HUD_HEALTH, Health)
        }
        else {
            Health = false;
            ::SetHUDItemEnabled( ::HUD_HEALTH, Health)
        }
       
    }
   
    function Set_Money(bool) {
       
        if (bool == true )
        {
            Money = true;
            ::SetHUDItemEnabled( ::HUD_MONEY, Money)
        }
        else {
            Money = false;
            ::SetHUDItemEnabled( ::HUD_MONEY, Money)
        }
       
    }
    function Set_Wanted(bool) {
       
        if (bool == true )
        {
            Wanted = true;
            ::SetHUDItemEnabled( ::HUD_WANTED, Wanted)
        }
        else {
            Wanted = false;
            ::SetHUDItemEnabled( ::HUD_WANTED, Wanted)
        }
       
    }
    function Set_Weapon(bool) {
       
        if (bool == true )
        {
            Weapon = true;
            ::SetHUDItemEnabled( ::HUD_WEAPON, Weapon)
        }
        else {
            Weapon = false;
            ::SetHUDItemEnabled( ::HUD_WEAPON, Weapon)
        }
       
    }
    function Set_Clock(bool) {
       
        if (bool == true )
        {
            Clock = true;
            ::SetHUDItemEnabled( ::HUD_CLOCK, Clock)
        }
        else {
            Clock = false;
            ::SetHUDItemEnabled( ::HUD_CLOCK, Clock)
        }
       
    }
}

function onScriptLoad()
{
    // false hide all data
    Player_Progress().Set_Radar(false)
    Player_Progress().Set_Armour(false)
    Player_Progress().Set_Health(false)
    Player_Progress().Set_Money(false)
    Player_Progress().Set_Wanted(false)
    Player_Progress().Set_Weapon(false)
    Player_Progress().Set_Clock(false)

}

Examples are at the bottom on script load

An example of finding out if something is on or off would be
Code: [Select]
print("Your Radar is set to: " + Player_Progress().Radar)

False is off, True is on.

You should probably rename the class as it wouldn't really fit to your usages lol. Unless it's whatever to you :P

Enjoy ;)
« Last Edit: December 07, 2017, 02:33:47 am by Motley »

Motley

  • Full Member
  • ***
  • Posts: 253
  • Karma: +32/-34
    • View Profile
Re: Hud radar control
« Reply #1 on: October 13, 2021, 10:06:19 pm »
Version two
You can now check the status of the on screen related stuff in this version. Added functions for readability. Version one I automatically set the radar related stuff to true so I would know. This version has the ability to check the status since GetHUDItemEnabled doesn't exist.
You should still set the on screen items as you would prefer on load process as player could of reconnected with items half off while you want then on during join.

Also changed from checking/setting the status of bool to direct calling
Code: [Select]
class Player_Progress {

/*
    Used as a method to unlock stuff for a player
    But can be used for on/off methods
*/
    // Hud Related
    Radar = true;
    Clock = true;

    Money = true;
    Armour = true;
    Health = true;
    Weapon = true;
    Wanted = true;
    // Hud Related

//----------------------------------------------------------
    function Set_Radar(bool) {
       
      Radar = bool;
      ::SetHUDItemEnabled( ::HUD_RADAR, Radar)
    }
   
    function Get_Radar() {
      return Radar;
    }
//----------------------------------------------------------

    function Set_Armour(bool) {
       
      Armour = bool;
      ::SetHUDItemEnabled( ::HUD_ARMOUR, Armour)
    }

    function Get_Armour() {
      return Armour;
    }
//----------------------------------------------------------
    function Set_Health(bool) {
      Health = bool;
      ::SetHUDItemEnabled( ::HUD_HEALTH, Health)
    }

    function Get_Health() {
      return Health;
    }
//----------------------------------------------------------
    function Set_Money(bool) {
     
      Money = bool;
      ::SetHUDItemEnabled( ::HUD_MONEY, Money)
    }
    function Get_Money() {
      return Money;
    }
//----------------------------------------------------------
    function Set_Wanted(bool) {
       
      Wanted = bool;
      ::SetHUDItemEnabled( ::HUD_WANTED, Wanted)
    }
function Get_Wanted() {
      return Wanted;
}     
//----------------------------------------------------------
    function Set_Weapon(bool) {
       
      Weapon = bool;
      ::SetHUDItemEnabled( ::HUD_WEAPON, Weapon)
    }
    function Get_Weapon() {
      return Weapon;
    }     
//----------------------------------------------------------
    function Set_Clock(bool) {
       
      Clock = bool;
      ::SetHUDItemEnabled( ::HUD_CLOCK, Clock)
    }
    function Get_Clock() {
      return Clock;
    }     
}

 

© Liberty Unleashed Team.