15.10.2012, 16:15
Define this globally, anywhere after the includes lines:
And make a specific value set for the variable if the player in the island, and to be changed when leaving.
And for the checking for the commands you want to use when only at the island make it like the example stated when joining.
pawn Код:
new IsInIsland[MAX_PLAYERS];
pawn Код:
CMD:islanddm(playerid, params[])
{
if(IsInIsland[playerid]) return SendClientMessage(playerid, COLOR_RED,"You are already at the island!");
new string[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
SetTimerEx("Unfreeze", 2000, 0, "d", playerid);
GameTextForPlayer(playerid,"~g~Waiting for the Objects to load",2000,3);
format(string, sizeof(string), "{FF0000}(/islanddm) {FFFF00}Player {FF0000}%s {FFFF00}has Teleported to {FF0000}Island DeathMatch",pName);
SendClientMessageToAll(playerid, string);
new Random = random(sizeof(RandomSpawnIslandDM));
SetPlayerPos(playerid, RandomSpawnIslandDM[Random][0], RandomSpawnIslandDM[Random][1], RandomSpawnIslandDM[Random][2]);
IsInIsland[playerid] = 1;
}
CMD:leavedm(playerid, params[])
{
if(!IsInIsland[playerid]) return SendClientMessage(playerid, COLOR_RED,"You are not at the island - /islanddm to join!");
new Random = random(sizeof(RandomSpawnLEAVEDM));
SetPlayerPos(playerid, RandomSpawnLEAVEDM[Random][0], RandomSpawnLEAVEDM[Random][1], RandomSpawnLEAVEDM[Random][2]); // Place the X Y Z of the position where they player will be when they type this command
SendClientMessage(playerid, COLOR_RED, "You have left the Deathmatch Area");
IsInIsland[playerid] = 1;
return 1;
}

