24.02.2010, 19:25
Ok, thats what I meant.. Give me 10 minutes, I'll try to fix something for you.
Ok, I got you a small function, which checks if the player is in the area, when he types /buy. Now, you will have to use ShowPlayerDialog, to get a menu popped up.
Under OnPlayerCommandText:
At the bottom of your script (you dont need this code, you dont have to understand it either):
Ok, I got you a small function, which checks if the player is in the area, when he types /buy. Now, you will have to use ShowPlayerDialog, to get a menu popped up.
Under OnPlayerCommandText:
pawn Код:
if(strcmp(cmdtext,"/buy", true) == 0)
{
if(IsPlayerInArea(playerid, -2000.689, -1915.71, 262.6848, 329.7492))
{
//do the actions (ShowPlayerDialog)
}
else
{
SendClientMessage(playerid,0xFF0000AA,"You are not in the required area!");
}
return 1;
}
pawn Код:
stock IsPlayerInArea(playerid, Float:max_x, Float:min_x, Float:max_y, Float:min_y)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(X <= max_x && X >= min_x && Y <= max_y && Y >= min_y) return 1;
return 0;
}