SA-MP Forums Archive
[Tutorial] How to block commands in an area - 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: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] How to block commands in an area (/showthread.php?tid=345110)



How to block commands in an area - SkL_MD - 23.05.2012

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.


Re: How to block commands in an area - [GF]Logic - 23.05.2012

Useful for an event system


Re: How to block commands in an area - Vince - 23.05.2012

Your English skill is really poor. Also the comments and text in the code are still in Romanian.


Re: How to block commands in an area - Pinguinn - 23.05.2012

This tutorial lacks explanations. Like Vince said, the comments and text in the codes are still Romanian.
My advice is: do not post a tutorial if you are not going to spend time in it.


Re: How to block commands in an area - SkL_MD - 24.05.2012

Excuse my grammar but do not really have the English ,but we modify the text


Re: How to block commands in an area - $$inSane - 24.05.2012

plzz explain it well


Re: How to block commands in an area - Edin Black - 24.05.2012

can you give the full pawn code ?


Re: How to block commands in an area - Edward156 - 25.05.2012

I don't know what's wrong with you guys but cut this guy some slack. It's not like he's getting paid; he's just trying to help.

Anyways, I learned something from it. Good job!


Re: How to block commands in an area - Bek_Loking - 29.06.2012

lols, just lol


Re: How to block commands in an area - ErzaNatsu - 30.06.2012

Good Job


Re: How to block commands in an area - niam - 02.01.2017

+rep