Код:
if(strcmp(cmdtext, "/celldoor", true) == 0)
{
if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 3)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /celldoor [Cellid (1-3)]");
return 1;
}
new doorid;
doorid = strval(tmp);
if(doorid == 1)
{
if(cell1open == 0)
{
MoveObject(cell1gate,410.89, 499.13, 985.80, 1.5);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s takes his key, puts it into a controlpanel and spins it. ((Cell door 1 opens))", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
cell1open = 1;
}
else if(cell1open == 1)
{
MoveObject(cell1gate,410.89, 499.13, 994.80, 1.5);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s takes his key, puts it into a controlpanel and spins it. ((Cell door 1 closes))", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
cell1open = 0;
}
}
else if(doorid == 2)
{
if(cell2open == 0)
{
MoveObject(cell2gate,410.91, 496.02, 985.80, 1.5);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s takes his key, puts it into a controlpanel and spins it. ((Cell door 2 opens))", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
cell2open = 1;
}
else if(cell2open == 1)
{
MoveObject(cell2gate,410.91, 496.02, 994.80, 1.5);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s takes his key, puts it into a controlpanel and spins it. ((Cell door 2 closes))", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
cell2open = 0;
}
}
else if(doorid == 3)
{
if(cell3open == 0)
{
MoveObject(cell3gate,410.91, 496.02, 985.80, 1.5);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s takes his key, puts it into a controlpanel and spins it. ((Cell door 3 opens))", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
cell3open = 1;
}
else if(cell3open == 1)
{
MoveObject(cell3gate,410.91, 496.02, 994.80, 1.5);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s takes his key, puts it into a controlpanel and spins it. ((Cell door 3 closes))", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
cell3open = 0;
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "ERROR : Invalid Cell ID");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "ERROR : You don't have the key's to open the cells");
return 1;
}
}