Player slots in dialog - 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: Player slots in dialog (
/showthread.php?tid=655825)
Player slots in dialog -
Mike861 - 30.06.2018
I've been making a simple deathmatch system, and what i thought of is player slots on each map.
Im using DIALOG_STYLE_TABLIST_HEADERS and i wanted to limit the dm map entry like 0/10.
I was told that i could loop through all the players and for each iteration and make a variable and increment it, but i don't know exactly how.Could anyone help me out?
Re: Player slots in dialog -
Maxandmov - 30.06.2018
When you format your DIALOG_STYLE_TABLIST_HEADERS, you simply do a player loop:
Код:
new pcount[2];
for(new i = 0; i < MAX_PLAYERS; i++)
if(IsPlayerConnected(i))
if(PlayerArea == 1) pcount[0]++; //By PlayerArea I assume a variable that is responding for the map in which player is in.
else if(PlayerArea == 2) pcount[1]++;
new str[128];
format(str, sizeof(str),
"Map\tSlots\n\
Hilltop Farm\t%i\n\
Montgomery\t%i\n\", pcount[0], pcount[1]);
ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_TABLIST_HEADERS, "Deathmatch", str, "Select", "Close");
Something like that. You get the idea, I hope.
Re: Player slots in dialog -
Mike861 - 30.06.2018
Quote:
Originally Posted by Maxandmov
When you format your DIALOG_STYLE_TABLIST_HEADERS, you simply do a player loop:
Код:
new pcount[2];
for(new i = 0; i < MAX_PLAYERS; i++)
if(IsPlayerConnected(i))
if(PlayerArea == 1) pcount[0]++; //By PlayerArea I assume a variable that is responding for the map in which player is in.
else if(PlayerArea == 2) pcount[1]++;
new str[128];
format(str, sizeof(str),
"Map\tSlots\n\
Hilltop Farm\t%i\n\
Montgomery\t%i\n\", pcount[0], pcount[1]);
ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_TABLIST_HEADERS, "Deathmatch", str, "Select", "Close");
Something like that. You get the idea, I hope.
|
Thanks man, +rep