SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 12/02/2018, 06:39 PM   #1
Davidmkd123
Big Clucker
 
Davidmkd123's Avatar
 
Join Date: Feb 2017
Location: Macedonia
Posts: 94
Reputation: 4
Default Is it existing?

Any function maybe like GetPlayerIngamePlayers() ??, or i should make it by myself?
Davidmkd123 is offline   Reply With Quote
Old 12/02/2018, 06:46 PM   #2
Abagail
High-roller
 
Join Date: Dec 2013
Location: GetPlayerPos(playerid, pos); Scripter/Mapper.
Posts: 3,493
Reputation: 439
Default Re: Is it existing?

GetPlayerIngamePlayers could be anything, the naming isn't specific at all. It could return: a string of names of connected players, connected player count, an array of player IDs connected. What are you actually trying to do?
Abagail is offline   Reply With Quote
Old 12/02/2018, 07:54 PM   #3
Mugala
Gangsta
 
Mugala's Avatar
 
Join Date: Nov 2012
Location: behind u
Posts: 645
Reputation: 30
Default Re: Is it existing?

what u're trying to make with this function? what do u want to exactly do?
__________________
here to help
Mugala is offline   Reply With Quote
Old 12/02/2018, 08:28 PM   #4
PepsiCola23
Gangsta
 
Join Date: May 2015
Posts: 684
Reputation: 3
Default Re: Is it existing?

You want to get the number of players online?isnt that shown when pressing TAB or simply from samp client?explaon better
PepsiCola23 is offline   Reply With Quote
Old 12/02/2018, 08:49 PM   #5
ChristolisTV
Big Clucker
 
ChristolisTV's Avatar
 
Join Date: Feb 2015
Location: Florida, USA
Posts: 157
Reputation: 12
Default Re: Is it existing?

Well, let's suppose you want to get the number of players online in your server:
PHP Code:
stock GetOnlinePlayersNumber()
{
     new 
res=0;
     for(new 
j=0;j<MAX_PLAYERS;j++) if(IsPlayerConnected(j))res++; else continue;
     return 
res;
}

//Somewhere in your code...
new str[256];
format(str,sizeof str,"We have %d/50 players online",GetOnlinePlayersNumber());
SendClientMessage(playerid,-1,str); 
__________________
******* | GitHub
Player since 04.09.2010
"Stop looking down, and look up to success."
- Christolis
ChristolisTV is offline   Reply With Quote
Old 12/02/2018, 08:50 PM   #6
Arthur Kane
Gangsta
 
Arthur Kane's Avatar
 
Join Date: Sep 2012
Posts: 782
Reputation: 115
Default Re: Is it existing?

http://wiki.sa-mp.com/wiki/GetPlayerPoolSize
__________________
Los Santos Roleplay - Development team
Arthur Kane is online now   Reply With Quote
Old 12/02/2018, 09:25 PM   #7
Mugala
Gangsta
 
Mugala's Avatar
 
Join Date: Nov 2012
Location: behind u
Posts: 645
Reputation: 30
Default Re: Is it existing?

Quote:
Originally Posted by Arthur Kane View Post
yeah this will be better for optimize and reduce lags (not noticeable, but it really reduces )
__________________
here to help
Mugala is offline   Reply With Quote
Old 12/02/2018, 09:32 PM   #8
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,927
Reputation: 256
Default Re: Is it existing?

Quote:
Originally Posted by Mugala View Post
yeah this will be better for optimize and reduce lags (not noticeable, but it really reduces )
Never re-write a native function if you don't change something. Pawn function are always slower than native. GetPlayerPoolSize(); will be always faster than yours. There is no point to write an alias pawn function.
__________________
actor_plus - v5.0.2
I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath
Dayrion is offline   Reply With Quote
Old 12/02/2018, 09:34 PM   #9
Mugala
Gangsta
 
Mugala's Avatar
 
Join Date: Nov 2012
Location: behind u
Posts: 645
Reputation: 30
Default Re: Is it existing?

Quote:
Originally Posted by Dayrion View Post
Never re-write a native function if you don't change something. Pawn function are always slower than native. GetPlayerPoolSize(); will be always faster than yours. There is no point to write an alias pawn function.
yeah, that's what I exactly said dude.
__________________
here to help
Mugala is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I have an existing gamemode? Colonel Server Support 10 26/06/2016 09:54 AM
How can I use an existing gamemode? Colonel Client Support 1 25/06/2016 11:02 PM
[Mysql] Modify an existing value anou1 Scripting Help 7 16/02/2014 03:44 PM
Is there a existing.. Studio Help Archive 2 04/12/2009 08:01 AM


All times are GMT. The time now is 07:51 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.