Results 1 to 8 of 8
  1. #1
    Keepo123's Avatar
    Join Date
    Oct 2015
    Gender
    male
    Location
    m͏̺͓̲̥̪is̷t̞̖͍͚̤k̥B̸̼&#81
    Posts
    84
    Reputation
    10
    Thanks
    163
    My Mood
    Yeehaw

    How to do if health > 100

    So i've been trying to make a godmode for darkrp but there is a problem I have ran into
    Code:
    if ( LocalPlayer():Alive() && LocalPlayer():Health() < 75 ) then
                
    RunConsoleCommand("say", "/buyhealth")
            end
    This will only type "/buyhealth" ONCE how do I make it continuously type "/buyhealth"
    (Obv want to put in my own script will release later)


    Thanks ~ Keepo123
    Last edited by Hunter; 01-17-2016 at 12:49 PM.

  2. #2
    eth0s's Avatar
    Join Date
    Oct 2015
    Gender
    male
    Posts
    188
    Reputation
    10
    Thanks
    1,887
    Put it in another timer using timer.Create or in a think hook

  3. #3
    Keepo123's Avatar
    Join Date
    Oct 2015
    Gender
    male
    Location
    m͏̺͓̲̥̪is̷t̞̖͍͚̤k̥B̸̼&#81
    Posts
    84
    Reputation
    10
    Thanks
    163
    My Mood
    Yeehaw
    Quote Originally Posted by eth0s View Post
    Put it in another timer using timer.Create or in a think hook
    Thanks! I will try and post the results.

    - - - Updated - - -

    Code:
    function DarkRPGodMode()
    if ( LocalPlayer():Alive() && LocalPlayer():Health() < 75 ) then
    	
    			RunConsoleCommand("say", "/buyhealth")
    		end
    	end
    		timer.Create( "TopKek", 0.2, 5, DarkRPGodMode )
    Ayee

    Edit: Think I misunderstod what you ment lmao, can you show me an example with the timer?
    Last edited by Keepo123; 11-12-2015 at 04:56 PM.

  4. The Following User Says Thank You to Keepo123 For This Useful Post:

    buckballs (02-08-2016)

  5. #4
    eth0s's Avatar
    Join Date
    Oct 2015
    Gender
    male
    Posts
    188
    Reputation
    10
    Thanks
    1,887
    the third argument in timer.Create is the amount of times you wanna do the shit in the timer
    https://wiki.garrysmod.com/page/timer/Create

  6. #5
    2cashs's Avatar
    Join Date
    Sep 2015
    Gender
    male
    Location
    Next door to regans pub
    Posts
    15
    Reputation
    10
    Thanks
    14
    Quote Originally Posted by Keepo123 View Post
    So i've been trying to make a godmode for darkrp but there is a problem I have ran into
    Code:
    if ( LocalPlayer():Alive() && LocalPlayer():Health() < 75 ) then
    			
    RunConsoleCommand("say", "/buyhealth")
    		end
    This will only type "/buyhealth" ONCE how do I make it continuously type "/buyhealth"
    (Obv want to put in my own script will release later)


    Thanks ~ Keepo123
    Well, the best way to achieve this is by calling it via the createmove hook

    Here is an example of how you could do this

    Code:
    hook.Add("CreateMove", "AutoHealthStuffs", function()
    	if(LocalPlayer():Health() > 0 && LocalPlayer():Health() < LocalPlayer():GetMaxHealth()) then 
    		RunConsoleCommand("say", "/buyhealth");
    	end
    end)

  7. #6
    snipwnage2's Avatar
    Join Date
    Mar 2015
    Gender
    male
    Posts
    191
    Reputation
    10
    Thanks
    135
    My Mood
    Tired
    Quote Originally Posted by 2cashs View Post
    Well, the best way to achieve this is by calling it via the createmove hook

    Here is an example of how you could do this

    Code:
    hook.Add("CreateMove", "AutoHealthStuffs", function()
    	if(LocalPlayer():Health() > 0 && LocalPlayer():Health() < LocalPlayer():GetMaxHealth()) then 
    		RunConsoleCommand("say", "/buyhealth");
    	end
    end)
    Getting damaged in 1 tick then getting immediately damaged in the next tick is an extremely extremely rare thing to occur which is why a think hook or timer is more appropriate in this situation also more efficient.

  8. #7
    eth0s's Avatar
    Join Date
    Oct 2015
    Gender
    male
    Posts
    188
    Reputation
    10
    Thanks
    1,887
    Quote Originally Posted by 2cashs View Post
    Well, the best way to achieve this is by calling it via the createmove hook

    Here is an example of how you could do this

    Code:
    hook.Add("CreateMove", "AutoHealthStuffs", function()
    	if(LocalPlayer():Health() > 0 && LocalPlayer():Health() < LocalPlayer():GetMaxHealth()) then 
    		RunConsoleCommand("say", "/buyhealth");
    	end
    end)
    createmove is supposed to be used to edit usercmds...

  9. #8
    2cashs's Avatar
    Join Date
    Sep 2015
    Gender
    male
    Location
    Next door to regans pub
    Posts
    15
    Reputation
    10
    Thanks
    14
    Quote Originally Posted by eth0s View Post
    createmove is supposed to be used to edit usercmds...
    Exactly, I know it is

Similar Threads

  1. [Info] Guide on how to not get banned! [NOT 100% sure]
    By Counterstrike1 in forum CrossFire Discussions
    Replies: 15
    Last Post: 07-10-2012, 07:28 PM
  2. HOW TO MAKE MW2 MULTI WORK 100% REAL.
    By thexfiles123 in forum Call of Duty Modern Warfare 2 Discussions
    Replies: 18
    Last Post: 02-08-2010, 02:45 PM
  3. How to delete nexon videos (work 100%)
    By Mary- in forum Combat Arms Discussions
    Replies: 8
    Last Post: 11-06-2009, 12:57 PM
  4. How to make your computer faster. 100% Working
    By superslikuzi in forum General
    Replies: 4
    Last Post: 04-02-2009, 07:23 PM