[HELP]How to make the cmd disable?
#3

pawn Код:
new bool:pDMEvent[MAX_PLAYERS] = false,
Float:pLastPos[MAX_PLAYERS][3];

CMD:dm(playerid, params[])
{
    new Float:pos[3];
    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
    for(new i = 0; i < 3; i ++) pLastPos[playerid][i] = pos[i];

    pDMEvent[playerid] = true;
    return 1;
}

CMD:leave(playerid, params[])
{
    SetPlayerPos(playerid, pLastPos[0], pLastPos[1], pLastPo[2]);
    for(new i = 0; i < 3; i ++) pLastPos[playerid][i] = 0.0;

    pDMEvent[playerid] = false;
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    if(pDMEvent[playerid])
    {
        SetPlayerPos(playerid, pLastPos[0], pLastPos[1], pLastPo[2]);
        for(new i = 0; i < 3; i ++) pLastPos[playerid][i] = 0.0;

        pDMEvent[playerid] = false;
    }
    return 1;
}

public OnPlayerCommandReceived(playerid, cmdtext[])
{
    if(pDMEvent[playerid])
    {
        if(strcmp("/leave", cmdtext))
        {
            SendClientMessage(playerid, -1, "You can't use command in a dm event, use /leave first.");
            return 0;
        }
    }
    return 1;
}
Reply


Messages In This Thread
[HELP]How to make the cmd disable? - by fuckingcruse - 11.04.2015, 13:01
Re: [HELP]How to make the cmd disable? - by fuckingcruse - 11.04.2015, 14:48
Re: [HELP]How to make the cmd disable? - by SickAttack - 11.04.2015, 17:11

Forum Jump:


Users browsing this thread: 1 Guest(s)