29.08.2017, 21:03
How i want to make a room with limit of player,i mean exp;the limit of the room is 6 and the 7 player cannot enter the room
new
gRoom = 6;
new
gRoomP[MAX_PLAYERS];
public OnGameModeInit()
{
gRoom = 0;
return 1;
}
public OnPlayerConnect(playerid)
{
gRoomP[playerid] = 0;
return 1;
}
CMD:enterroom(playerid, params[])
{
if(gRoomP[playerid]) return SendClientMessage(playerid, -1, "You are already in the room.");
if(gRoom == 6) return SendClientMessage(playerid, -1, "Room is full!");
gRoom++;
gRoomP[playerid] = 1;
return 1;
}
CMD:exitroom(playerid, params[])
{
if(!gRoomP[playerid]) return SendClientMessage(playerid, -1, "You are not in the room.");
gRoom--;
gRoomP[playerid] = 0;
return 1;
}
CMD:enterroom(playerid, params[]) { if(gRoomP[playerid]) return SendClientMessage(playerid, -1, "You are already in the room."); if(gRoom == 6) return SendClientMessage(playerid, -1, "Room is full!"); ShowPlayerDialog(playerid, DIALOG_ROOMS, DIALOG_STYLE_LIST, "Rooms", "Name Room Here", Choose, Cancel"); return 1; } CMD:exitroom(playerid, params[]) { if(!gRoomP[playerid]) return SendClientMessage(playerid, -1, "You are not in the room."); gRoom--; gRoomP[playerid] = 0; return 1; }
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_ROOMS)
{
if(response) // If they clicked 'Select' or double-clicked a weapon
{
switch(listitem)
{
case 0:
{
gRoom++;
gRoomP[playerid] = 1;
SendClientMessage(playerid, -1, "MESSAGE FOR ENTERING ROOM");
}
}
return 1;
}
return 0;
}