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

Counting players for trigger distance

broken avatar :(
Created 7 years ago
by rapto
0 Members and 1 Guest are viewing this topic.
1,616 views
broken avatar :(
×
broken avatar :(
Location: ca
Date Registered: 25 May 2016
Last active: 7 years ago
Posts
17
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
rapto's Groups
rapto's Contact & Social Linksrapto-jp
The title says the problem, but I'll elaborate here.
You purchase the trigger, but sadly it connects everyone to an absolute no matter what distances the players are to the boat. Me and my friend have been trying to figure out a way to get_players then count them and implement them into the if functions to allow all the players to get on ONLY IF they are in distance to the trigger use. Have had no luck in doing so, if anyone can help, it'd be appreciated.
Last Edit: July 10, 2017, 04:33:31 am by rapto
Marked as best answer by rapto 7 years ago
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 1 year ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
Signature
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntstuffy@BluntZombieBluntStuffyStuffyZombie
Code Snippet
Plaintext
	// get your trigger
boat_trig = getent ....

// get the players
players = get_players();

// all players in the game are now in the array
for( i=0 ; i<players.size ; i++ )
{
// if a player is downed, skip him
if( players[i] maps\_laststand::player_is_in_laststand() )
{
continue;
}

if( distance( players[i].origin, boat_trig.origin ) < 50 )
{
// do what you want here to  players that are closer then 50 units to the trigger
players[i] thread enter_boat();
}
}
broken avatar :(
×
broken avatar :(
Location: ca
Date Registered: 25 May 2016
Last active: 7 years ago
Posts
17
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
rapto's Groups
rapto's Contact & Social Linksrapto-jp
Code Snippet
Plaintext
	// get your trigger
boat_trig = getent ....

// get the players
players = get_players();

// all players in the game are now in the array
for( i=0 ; i<players.size ; i++ )
{
// if a player is downed, skip him
if( players[i] maps\_laststand::player_is_in_laststand() )
{
continue;
}

if( distance( players[i].origin, boat_trig.origin ) < 50 )
{
// do what you want here to  players that are closer then 50 units to the trigger
players[i] thread enter_boat();
}
}

I cannot thank you enough. I have added +1 respect, you really show why your respect is higher than your posts.

 
Loading ...