Help with the cmd of dm
#1

Hello Guys ... I made a command (/dm) to join deathmatch

and i want the players when they'll type this cmd and they are already in it .. they will see :

SendClientMessage(playerid, COLOR_RED,"[DM]: You are already in the dm..");
Reply
#2

new NotAllow[MAX_PLAYERS]; at the top

and under ur dm command u write: NotAllow[playerid] = 1;

and on the text: if(NotAllow[playerid] == 1) SendClientMessage(and all the stuff here)


writing on htc, so dunno if it is right.
Reply
#3

ee100 // Doesn't works sir ... it still teleport to the dm
Reply
#4

No what he means is, when the player first does /dm, and they tele there, do NotAllow[playerid]== 1; So then make a
Код:
if(strcmp(blah,blah)
(
// Your codeing here
);
else
(
if(NotAllow == 1);
(
SendClientMessage(RED,"[DM]Your already at DM");
);
Now, sorry but i kinda have assed it, so if you need a bit more explaining, ask someone else. PS: I more than kinda halfassed it, i made it simple lol sorry
Reply
#5

Steven82 // I made it and i got some errors
Reply
#6

********** UP ***********
Reply
#7

Do

pawn Код:
if(IsPlayerInDM[playerid] == 1) {
     SendClientMessage(playerid, 0xFF00AAFF, "SERVER: You are already in DM!");
     return 0;
} else {
     // Your code
}
ofc you need to
pawn Код:
new IsPlayerInDM[MAX_PLAYERS];
Reply
#8

and I'll post IsPlayerInDM[playerid] = 1 under the code, isn't it ?
Reply
#9

new IsPlayerInDM[MAX_PLAYERS]; should go somewhere under your includes.
Reply
#10

Start using PVars. They're meant to be used for things like this.

In your command put this at the top:

pawn Код:
if(GetPVarInt(playerid, "IsInDM") == 1)
    return SendClientMessage(playerid, COLOR_RED, "You are already in the DM!");

SetPVarInt(playerid, "IsInDM", 1);
// rest of your code (SetPlayerPos etc)
and whenever the player exits the DM put

pawn Код:
SetPVarInt(playerid, "IsInDM", 0);
// OR
DeletePVar(playerid, "IsInDM");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)