Deathmatch help
#1

Hey guy's I'm working on a /dm command but i've just realized that the players can use the teleports in the dm how to


disable this?


To like "Sorry you cannot use commands, While your in a dm"


Thanks


(Jay)
Reply
#2

I'll help you, but i dont really have a good way to explain it. To you have teamviewer?
Reply
#3

Quote:
Originally Posted by [MWR
Niixie ]
I'll help you, but i dont really have a good way to explain it. To you have teamviewer?
Yes, But can you try to explain it in a code first?
Reply
#4

Sure, erm.

You know like when you check if a player is logged in.

Code:
IsLogged[playerid]
I bet you have one look'a'like to check if the player is in the DM. if not, then go to the top and do

Code:
new IsPlayerInDM[MAX_PLAYERS];
then when a player enters the DM put it in like

Code:
DCMD_COMMANDNAME(blablabla)
{
if(IsPlayerInDM[playerid] == 0)
{
//Rest of the code.
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Sorry you cannot use commands, While your in a dm");
}
return 1;
}
Reply
#5

Quote:
Originally Posted by [MWR
Niixie ]
Sure, erm.

You know like when you check if a player is logged in.

Code:
IsLogged[playerid]
I bet you have one look'a'like to check if the player is in the DM. if not, then go to the top and do

Code:
new IsPlayerInDM[MAX_PLAYERS];
then when a player enters the DM put it in like

Code:
DCMD_COMMANDNAME(blablabla)
{
if(IsPlayerInDM[playerid] == 0)
{
//Rest of the code.
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Sorry you cannot use commands, While your in a dm");
}
return 1;
}
Will i have to add this to all my Dms?
Reply
#6

Quote:
Originally Posted by (Jay)
Quote:
Originally Posted by [MWR
Niixie ]
Sure, erm.

You know like when you check if a player is logged in.

Code:
IsLogged[playerid]
I bet you have one look'a'like to check if the player is in the DM. if not, then go to the top and do

Code:
new IsPlayerInDM[MAX_PLAYERS];
then when a player enters the DM put it in like

Code:
DCMD_COMMANDNAME(blablabla)
{
if(IsPlayerInDM[playerid] == 0)
{
//Rest of the code.
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Sorry you cannot use commands, While your in a dm");
}
return 1;
}
Will i have to add this to all my Dms?
I you want to disable all!
Reply
#7

Quote:
Originally Posted by DarkPhoenix
Quote:
Originally Posted by (Jay)
Quote:
Originally Posted by [MWR
Niixie ]
Sure, erm.

You know like when you check if a player is logged in.

Code:
IsLogged[playerid]
I bet you have one look'a'like to check if the player is in the DM. if not, then go to the top and do

Code:
new IsPlayerInDM[MAX_PLAYERS];
then when a player enters the DM put it in like

Code:
DCMD_COMMANDNAME(blablabla)
{
if(IsPlayerInDM[playerid] == 0)
{
//Rest of the code.
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Sorry you cannot use commands, While your in a dm");
}
return 1;
}
Will i have to add this to all my Dms?
I you want to disable all!
Ah ye i do thanks lol.
Reply
#8

No Problem
Reply
#9

Or a much simpler version

pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
 {
    if (strcmp(cmdtext, "/leavedm") == 0)
    {
        IsPlayerInDM[playerid] = 0;
        SendClientMessage(playerid, COLOR_RED, "You left the dm, you can now use other commands");
        return 1;
    }

    if (IsPlayerInDM[playerid] != 0) return SendClientMessage(playerid, COLOR_RED, "You can't use commands while in a dm");


    //other commands

    return 0;
 }
Reply
#10

Quote:
Originally Posted by dice7
Or a much simpler version

pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
 {
    if (strcmp(cmdtext, "/leavedm") == 0)
    {
        IsPlayerInDM[playerid] = 0;
        SendClientMessage(playerid, COLOR_RED, "You left the dm, you can now use other commands");
        return 1;
    }

    if (IsPlayerInDM[playerid] != 0) return SendClientMessage(playerid, COLOR_RED, "You can't use commands while in a dm");


    //other commands

    return 0;
 }
Ah ye this works to Thanks both of you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)