Blocking a CMD
#1

Well, I have another question, I think this is related to /god. In a DM, you can use /god, but I want it to be blocked in DM, how to do it?

pawn Код:
CMD:god(playerid,params[])
{
    if(God[playerid] == false)
    {
        SetPlayerHealth(playerid, 100000.0);
        God[playerid] = true;
        return SendClientMessage(playerid, yellow, "Godmode has been enabled!");
    }
    else
    if(God[playerid] == true)
    {
        God[playerid] = false;
        SetPlayerHealth(playerid, 100.0);
        return SendClientMessage(playerid, red, "Godmode has been disabled!");
    }
   
    if(InDM[playerid] == 1) //I've no idea how to do it here
    {
   
    }
    return 1;
}
Reply
#2

pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
   if(InDM[playerid] == 1)
   {
      return SendClientMessage(playerid, -1, "You can't use commands in a DM match!");
    }
    else return 1;
}
Use this by comparing cmdtext to god, or under InDM, just return 0.
Reply
#3

pawn Код:
CMD:god(playerid,params[])
{
    if(InDM[playerid] == 0)
    {
        if(God[playerid] == false)
        {
            SetPlayerHealth(playerid, 100000.0);
            God[playerid] = true;
            return SendClientMessage(playerid, yellow, "Godmode has been enabled!");
        }
        else if(God[playerid] == true)
        {
            God[playerid] = false;
            SetPlayerHealth(playerid, 100.0);
            return SendClientMessage(playerid, red, "Godmode has been disabled!");
        }
    }
    else if(InDM[playerid] == 1) return SendClientMessage(playerid, -1, "You are not allowed to use this in the DM Arena"); //Change this to whatever you want
    return 1;
}
EDIT: Well, Rajat beat me to it.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)