06.04.2012, 16:44
In the top of the script
Create a boolean variable
Under OnPlayerConnect(playerid)
Under OnPlayerCommandText(playerid, cmdtext[])
After the "}" of the OnPlayerCommandText put this
Put this under OnPlayerSpawn(playerid)
Now the leave command
Under the "}" of dcmd_dmjoin
I think that's all.. Didnt test it, so if there's any errors or any bugs, post them here
Код:
#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
Код:
new bool: IsPlayerInDM[MAX_PLAYERS];
Код:
IsPlayerInDM[playerid] = false;
Код:
dcmd(dmjoin, 6, cmdtext); dcmd(leavedm, 7, cmdtext);
Код:
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; }
Код:
if(IsPlayerInDM[playerid] == true) SetPlayerPos(playerid, "coord x", "coord y", "coord z") // coordinates of the dm spawn
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; }