Help with /leavedm command
#3

Define this globally, anywhere after the includes lines:

pawn Код:
new IsInIsland[MAX_PLAYERS];
And make a specific value set for the variable if the player in the island, and to be changed when leaving.

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;
}
And for the checking for the commands you want to use when only at the island make it like the example stated when joining.
Reply


Messages In This Thread
Help with /leavedm command - by danites - 15.10.2012, 16:08
Re: Help with /leavedm command - by Lordzy - 15.10.2012, 16:14
Re: Help with /leavedm command - by Randy More - 15.10.2012, 16:15
Re: Help with /leavedm command - by danites - 15.10.2012, 16:34
Re: Help with /leavedm command - by Randy More - 15.10.2012, 16:38
Re: Help with /leavedm command - by danites - 15.10.2012, 16:38
Re: Help with /leavedm command - by danites - 15.10.2012, 16:43
Re: Help with /leavedm command - by Randy More - 15.10.2012, 16:45
Re: Help with /leavedm command - by danites - 15.10.2012, 16:50
Re: Help with /leavedm command - by Randy More - 15.10.2012, 16:56

Forum Jump:


Users browsing this thread: 1 Guest(s)