Dm Spawn Rep+
#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


Messages In This Thread
Dm Spawn Rep+ - by Aloushi - 06.04.2012, 16:16
Re: Dm Spawn Rep+ - by $$inSane - 06.04.2012, 16:17
Re: Dm Spawn Rep+ - by ViniBorn - 06.04.2012, 16:34
Re: Dm Spawn Rep+ - by DR3AD - 06.04.2012, 16:44
Re: Dm Spawn Rep+ - by Sh@rp Kil|er - 16.05.2012, 20:47
Re: Dm Spawn Rep+ - by CyberSnaak - 16.05.2012, 21:09

Forum Jump:


Users browsing this thread: 2 Guest(s)