Disable commands in an area -
knackworst - 13.10.2010
How to disable commands exept teleports in areas you choose?
it's in pawn, and for a derby map...
Re: Disable commands in an area -
DeathOnaStick - 13.10.2010
Depends what kind of area you think of. If you're talking about a sphere, use IsPlayerInRangeOfPoint in the same if-condition, where the strcmp is located, or just right before.
If you're talking about a square, use this IsPlayerInArea(playerid,maxX, maxY, minX, minY)
pawn Code:
IsPlayerInArea(playerid,Float:maxX, Float:maxY, Float:minX, Float:minY)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPosition(playerid, X, Y, Z);
if(X>=minX&&X<=maxX&&Y>=minY&&Y<=maxY)return 1;
else return 0;
}
I don't give guarantee about this code, cuz i just scripted this here right now.
Re: Disable commands in an area -
MBX97 - 13.10.2010
and btw DeathOnaStick this thing isn't easy , u mean that the float:X and Y and Z is the co-ordinates
cuz it will be much harded to did it , like 50 co-ordinates for 1 area , i don't get it , plz answer me fast
Re: Disable commands in an area -
knackworst - 13.10.2010
I made a map for a good derby the map is at the bikeschool, but the server also has a /fix command , for cars, how can I make the derby map a real derby ? whitout fixing cars?
Re: Disable commands in an area -
knackworst - 13.10.2010
Do I have to set virtual world at teleport spawn in pawno?
Re: Disable commands in an area -
MBX97 - 13.10.2010
yea , its soooooo important
Re: Disable commands in an area -
knackworst - 13.10.2010
Ok what settings should I set for that virtual world?
Re: Disable commands in an area -
DeathOnaStick - 13.10.2010
You don't need a virtual world, except you want to seperate the teleported player from the others.
Quote:
Originally Posted by MBX97
and btw DeathOnaStick this thing isn't easy , u mean that the float:X and Y and Z is the co-ordinates
cuz it will be much harded to did it , like 50 co-ordinates for 1 area , i don't get it , plz answer me fast
|
If you want to check for an square-like area, you just need 4 coordinates, which are the corners (maxX, maxY, minX, minY). I don't understand the problem.
Re: Disable commands in an area -
knackworst - 13.10.2010
I just don't know how to make it....
I want a square where you can't use /fix command...
Re: Disable commands in an area -
Miguel - 13.10.2010
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/fix", true) == 0)
{
if(IsPlayerInArea(playerid, 1000.0000, -1000.0000, 1000.0000, -1000.0000)) return SendClientMessage(playerid, 0xFFFFFFFF, "You can't use this command in this area!");
RepairVehicle(GetPlayerVehicleID(playerid));
return 1;
}
return 0;
}
stock IsPlayerInArea(playerid, Float:xmax, Float:xmin, Float:ymax, Float:ymin)
{
new
Float:x,
Float:y,
Float:z;
GetPlayerPos(playerid, x, y, z);
if((x < xmax) && (x > xmin) && (y > ymax) && (y < ymin)) return 1;
return 0;
}
Remember changing the 1000.0000s and -1000.0000s for your coordinates.