#1

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

pawn Код:
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;
}
Reply
#3

how in dialog
Reply
#4

Top Script: #define DIALOG_ROOMS 1 // number of define If you used it Change 1 to any number you are not use it.


Код:
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;
}
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    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;

WARRING: At the /exitroom you dont need a dialog right? If worked rep me pls.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)