SA-MP Forums Archive
Player in dm - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Player in dm (/showthread.php?tid=182246)



Player in dm - ColdXX - 09.10.2010

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


Re: Player in dm - ColdXX - 10.10.2010

Bump di Bump!


Re: Player in dm - JaTochNietDan - 10.10.2010

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


Re: Player in dm - ColdXX - 11.10.2010

It doesnt work,it teleports me to the player.


Re: Player in dm - JaTochNietDan - 11.10.2010

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


Re: Player in dm - Babul - 11.10.2010

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


Re: Player in dm - ColdXX - 16.10.2010

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;



Re: Player in dm - DevilG - 16.10.2010

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;
}