Dm Spawn Rep+
#1

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

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

Adjust the SetSpawnInfo as it enters the DM
Reply
#4

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
Reply
#5

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!
Reply
#6

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)