Author Topic: Hud radar control  (Read 2645 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 »

 

© Liberty Unleashed Team.