Block cmd -
manchestera - 24.11.2011
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?
Re: Block cmd -
=WoR=G4M3Ov3r - 24.11.2011
You mean you don't want them to get out of the DM Map/Area ?
Re: Block cmd -
Kayaque - 24.11.2011
Do you have a TP command which you wish to block while in DM, and do you got a variable to check if they are inside a DM arena?
Re: Block cmd -
AndreT - 24.11.2011
What I've done is created a function which checks if the player can teleport or not. This function simply checks if the player is in a deathmatch. If yes, it tells the player to use /leave before teleporting.
pawn Код:
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;
}
Re: Block cmd -
manchestera - 24.11.2011
Right now all i have is.
And yes i dont want them to get out of the map using a tp cmd or any over type of cmd.
[code]
cmd:mdm(playerid)
}
SetPlayerPos(playerid, 2386.0559,1031.2997,10.5261);
return 1;
{
Re: Block cmd -
Kayaque - 24.11.2011
Alright, try this..
Top of your script: new DeathMatch[MAX_PLAYERS];
then, when then enter the DM arena, like /startdm or whatever, you add DeathMatch[playerid] = 1;
Then, if they try to teleport, you check for DeathMatch[playerid] == 0. If it's NOT 0, you return error message.
Something like this;
pawn Код:
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;
}
Re: Block cmd -
manchestera - 24.11.2011
so i need to add this to every cmd?
Код:
if(DeathMatch[playerid] != 0) return SendClientMessage(playerid, color_here, "You can not TP from DM. Use /exitdm to leave.");
Re: Block cmd -
Kayaque - 24.11.2011
Only to the commands that allows them to teleport away from the DM area obviously.
Re: Block cmd -
manchestera - 24.11.2011
Works a treat thanks man.