Raised This Month: $51 Target: $400
 12% 

Get_players repetition


Post New Thread Reply   
 
Thread Tools Display Modes
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-23-2016 , 19:25   Re: Get_players repetition
Reply With Quote #11

What opinion you have about this one:

Code:
/*     This stock return all the players Id's based on 'flags' and 'team' you've set it up.     Note: team's string:         "CT" or "TERRORISTS"     Note2: for using second parameter you would need to add the flag "e".     Like this: GetPlayersId( "ae", "CT" ); */ GetPlayersId( flags[]="" , team[]="" ) {     new gPlayers[32], gPlayersCount, PlayerIndexes;       if( contain( flags, "e" ) > -1 )         get_players( gPlayers, gPlayersCount, flags, team)     else         get_players( gPlayers, gPlayersCount , flags );     for( new i = 0 ; i < sizeof( gPlayersCount ) ; i++ )         PlayerIndexes = gPlayers[i];     return PlayerIndexes;          }



Example:
Click



It should be added something similiar to the next version of amxx, because i'm realy lazy to write by myself the whole fucking loop all the time when i make a new plugin....
( Nothing to say also about the people who still using the old method to loop all the players from server ... ( id <= Maxplayer bla bla bla ... ).
__________________
Project: Among Us

Last edited by Craxor; 09-23-2016 at 19:28.
Craxor is offline
Send a message via ICQ to Craxor
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 09-23-2016 , 20:29   Re: Get_players repetition
Reply With Quote #12

I'll try it, but its not the same of a Macro? You're using just one array and a variable for pickup all players on the server.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 09-23-2016 at 21:09.
EFFx is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 09-23-2016 , 21:13   Re: Get_players repetition
Reply With Quote #13

I've founded a new thing, how can i pickup the last player alive? Example

PHP Code:
get_user_name(LastPlayer[0],szName,charsmax(szName)) 
I cant do it.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-23-2016 , 21:55   Re: Get_players repetition
Reply With Quote #14

Quote:
Originally Posted by EFFx View Post
I've founded a new thing, how can i pickup the last player alive? Example

PHP Code:
get_user_name(LastPlayer[0],szName,charsmax(szName)) 
I cant do it.
Search for all players, use flag 'a' to take only alive players, if is just one player alive just use as normal the variable, because will found just one player)

But to CHECK if is just one you would need to check the player count i believe ( the second param you use inside of get_players ) .

But i also think to add something similiar to my stock.
__________________
Project: Among Us

Last edited by Craxor; 09-23-2016 at 21:56.
Craxor is offline
Send a message via ICQ to Craxor
wickedd
Veteran Member
Join Date: Nov 2009
Old 09-23-2016 , 22:11   Re: Get_players repetition
Reply With Quote #15

Quote:
Originally Posted by EFFx View Post
I've founded a new thing, how can i pickup the last player alive? Example

PHP Code:
get_user_name(LastPlayer[0],szName,charsmax(szName)) 
I cant do it.
Here you go
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-23-2016 , 22:20   Re: Get_players repetition
Reply With Quote #16

An example with my stock modified, here's the code:

very good!
__________________
Project: Among Us

Last edited by Craxor; 09-23-2016 at 22:51.
Craxor is offline
Send a message via ICQ to Craxor
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-23-2016 , 22:59   Re: Get_players repetition
Reply With Quote #17

Quote:
Originally Posted by Craxor View Post
What opinion you have about this one:

Code:
/*     This stock return all the players Id's based on 'flags' and 'team' you've set it up.     Note: team's string:         "CT" or "TERRORISTS"     Note2: for using second parameter you would need to add the flag "e".     Like this: GetPlayersId( "ae", "CT" ); */ GetPlayersId( flags[]="" , team[]="" ) {     new gPlayers[32], gPlayersCount, PlayerIndexes;       if( contain( flags, "e" ) > -1 )         get_players( gPlayers, gPlayersCount, flags, team)     else         get_players( gPlayers, gPlayersCount , flags );     for( new i = 0 ; i < sizeof( gPlayersCount ) ; i++ )         PlayerIndexes = gPlayers[i];     return PlayerIndexes;          }
That function is nonsensical i.e. it doesn't make sense and doesn't do what the documentation says it does.

Quote:
Originally Posted by EFFx View Post
stuff
If the function is based on a command (chat, console, or server) then always use get_players() in that function every time. No global variables.
__________________
fysiks is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-23-2016 , 23:17   Re: Get_players repetition
Reply With Quote #18

It does what the documentation says, check one poste above yours i leave there an example of how it works.
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-23-2016 , 23:24   Re: Get_players repetition
Reply With Quote #19

Quote:
Originally Posted by Craxor View Post
It does what the documentation says, check one poste above yours i leave there an example of how it works.
Your edited version also doesn't make sense. The fact that the function's name is plural means it would be expected to return multiple player IDs which it doesn't and never will. It returns a scalar value which is a single number, always.
__________________
fysiks is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-23-2016 , 23:36   Re: Get_players repetition
Reply With Quote #20

Quote:
Originally Posted by fysiks View Post
Your edited version also doesn't make sense. The fact that the function's name is plural means it would be expected to return multiple player IDs which it doesn't and never will. It returns a scalar value which is a single number, always.
I'm realy confused of what you talking about, maybe my stupid english i dunno ...

anyway, let me explain

if you set the first parameter as a pozitive value "1" or bigger, it should return you the gPlayers[i] ( which is the all players Id based on flags or team you take them ) if you put '0' or anyway, less than 1 , it returns you gPlayersCount ( which is the total number of players founded ).

I've just tested the code above and works well.


Edit:

I suppose you're talking about these descriptions:

// Here we get the number of the players, wee need to check if only one!
new Number = GetPlayers( 0, "a" );


// Here we get the id of the last player
new PlayersId = GetPlayers( 1, "a" );

Yes, they are wrong, they should be like that:

->


// Here we get the total numbers of alive players, we need to check if Number == 1, then check for last player
new Number = GetPlayers( 0, "a" );


// Here we take the whole id's of alive players from the server, then we check if Number == 1, if yes, PlayersId will be the Id of the last player alive (because his the only one alive.. ).
new PlayersId = GetPlayers( 1, "a" );
__________________
Project: Among Us

Last edited by Craxor; 09-23-2016 at 23:45. Reason: fysiks confuset!
Craxor is offline
Send a message via ICQ to Craxor
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:30.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode