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=640213)
help. -
asri - 29.08.2017
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
Re: help. -
Arithmetic - 29.08.2017
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;
}
Re: help. -
asri - 30.08.2017
how in dialog
Re: help. -
RedRex - 30.08.2017
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(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;
}
WARRING: At the /exitroom you dont need a dialog right? If worked rep me pls.