[Tutorial] How to block commands in an area
#1

Let's start:
A. To create variable which will hold if you're in the area, put on top of the script:
pawn Code:
new IsPlayerInZone[ MAX_PLAYERS ];
MAX_PLAYERS - it will replace the functions with 'playerid'.
B. To set the variable to 1, meaning that went into that area, put somewhere in a command (for example), that:
Code:
IsPlayerInZone[ playerid ] = 1;
playerid - this is the player ID which will set respawnarea.
1 - indicates that the player entered the area and can not use any command.

C. To make it unable to use only a few commands in that area, if any, add them to OnPlayerCommandText (explanations are past the end line with / /):
Code:
if( IsPlayerInZone[ playerid ] == 1 && strcmp(cmdtext, "/exitzone", true) != 0 ) 
	return SendClientMessage( playerid, 0xFF0000FF, "EROARE: {FFFFFF}You can not get out of this area, using /exitzone !" );
D. To put that in / exitzone (for example) out of the area, adding that in order / exitzone:
Code:
IsPlayerInZone[ playerid ] = 0;
E. Not to have bugs when a new player spawneaza connected OnPlayerConnect provides that:
Code:
IsPlayerInZone[ playerid ] = 0;
PS: You can do and if in an area (no order) that the player can not use commands than those specified in the IsPlayerInZone place an order (section 2) will find OnPlayerUpdate, used with IsPlayerInRangeOfPoint and other functions for the area.
Reply


Messages In This Thread
How to block commands in an area - by SkL_MD - 23.05.2012, 19:42
Re: How to block commands in an area - by [GF]Logic - 23.05.2012, 20:16
Re: How to block commands in an area - by Vince - 23.05.2012, 20:25
Re: How to block commands in an area - by Pinguinn - 23.05.2012, 20:29
Re: How to block commands in an area - by SkL_MD - 24.05.2012, 04:24
Re: How to block commands in an area - by $$inSane - 24.05.2012, 10:54
Re: How to block commands in an area - by Edin Black - 24.05.2012, 17:47
Re: How to block commands in an area - by Edward156 - 25.05.2012, 02:47
Re: How to block commands in an area - by Bek_Loking - 29.06.2012, 22:05
Re: How to block commands in an area - by ErzaNatsu - 30.06.2012, 00:48
Re: How to block commands in an area - by niam - 02.01.2017, 09:49

Forum Jump:


Users browsing this thread: 1 Guest(s)