Player slots in dialog
#1

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?
Reply
#2

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.
Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)