Halfing on online players into a float - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Halfing on online players into a float (
/showthread.php?tid=202789)
Halfing on online players into a float -
r3k1lLz_ - 25.12.2010
Hey guys,
As you can see in the subject I'm seeing if it's possible to get everyone on the server then then halfing it and putting it into a float.
Help?
Re: Halfing on online players into a float -
bigcomfycouch - 25.12.2010
pawn Код:
new
Float:val;
for ( new i, s = GetMaxPlayers( ); i < s; ++i )
{
if ( IsPlayerConnected( i ) )
{
val += 0.5;
}
}
I assume this is what you'd meant.
Re: Halfing on online players into a float -
Retardedwolf - 25.12.2010
Quote:
Originally Posted by bigcomfycouch
pawn Код:
new Float:val;
for ( new i, s = GetMaxPlayers( ); i < s; ++i ) { if ( IsPlayerConnected( i ) ) { val += 0.5; } }
I assume this is what you'd meant.
|
afaik, I think you're using the
slowest method to get all of the online players. foreach ftw.
Re: Halfing on online players into a float -
r3k1lLz_ - 25.12.2010
What do you mean "PLayer slot count" ? do you mean MAX_PLAYERS?
Re: Halfing on online players into a float -
r3k1lLz_ - 25.12.2010
Look here for my errors and stuff, I dunno why I'm getting them
http://r3k.pastebin.com/DLpDva8u
I put that on a command
Re: Halfing on online players into a float -
Retardedwolf - 25.12.2010
Remove the '[' and the ']' in outside of MAX_PLAYERS.
Re: Halfing on online players into a float -
Mean - 25.12.2010
@ the top
pawn Код:
#undef MAX_PLAYERS
#define MAX_PLAYERS 50 // Change 50 to your max player slots
then
pawn Код:
new Float:val;
for(new i=0; i<MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
val += 0.5;
}
}