Halfing on online players into a float
#1

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?
Reply
#2

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.
Reply
#3

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.
Reply
#4

What do you mean "PLayer slot count" ? do you mean MAX_PLAYERS?
Reply
#5

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
Reply
#6

Remove the '[' and the ']' in outside of MAX_PLAYERS.
Reply
#7

@ 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;
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)