SA-MP Forums Archive
Spawn in DM - 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: Spawn in DM (/showthread.php?tid=433391)



Spawn in DM - DarkB0y - 27.04.2013

Well the player when he die he spawn out side the Dm so he need to join it again with a command
How to make him spawn in dm when he die ?
I got alot of dm commands and i use all random spawns in them
How to make them ?
Thx.


Re: Spawn in DM - Faisal_khan - 27.04.2013

Make a variable like:
pawn Код:
new IsPlayerDMing[MAX_PLAYERS];
Assign it true when the player started using DM. Then under OnPlayerDeath check if the variable is true or not. If you want to disable it just make it false under the command for the player to stop DM.

EDIT:
pawn Код:
new IsPlayerDMing[MAX_PLAYERS];

public OnPlayerDeath(playerid, killerid, reason)
{
    if(IsPlayerDMing[playerid] == 1)
    {
        //set the players position to the DM area
    }
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/dm", cmdtext, true) == 0)
    {
        if(IsPlayerDMing[playerid] == 0)
        {
            IsPlayerDMing[playerid] == 1;
            //ur code for the DM
        }
        else
        {
            IsPlayerDMing[playerid] == 0;
        }
        return 1;
    }
    return 0;
}