/exitdm
#1

pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
    //--------------------------------------------------------------------------
    if(GetPVarInt(playerid, "PlayerInDM") == 1 || GetPVarInt(playerid, "PlayerInRace") == 1 || GetPVarInt(playerid, "PlayerInGifts") == 1)
    {
        //----------------------------------------------------------------------
        if(strcmp(cmdtext,  "/exitdm",  true   ) == 0)          return 0;
        if(strcmp(cmdtext,  "/ad",      true   ) == 0)          return 0;
        if(strcmp(cmdtext,  "/myskin",  true   ) == 0)          return 0;
        if(strcmp(cmdtext,  "/cmds",    true   ) == 0)          return 0;
        if(strcmp(cmdtext,  "/skin",    true   ) == 0)          return 0;
        //----------------------------------------------------------------------
        else GameTextForPlayer(playerid, "~w~Use ~r~/exitdm~w~ to leave!", 6000, 4);
        return 1;
    }
    //--------------------------------------------------------------------------
    if(GetPVarInt(playerid, "Jailed") == 1)
    {
        SendClientMessage(playerid, red, "ERROR: You cannot use commands in Jail!");
        return 1;
    }
    //--------------------------------------------------------------------------
    else return 0;
}
Well, all commands aren't working. I want to block commands only in a DM arena. How can I do that?
Reply
#2

pawn Код:
if(GetPVarInt(playerid, "PlayerInDM") == 1)
{
    if(strcmp(cmdtext,"/exitdm",true) == 0) return 1; // only exitdm works
    return !GameTextForPlayer(playerid, "~w~Use ~r~/exitdm~w~ to leave!", 6000, 4); // all commands disabled
}
Reply
#3

Quote:
Originally Posted by Jefff
Посмотреть сообщение
pawn Код:
if(GetPVarInt(playerid, "PlayerInDM") == 1)
{
    if(strcmp(cmdtext,"/exitdm",true) == 0) return 1; // only exitdm works
    return !GameTextForPlayer(playerid, "~w~Use ~r~/exitdm~w~ to leave!", 6000, 4); // all commands disabled
}
Doesn't work.
Reply
#4

Resolved:
pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
    //--------------------------------------------------------------------------
    if(GetPVarInt(playerid, "PlayerInDM") == 1 && strfind(cmdtext,"leave",true) == -1)
    {
        GameTextForPlayer(playerid, "~w~Foloseste ~r~/leave~w~ pentru a pleca!", 6000, 4);
        return 0;
    }
    //--------------------------------------------------------------------------
    if(GetPVarInt(playerid, "PlayerInGifts") == 1 && strfind(cmdtext,"leave",true) == -1)
    {
        GameTextForPlayer(playerid, "~w~Foloseste ~r~/leave~w~ pentru a pleca!", 6000, 4);
        return 0;
    }
    //--------------------------------------------------------------------------
    if(GetPVarInt(playerid, "PlayerInRace") == 1 && strfind(cmdtext,"leave",true) == -1)
    {
        GameTextForPlayer(playerid, "~w~Foloseste ~r~/leave~w~ pentru a pleca!", 6000, 4);
        return 0;
    }
    //--------------------------------------------------------------------------
    if(GetPVarInt(playerid, "Jailed") == 1)
    {
        SendClientMessage(playerid, red, "RNG Error: {FFFFFF}Nu poti folosi comenzi in Jail!");
        return 1;
    }
    //--------------------------------------------------------------------------
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)