Jump to content
  • -1

Cerere tutorial comanda /players


Question

6 answers to this question

Recommended Posts

  • 0
Posted (edited)

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
  • 0
Posted
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

  • 0
Posted
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;
}

 

  • 0
Posted

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;

}

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.