MAX_PLAYERS and MAX_PLAYER_NAME
#1

Hi all!

I'm kinda new here so deal with my beginner question?

I want to know what does MAX_PLAYERS and MAX_PLAYER_NAME exactly.

I mean, MAX_PLAYERS ok ok it's like 50 but then why do you put after a new string?
And I don't even know what is MAX_PLAYER_NAME.

Please help me!
Reply
#2

Max players after a new string? Sounds like a bad idea, cause you would put (if standard) 500 cells in the string.

MAX PLAYERS should be used in a loop, if you want to loop through all players. MAX PLAYER NAME is 24 and should be used when you get a players name with GetPlayerName.
Reply
#3

Thanks but can you write down an explained example?
Reply
#4

Quote:
Originally Posted by Seven_of_Nine
Посмотреть сообщение
Thanks but can you write down an explained example?
Yeah sure

pawn Код:
if(!strcmp(cmdtext,"/myname",true))
{
    new Playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,Playername,sizeof(Playername));
    SendClientMessage(playerid,-1,Playername);
    return 1;
}
This just writes the players name.

Other example comes later.
Reply
#5

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
Max players after a new string? Sounds like a bad idea, cause you would put (if standard) 500 cells in the string.

MAX PLAYERS should be used in a loop, if you want to loop through all players. MAX PLAYER NAME is 24 and should be used when you get a players name with GetPlayerName.
MAX PLAYERS is the same as 500... then if your server isn't a 500 slots server it's totally useless...
It would be better to put on the top of your gamemode
pawn Код:
#undef MAX_PLAYERS
#define MAX_PLAYERS (number_of_your_slots)
Reply
#6

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
Max players after a new string? Sounds like a bad idea, cause you would put (if standard) 500 cells in the string.
Here we go

I got the other example here;

pawn Код:
if(!strcmp(cmdtext,"/admins",true))
{
    new AdminName[MAX_PLAYER_NAME],string[15];
    for(new i = 0; i < MAX_PLAYERS; i ++) // This loops through all players, which means this code gets executed for every player
    {
        if(IsPlayerConnected(i)) // The code after this will only be executed if the player is connected
        {
            if(IsPlayerAdmin(i)) // The code after this will only be executed if the player is RCON Admin
            {
                GetPlayerName(i,AdminName,sizeof(AdminName); // Gets the player's name
                format(string,sizeof(string),"%s is RCON Admin.",AdminName); // Puts the Admins name in the string
                SendClientMessage(playerid,-1,string); // Sends the message we formatted above
            }
        }
    }
    return 1;
}
Reply
#7

Thanks for replies, AND I wrote my first work:
Kicker / Banner
I'm not sure it works (of course I'm not..) because this is the first script I ever made so
Reply
#8

Nope it wouldn't, since kickid would always be 0

Use a proper command processor, such as DCMD/ZCMD/YCMD. They're simple on processing params.
Reply
#9

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
Nope it wouldn't, since kickid would always be 0

Use a proper command processor, such as DCMD/ZCMD/YCMD. They're simple on processing params.
Can you bold that part or replace for me?

You're so kind by the way
Reply
#10

Sorry for DB:
Is this right?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)