SA-MP Forums Archive
Help - 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)
+--- Thread: Help (/showthread.php?tid=602064)



Help - BlackEvils - 01.03.2016

ShowPlayerDialog(playerid, DIALOG_DMS, DIALOG_STYLE_TABLIST_HEADERS, "DeathMach",
"Command\tDescription\tPlaying\n\
{ffffff}/minigun\t{F7FF00}Minigun DeathMach\t{0099FF}(%d players)\n\
{ffffff}/minigun\t{F7FF00}Minigun DeathMach\t{0099FF}(players)",
"Select", "Close");

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

{ffffff}/minigun\t{F7FF00}Minigun DeathMach\t{0099FF}(%d players)\n\, GetPlayerScore(playerid)
how i can do to put in %d playerid scores?


Re: Help - [NWA]Hannes - 01.03.2016

By formatting the string that you're going to show up in your dialog

https://sampwiki.blast.hk/wiki/Format

Example:
pawn Code:
new str[128];
format(str, sizeof(str), "Command\tDescription\tPlaying\n\
{ffffff}/minigun\t{F7FF00}Minigun Deathmatch\t{0099FF}(%d players)"
, GetPlayerScore(playerid));

ShowPlayerDialog(playerid, DIALOG_DMS, DIALOG_STYLE_TABLIST_HEADERS, "Deathmatch", str, "Select", "Close");
However, I think what you mean to do is to show the amount of players currently in the Minigun Deathmatch, you can achieve this by creating a variable, as follows:
pawn Code:
new bool:IsPlayerInDeathmatch[MAX_PLAYERS];
You should also reset the variable to 0 whenever the player leaves the arena through commands/death or disconnects from the server.

pawn Code:
//Resetting the variable
IsPlayerInDeathmatch[playerid] = false;
When the player joins the arena, set their value to 1
pawn Code:
IsPlayerInDeathmatch[playerid] = true;
And where you have your ShowPlayerDialog script, make a loop which checks which players are in the arena and display that player count in the dialog.

pawn Code:
new count = 0, str[128];
for(new i = 0; i < MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i) && IsPlayerInDeathmatch[i] == 1)
    {
        count++;
    }
}

format(str, sizeof(str), "Command\tDescription\tPlaying\n\
{ffffff}/minigun\t{F7FF00}Minigun Deathmatch\t{0099FF}(%d players)"
, count);
ShowPlayerDialog(playerid, DIALOG_DMS, DIALOG_STYLE_TABLIST_HEADERS, "Deathmatch", str, "Select", "Close");

I hope this helped.


Re: Help - BlackEvils - 01.03.2016

thx you!


Re: Help - [NWA]Hannes - 01.03.2016

If it's working then I'm happy to help, I'm also glad you enjoy it.


Re: Help - BlackEvils - 03.03.2016

Quote:
Originally Posted by [NWA]Hannes
View Post
If it's working then I'm happy to help, I'm also glad you enjoy it.
And if i must add more lines like this how i must do?

format(str, sizeof(str), "Command\tDescription\tPlaying\n\
{ffffff}/minigun\t{F7FF00}Minigun Deathmatch\t{0099FF}(%d players)", count);
{ffffff}/minigun\t{F7FF00}Minigun Deathmatch\t{0099FF}(%d players)", count);
ShowPlayerDialog(playerid, DIALOG_DMS, DIALOG_STYLE_TABLIST_HEADERS, "Deathmatch", str, "Select", "Close");


Re: Help - BlackEvils - 04.03.2016

someone help pls?