SA-MP Forums Archive
Dm Spawn Rep+ - 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: Dm Spawn Rep+ (/showthread.php?tid=331945)



Dm Spawn Rep+ - Aloushi - 06.04.2012

how to make when player kill in dm player spawn in dm and when player type /leavedm player left dm


Re: Dm Spawn Rep+ - $$inSane - 06.04.2012

give me the code of your script of DM.. i will fix it..


Re: Dm Spawn Rep+ - ViniBorn - 06.04.2012

Adjust the SetSpawnInfo as it enters the DM


Re: Dm Spawn Rep+ - DR3AD - 06.04.2012

In the top of the script
Код:
 #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Create a boolean variable
Код:
new bool: IsPlayerInDM[MAX_PLAYERS];
Under OnPlayerConnect(playerid)
Код:
 IsPlayerInDM[playerid] = false;
Under OnPlayerCommandText(playerid, cmdtext[])
Код:
dcmd(dmjoin, 6, cmdtext);
dcmd(leavedm, 7, cmdtext);
After the "}" of the OnPlayerCommandText put this

Код:
dcmd_dmjoin(playerid, params[])
{
       #pragma unused params
       if(IsPlayerInDM[playerid] == true)
            SendClientMessage(playerid, -1, "You're Already in DM");
       else
       {
             IsPlayerInDM[playerid] = true;
             //Do the rest of things to go to dm, for example, teleport player, give him weapons, etc...
        }
       return 1;
}
Put this under OnPlayerSpawn(playerid)

Код:
if(IsPlayerInDM[playerid] == true)
      SetPlayerPos(playerid, "coord x", "coord y", "coord z") // coordinates of the dm spawn
Now the leave command

Under the "}" of dcmd_dmjoin
Код:
dcmd_leavedm(playerid, params[])
{
     #pragma unused params
     if(IsPlayerInDM[playerid] == false)
         SendClientMessage(playerid, -1, "You're not in DM");
     else
         IsPlayerInDM[playerid] = false;
     return 1;
}
I think that's all.. Didnt test it, so if there's any errors or any bugs, post them here


Re: Dm Spawn Rep+ - Sh@rp Kil|er - 16.05.2012

What if the player is in Interior dm? is there any way to make like 4 spawn points in the dm area instead of 1? Thanks!


Re: Dm Spawn Rep+ - CyberSnaak - 16.05.2012

pawn Код:
dcmd_joindm(playerid, params[])
{
    if(IsPlayerInDM[playerid] == true)
    {
        SendClientMessage(playerid,-1,"You are already in a DM event!");
    }
    else
    {
        SetPlayerPos(playerid, POS HERE);
                SetPlayerInterior(playerid, InteriorIDHERE);
        SendClientMessage(playerid,-1,"You are not in a DM event, Good luck!");
        IsPlayerInDM[playerid] = false;
    }
    return 1;
}
Something like this?

P.S: just reverse it slightly, Instead of IsPlayerInDM[playerid] true , change true to False on the /leavedm command.