Admin Zone
#1

Hi, i want to make Admin Zone with IsPlayerInCube, because Admin base is in 837 height. Coords is
Code:
IsPlayerInCube(p,1998.5381,2077.4019,837.5109,2142.5049,2150.6023,852.4391
But my uf.inc may be broken, because when i include, there are too many errors and warnings in include. I am new and i don't know how to make that effect.

I want to Timer check player's coords, and when he's not admin and he's in this area, he will receive a message "You Are in admin area ! Get lost !" and make his health less and less to death.

I have already done this, but it's not works.
Code:
forward CheckCube();

public CheckCube()
{
 for(new p = 0; p < GetMaxPlayers(); p++)
 {
	if (IsPlayerInCube(p,1998.5381,2077.4019,837.5109,2142.5049,2150.6023,852.4391))
	  {
	  	if (!IsPlayerAdmin(p))
	  	{
	  		SendClientMessage(p,CZERWONY,"Jesteś na terytorium admina ! Wynoś się !!");
	  		SetPlayerHealth(p,0);
	  		return 1;
	  	}
		}
 }
}
Please, help, when i post a message, noone responds.
Reply
#2

This is how i would do it...

pawn Code:
forward CheckCube();
public CheckCube()
{
   for(new i=0; i<MAX_PLAYERS; i++)
   {
   new Float:x, Float:y, Float:z;
   GetPlayerPos(i, x, y, z)

   if(IsPlayerAdmin(i))
       return 0;

   //if (x < MAX_X && x > MIN_X && y < MAX_Y && y > MIN_Y && z < MAX_Z && z > MIN_Z) example...

    if ((x < 2077.4019 && x > 1998.5381 && y < 2142.5049 && y > 837.5109 && z < 2150.6023 && z > 852.4391)//Your admin zone
    {
       
    new Float:plhealth;
    GetPlayerHealth(i, plhealth);
    SetPlayerHealth(i, plhealth-5);//This will remove 5hp from the player every time the area is checked.

    SendClientMessage(p,CZERWONY,"Jesteś na terytorium admina ! Wynoś się !!");
    SetPlayerHealth(p,0);
    }
    }
    return 1;
}
The above would work. but it would also spam the player in the area until they leave the area. aswell as removing 5hp every loop.

Reply
#3

When player deads, loop still kill the player, and when he spawn once after check, he's dead and when he spawn twice, it's good. What can i do, to break the loop when his health is 0 ?


Code:
 SetPlayerHealth(i, 0);//This will remove all health
    SendClientMessage(i,CZERWONY,"Wkroczyłeś na teren admina, zostałeś ukarany");
    SendClientMessageToAdmins(CZERWONY,string);
I make that because i don't want to spam in server, but loop still spam a client messages.
Reply
#4

Sorry for double post, but i add a variable to this FS.

Code:
new security; // on top

...
...

		if(security == 1)
		{
			if(IsPlayerAdmin(i))
			{
    	   return 0;
			}
		}
		

...
...

  if (strcmp("/remoteon", cmdtext, true, 10) == 0)
	{
		security = 1;
		SendClientMessage(playerid,CZERWONY,"security on");
		return 1;
	}
	if (strcmp("/remoteoff", cmdtext, true, 10) == 0)
	{
		security = 0;
		SendClientMessage(playerid,CZERWONY,"security off");
		return 1;
	}
I don't block the command for not-admins bcuz i want try it with normal user
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)