24.11.2011, 19:38
Hi there ive made a DM but i need to add something to it to stop them tping out, and so that the only way they can get out is by typing [/exitdm] how would i do this any help would be great?
stock CanPlayerTeleport(playerid)
{
if(minigame{playerid} == DEATHMATCH) // whatever it might look like for you
return SendClientMessage(playerid, COLOR_RED, "Use /exitdm before teleporting away!"), false;
return true;
}
// Command
CMD:anyteleport(playerid, params[])
{
if(!CanPlayerTeleport(playerid))
return true;
// Teleport the player
return true;
}
new DeathMatch[MAX_PLAYERS];
CMD:mdm(playerid, input[])
{
DeathMatch[playerid] = 1;
SetPlayerPos(playerid, 2386.0559,1031.2997,10.5261);
GameTextForPlayer(playerid, "~w~You entered the ~r~DM zone!", 3000, 4);
return 1;
}
CMD:teleport(playerid, input[])
{
if(DeathMatch[playerid] != 0) return SendClientMessage(playerid, color_here, "You can not TP from DM. Use /exitdm to leave.");
// continue the normal code here..
return 1;
}
CMD:exitdm(playerid, input[])
{
if(DeathMatch[playerid] != 1) return SendClientMessage(playerid, color_here, "You are not in any DM arenas.");
SetPlayerPos(playerid, /*wherever you wish him to spawn after using /exitdm*/);
GameTextForPlayer(playerid, "~w~You have left the ~r~DM zone!", 3000, 4);
return 1;
}
if(DeathMatch[playerid] != 0) return SendClientMessage(playerid, color_here, "You can not TP from DM. Use /exitdm to leave.");