SA-MP Forums Archive
[HELP]How to make the cmd disable? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP]How to make the cmd disable? (/showthread.php?tid=570531)



[HELP]How to make the cmd disable? - fuckingcruse - 11.04.2015

I made something like /dm , when player die , he spawn at the place where he typed the cmd /dm , And if he is in /dm then he cannot type anyother cmd except /leave ..
This is what i made ^^

Error

When player dies , he spawn at the place but he can't join /dm , it shows type /leave

can anyone suggest me what to do?

after he is dead , /leave disables...? Can anyone say me?


Re: [HELP]How to make the cmd disable? - fuckingcruse - 11.04.2015

I am using zcmd..


Re: [HELP]How to make the cmd disable? - SickAttack - 11.04.2015

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;
}