Disable Commands
#1

hello i want to disable all commands while player in in this match

also i want /leave command for this macth please help me

PHP код:
   if(strcmp(cmdtext"/onehit"true) == 0)
    {
      new 
msg[128];
      new 
playerName[MAX_PLAYER_NAME], RandomSpawn random(5);
      
GetPlayerName(playeridplayerNameMAX_PLAYER_NAME);
      if (
RandomSpawn == 0)
      {
         
SetPlayerPos(playerid22.7227,2245.2556,126.6797);
      }
      if (
RandomSpawn == 1)
      {
         
SetPlayerPos(playerid33.6609,2238.2681,126.6797);
      }
      if (
RandomSpawn == 2)
      {
         
SetPlayerPos(playerid27.3105,2233.2581,126.6797);
      }
      if (
RandomSpawn == 3)
      {
          
SetPlayerPos(playerid41.3499,2227.5371,125.0820);
      }
      if (
RandomSpawn == 4)
      {
          
SetPlayerPos(playerid29.9060,2230.6448,126.4038);
      }
      
SetCameraBehindPlayer(playerid);
      
SetPlayerHealth(playerid1);
      
ResetPlayerWeapons(playerid);
      
format(msg,sizeof(msg),"%s [%i] Has Joined One hit kill Death match  : [/onehit]",playerName,playerid);
      
SendClientMessageToAll(COLOR_CYAN,msg);
      return 
1;
    } 
Reply
#2

What is the match? Can you provide more detailed explanations?
Reply
#3

this is one hit kill death match
Reply
#4

help plz
Reply
#5

Simple. Create a variable like
pawn Код:
new InOneHit[MAX_PLAYERS];
then when player join the match set variable value to 1.

pawn Код:
if(!strcmp(cmdtext, "/onehit", true))
{

InOneHit[playerid] = 1;
return 1;
}
then when players uses anyother command while in deathmatch. return it to an error
pawn Код:
if(InOneHit[playerid] == 1) return SendClientMessage(playerid,0xAA3333AA,"[ERROR]You cant use commands while in a Deathmatch");
Reply
#6

Nevermind
Reply
#7

Alright, you can do this many ways, but the best way would be like this:
pawn Код:
new InDM[MAX_PLAYERS];
// now i dont know if this is an event or anything but
OnPlayerConnect >> InDM[playerid] = 0;
//Im sure you want it that if they die there, they spawn back there so on ur code u add this
if(InDM[playerid] == 1
// then the rest of ur code comes here

//now u wanted to disable commands if they are inside the arena,
//u can put on each cmd like this:
if(InDM[playerid]==0)
{
// ur code of CMD here
//this will disable the certain cmd in the arena
Reply
#8

At the top of your script put:
pawn Код:
new OneHit[MAX_PLAYERS];
Then put this in your command /onehit
pawn Код:
OneHit[playerid] = 1;
And, here is the /leave command:
pawn Код:
if(strcmp(cmdtext, "/leave", true) == 0)
    {
      new msg[128];
      new playerName[MAX_PLAYER_NAME];
      GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
      if(OneHit[playerid] == 0)return SendClientMessage(playerid, COLOR_CYAN, "You Aren't in One hit kill Death Match: [/onehit]");
      SetPlayerHealth(playerid, -1);
      format(msg,sizeof(msg),"%s [%i] Has Left One hit kill Death match  : [/onehit]",playerName,playerid);
      SendClientMessageToAll(COLOR_CYAN,msg);
      OneHit[playerid] = 0;
      return 1;
    }
NOTE: Fixed..
Reply
#9

Your /leave cmd is wrong, you should atleast put:
pawn Код:
CMD:leave(playerid, params[])
{
If(InDM[playerid] == 0) return SendClientMessage(playerid, -1, "You are not at the One Hit stadium(wtvr)");
else if (InDM[playerid] == 1)
{
InDM[playerid] = 0;
SetPlayerHealth(playerid, 0);
// and what else u wanna put in ur code
}
return 1;
}
Reply
#10

and to make leave command ↓

pawn Код:
if(strcmp(cmdtext, "/onehit", true) == 0)
{
     new string[600],pname[MAX_PLAYER_NAME];
     GetPlayerName(playerid, pname, sizeof(pname));
     if(IsPlayerInDM[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "You already leave MJ's DM Arena!");
     IsPlayerInDM[playerid] = 0;
     SetPlayerPos(playerid, x, y, z);
     format(string, sizeof(string), "%s has left One Hit Deathmatch Arena", pname);
     SendClientMessageToAll(COLOR_GREEN, string);
     SendClientMessage(playerid, COLOR_RED, "You left One Hit Deathmatch");
     return 1;
}
to make this command work properly. you have to define color_red and color_green and change the setplayerpos coordinates. This is an example command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)