Jump to content
  • -1

Cerere tutorial comanda /players


[VanREAL]

Question

6 answers to this question

Recommended Posts

  • 0

Fa asa daca folosesti foreach:

new string[600];
foreach(new i: Player)
{
    format(string, sizeof(string), "%s - %d\n", GetName(playerid), Score);
}
ShowPlayerDialog(playerid, DialogNoResponse, DIALOG_STYLE_LIST, "Server players", string, "Ok", "" );

Inlocuieste dialognoresponse cu un dialog pe care il ai care nu raspunde(nu afiseaza) cu nimic cand apesi pe OK. In loc de Score pui variabila prin care iei scorul jucatorului/levelul.

Daca nu ai foreach:

new string[600];
for(new i, j = GetMaxPlayers(); i < j; i++)
{
    if(!IsPlayerConnected(playerid)) continue;
    format(string, sizeof(string), "%s - %d\n", GetName(playerid), Score);
}
ShowPlayerDialog(playerid, DialogNoResponse, DIALOG_STYLE_LIST, "Server players", string, "Ok", "" );
Edited by BaFFyJunior
Link to comment
Share on other sites

  • 0
On 4/30/2020 at 1:30 AM, BaFFyJunior said:

Fa asa daca folosesti foreach:


new string[600];
foreach(new i: Player)
{
    format(string, sizeof(string), "%s - %d\n", GetName(playerid), Score);
}
ShowPlayerDialog(playerid, DialogNoResponse, DIALOG_STYLE_LIST, "Server players", string, "Ok", "" );

Inlocuieste dialognoresponse cu un dialog pe care il ai care nu raspunde(nu afiseaza) cu nimic cand apesi pe OK. In loc de Score pui variabila prin care iei scorul jucatorului/levelul.

Daca nu ai foreach:


new string[600];
for(new i, j = GetMaxPlayers(); i < j; i++)
{
    if(!IsPlayerConnected(playerid)) continue;
    format(string, sizeof(string), "%s - %d\n", GetName(playerid), Score);
}
ShowPlayerDialog(playerid, DialogNoResponse, DIALOG_STYLE_LIST, "Server players", string, "Ok", "" );

si ce comanda pun ca sa arate chestia asta

Link to comment
Share on other sites

  • 0
Acum 14 ore, [VanREAL] a spus:

si ce comanda pun ca sa arate chestia asta

Pai asta e comanda...

CMD:players(playerid, params[])
{
    new string[600]; 
    foreach(new i: Player) { 
       format(string, sizeof(string), "%s - %d\n", GetName(playerid), Score); 
    } 
    ShowPlayerDialog(playerid, DialogNoResponse, DIALOG_STYLE_LIST, "Server players", string, "Ok", "" );
    return 1;
}

 

Link to comment
Share on other sites

  • 0

CMD:players(playerid, params[]) {

    new onlinePlayers = 0;

 

    for (new i = 0; i < MAX_PLAYERS; i++) {

        if (IsPlayerConnected(i)) {

            onlinePlayers++;

        }

    }

 

    format(string, sizeof(string), "There are %d players online.", onlinePlayers);

    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);

    return 1;

}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.