Block goto command in dm's
#1

Hi guys. Players can take minigun from dm's by using /goto command in dm's and just teleport to any players. And i need to block /goto command. How can i do it?
Reply
#2

What are yo trying to tell us?

Also, show the code.
Reply
#3

Players goes to minigun minigames and teleports to any player with the /goto command and they have minigun in the game. They can kill everybody but it's not acceptable to play with minigun.
Reply
#4

When the player leaves the Minigun event he should be disarmed. Now, in order to do this, you need some variable that changes depending on where the player is (normal world, minigun arena etc).
- Player goes to the arena ( when he does, do something like IsInMinigunArena[playerid] = 1; )
- Player plays in the arena (IsInMinigunArena[playerid] stays 1, you don't have any reason to change it)
- Player leaves the arena (find all the ways of doing this and disarm the player). For goto, it's a bit tricky, because you don't want to disarm the player every time he uses the command, so you should have something like this in your goto command:
pawn Code:
if(IsInMinigunArena[playerid] == 1) //if he was in the minigun arena when he used goto, this should be true
{
    //disarm him
    IsInMinigunArena[playerid] = 0; //set the variable to 0, because he is not there anymore
}
Good luck!
Reply
#5

Bro thank you so much. I'm just write this code under goto command that's it or need i do something more?
Reply
#6

Add that code under goto, replace the "//disarm" comment with ResetPlayerWeapons or whatever you do to disarm players and don't forget to set IsInMinigunArena[playerid] to 0 under OnPlayerConnect and set it to 1 when the player gets the minigun, i.e. when he enters the minigun arena.
Reply
#7

Code:
//Somewhere on your gamemode (Not in any function/stock)
IsInMinigunArena[MAX_PLAYERS];
Code:
//OnPlayerCommandText
if (strcmp("/minigun", cmdtext, true, 10) == 0)
{
     IsInMinigunArena[playerid] = 1;
     SetPlayerPos(playerid, 00.0000, 00.0000, 00.0000);
     return 1;
}
Code:
//OnPlayerCommandText
if (strcmp("/goto", cmdtext, true, 10) == 0)
{
     if(IsInMinigunArena[playerid] != 0) return SendClientMessage(playerid, 0xFF0000C8, "You CANNOT Use This Command now!");

     //Your /goto code
     return 1;
}
Reply
#8

Thank you Maximus0
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)