13.10.2010, 11:47
How to disable commands exept teleports in areas you choose?
it's in pawn, and for a derby map...
it's in pawn, and for a derby map...
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;
}
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;
}