03.03.2012, 08:07
You could create a global variable at the top of your gamemode, somthing like this:
Add a command to lock the cells
And change your /exitcell command to this
Here i'm assuming you have COLOR_GREEN and COLOR_RED defined.
Note that the code is uncompiled and untested.
Please post your result.
pawn Код:
new bool:AreCellsLocked = false;
pawn Код:
if (!strcmp(cmdtext, "/lockcells", true))
{
if (AreCellsLocked)
{
AreCellsLocked = false;
SendClientMessage(playerid, COLOR_GREEN, "The celldoors have been unlocked!");
}
else
{
AreCellsLocked = true;
SendClientMessage(playerid, COLOR_GREEN, "The celldoors have been locked!");
}
}
pawn Код:
if(!strcmp(cmdtext, "/exitcell", true))
{
if (AreCellsLocked)
{
SendClientMessage(playerid, COLOR_RED, "The celldoors are locked, you can't exit now!");
}
else if(IsPlayerInRangeOfPoint(playerid, 2, 350.8596,2044.6348,-15.8942))
{
SafeSetPlayerPos(playerid,350.8192,2043.3998,-15.8942);
}
else if(IsPlayerInRangeOfPoint(playerid, 2, 354.4935,2044.5579,-15.8942))
{
SafeSetPlayerPos(playerid,354.4162,2042.9690,-15.8942);
}
else if(IsPlayerInRangeOfPoint(playerid, 2,358.4893,2044.3650,-15.8942))
{
SafeSetPlayerPos(playerid,358.5545,2043.4036,-15.8942);
}
else if(IsPlayerInRangeOfPoint(playerid, 2,350.4196,2026.4515,-15.8942))
{
SafeSetPlayerPos(playerid,350.3955,2028.2583,-15.8942);
}
else if(IsPlayerInRangeOfPoint(playerid, 2,354.1672,2027.1947,-15.8942))
{
SafeSetPlayerPos(playerid, 354.1133,2028.2479,-15.8942);
}
else if(IsPlayerInRangeOfPoint(playerid, 2, 354.1672,2027.1947,-15.8942))
{
SafeSetPlayerPos(playerid, 354.1133,2028.2479,-15.8942);
}
else if(IsPlayerInRangeOfPoint(playerid, 2,358.3171,2026.7179,-15.8942))
{
SafeSetPlayerPos(playerid, 358.4237,2028.2480,-15.8942);
}
else if(IsPlayerInRangeOfPoint(playerid, 2,358.6216,2044.7598,-11.8717))
{
SafeSetPlayerPos(playerid, 358.6442,2043.2045,-11.9187);
}
else if(IsPlayerInRangeOfPoint(playerid, 2,354.5882,2044.3750,-11.8715))
{
SafeSetPlayerPos(playerid,354.5472,2043.2047,-11.9437 );
}
else if(IsPlayerInRangeOfPoint(playerid, 2,350.9304,2044.5676,-11.8759))
{
SafeSetPlayerPos(playerid,350.9572,2043.2021,-11.9185);
}
else if(IsPlayerInRangeOfPoint(playerid, 2,350.8673,2026.9972,-11.8690))
{
SafeSetPlayerPos(playerid,350.8806,2028.2472,-11.9185);
}
else if(IsPlayerInRangeOfPoint(playerid, 2, 354.3078,2026.9812,-11.8754))
{
SafeSetPlayerPos(playerid,354.2941,2028.2482,-11.9187);
}
else if(IsPlayerInRangeOfPoint(playerid, 2, 358.5276,2027.2445,-11.8175))
{
SafeSetPlayerPos(playerid,358.6219,2028.2504,-11.9187);
}
else
{
SendClientMessage(playerid,COLOR_GREEN,"You aren't near the cell.");
}
return 1;
}
Note that the code is uncompiled and untested.
Please post your result.