[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
#2

Useful for an event system
Reply
#3

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

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.
Reply
#5

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

plzz explain it well
Reply
#7

can you give the full pawn code ?
Reply
#8

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!
Reply
#9

lols, just lol
Reply
#10

Good Job
Reply
#11

+rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)