UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

How to detect if a player is down

broken avatar :(
Created 7 years ago
by Big-Beautiful
0 Members and 1 Guest are viewing this topic.
2,689 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 25 May 2015
Last active: 5 years ago
Posts
31
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
Personal Quote
i hate mei
Signature
Must be kept sacred, heavenly eggs
Mustn’t be desecrated with egg bootlegs
×
Big-Beautiful's Groups
Big-Beautiful's Contact & Social Linksfortress-of-branitude
So I'm trying a bunch of ways for a script to detect if the player is down. One of the ways is this function that runs whenever I shoot a trigger.

Code Snippet
Plaintext
function test()
{
if (self NeedsRevive(false))
{
IPrintLnBold("chunga");
}
if (self NeedsRevive(true))
{
IPrintLnBold("not chunga");
}
}

The problem is that whenever I shoot it, down or not, both messages appear at the same time and I don't know what this means
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 12 September 2016
Last active: 3 years ago
Posts
306
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
×
reckfullies's Groups
reckfullies's Contact & Social LinksReckfulliesReckfullies
So I'm trying a bunch of ways for a script to detect if the player is down. One of the ways is this function that runs whenever I shoot a trigger.

Code Snippet
Plaintext
function test()
{
if (self NeedsRevive(false))
{
IPrintLnBold("chunga");
}
if (self NeedsRevive(true))
{
IPrintLnBold("not chunga");
}
}

The problem is that whenever I shoot it, down or not, both messages appear at the same time and I don't know what this means

Use this:
Code Snippet
Plaintext
// Add this at top of script \\
#using scripts\shared\laststand_shared;

// Add this in your function \\
if(self laststand::player_is_in_laststand())
{
// If player is down, do something
}
else
{
// If player is not down, do something else
}
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 25 May 2015
Last active: 5 years ago
Posts
31
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
Personal Quote
i hate mei
×
Big-Beautiful's Groups
Big-Beautiful's Contact & Social Linksfortress-of-branitude
I've added the using script and the if statement, but it isn't working

Code Snippet
Plaintext
function test()
{
if (self laststand::player_is_in_laststand())
{
IPrintLnBold("testing you are down");
}
else
{
IPrintLnBold("testing you are not down");
}
}

It prints the message, "testing you are up" when im down or up and it ignores the "else" statement. I don't see the problem. I appreciate all the help you've been giving me btw, you the real mvp  :)
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 12 September 2016
Last active: 3 years ago
Posts
306
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
×
reckfullies's Groups
reckfullies's Contact & Social LinksReckfulliesReckfullies
I've added the using script and the if statement, but it isn't working

Code Snippet
Plaintext
function test()
{
if (self laststand::player_is_in_laststand())
{
IPrintLnBold("testing you are down");
}
else
{
IPrintLnBold("testing you are not down");
}
}

It prints the message, "testing you are up" when im down or up and it ignores the "else" statement. I don't see the problem. I appreciate all the help you've been giving me btw, you the real mvp  :)

It must be a problem with the rest of your script, can you show me the entire thing like where you are calling the function on a player.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 25 May 2015
Last active: 5 years ago
Posts
31
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
Personal Quote
i hate mei
×
Big-Beautiful's Groups
Big-Beautiful's Contact & Social Linksfortress-of-branitude
Code Snippet
Plaintext
#using scripts\shared\laststand_shared;

#using scripts\zm\_zm_perks;
#insert scripts\zm\_zm_perks.gsh;

function init()
{
//These are the starting varibles for the perk locations
    level.shoot_quick_revive = 1;
    level.shoot_juggernog = 1;
    level.shoot_sleight_of_hand = 1;
    level.shoot_doubletap2 = 1;
    level.shoot_staminup = 1;
    level.shoot_dead_shot = 1;
    level.shoot_electric_cherry = 1;
    level.shoot_widows_wine = 1;
    level.shoot_additional_primary_weapon = 1;

    level thread shootable_perk_quick();
/*
    level thread shootable_perk_jug();
   
    level thread shootable_perk_sleight();

    level thread shootable_perk_double();

    level thread shootable_perk_staminup();

    level thread shootable_perk_dead();

    level thread shootable_perk_electric();

    level thread shootable_perk_add();

    level thread shootable_perk_widows();
*/

}

//*****************************************************************************
// QUICK REVIVE
//*****************************************************************************

function shootable_perk_quick(player)
{
    trig_quick = GetEnt("perktrig_quick", "targetname");
    model_quick = GetEnt("perkmod_quick", "targetname");

    trig_quick SetHintString("");
    trig_quick SetCursorHint("HINT_NOICON");

    while(1)
    {
    while(1)
    {
        trig_quick waittill("trigger", player);
        thread test();

        if (player HasPerk(PERK_QUICK_REVIVE))
{
IPrintLn("no no no you can not have the perko");

player playsound("Chinese_1");
wait(0.1);

}

else
{
        IPrintLn("your pals go up fast now");
player zm_perks::give_perk( PERK_QUICK_REVIVE, false );
player playsound("Chinese_1");
thread perk_quick_phase();
//thread perk_quick_location();
break;
}
    }
    }
}
//Tells which of the three locations the perk is in
function perk_quick_phase()
{

if (level.shoot_quick_revive >= 3)
{
level.shoot_quick_revive-= 2;
IPrintLn("i am now " + level.shoot_quick_revive );
}
else
{
level.shoot_quick_revive++;
IPrintLn("i am now " + level.shoot_quick_revive );
}
}
function test()
{
if (self laststand::player_is_in_laststand())
{
IPrintLnBold("testing you are down");
}
else
{
IPrintLnBold("testing you are not down");
}
}
Marked as best answer by Big-Beautiful 7 years ago
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 4 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Signature
Donate to me if you enjoy my work. https://www.paypal.me/thezombiekilla6
×
Dust's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Dust's Contact & Social LinksMrZ0mbiesFanaticdust103194MrZ0mbiesFanatic
You should call the thread test() on the player, so it will define what self is in the test() function.

Code Snippet
Plaintext
player thread test();


That is most likely why it is failing
Last Edit: October 27, 2016, 02:12:50 pm by Dust

 
Loading ...