Player in dm
#1

Hey guys!
I have a question!
I have a command that every player can use /gotop!
If a player wanna /gotop to a player that its in a DM area,tht players shouldnt be allowed to /gotop!
i have tried something like...

new PlayerInDM [MAX_PLAYERS];

in the /dm command

PlayerInDM[playerid] = 1;

and in the /gotop

if(PlayerInDM[playerid] == 1 but i dont think that this is correct!

Help
Reply
#2

Bump di Bump!
Reply
#3

Looks fine to me, have you tested it? If so, what's wrong?
Reply
#4

It doesnt work,it teleports me to the player.
Reply
#5

Well lets see the code so we can figure out where you've made an error
Reply
#6

try
Код:
if(PlayerInDM[playerid]==0)
since it got set to 1 when a player is inside, simply check if its not the case
Reply
#7

Well its not Much Of Code to show here!
But im thinking,when i wanan TP to a players should i first tet the Player's ID,then check if the player is in DM...

Код:
//============================/gotop============================================
		dcmd_gotop(playerid, params[])
	{
	{
	if(InParkour[playerid] == 1) return SendClientMessage(playerid,red,"This player is at a Parkour Area! Dont Disturb HiM!");
	if(InDM[playerid] == 1) return SendClientMessage(playerid,red,"This player is in a DM Area! Dont DIsturb Him!");
And at /dm1 i did
Код:
InDM[playerid] = 1;
Reply
#8

Hm.. If I'm not wrong, your code check if you are in the DM area or not... So then if you (the command submitter) are not in the DM area, you can teleport to any player.

I'll try to make you a command (from zcmd)..

pawn Код:
cmd(gotop, playerid, params[])
{
    new id;
    if( sscanf( params, "u", id) )
    {
        SendClientMessage(playerid, [color], "Use /gotop [playerid]!");
     }
     else
     {
         if(InParkour[id] == 1)
         {
             SendClientMessage(playerid, [color], "That player is in parkour area!");
        }
        else if(InDM[id] == 1)
        {
            SendClientMessage(playerid, [color], "That player is in DM area!");
        }
        else
        {
            // Your code goes here
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)