11.01.2014, 21:44
pawn Код:
stock IsPlayerInRectangle(playerid, Float:x1, Float:y1, Float:x2, Float:y2)
{
if(IsPlayerConnected(playerid))
{
new Float:xs,Float:ys,Float:zs;
GetPlayerPos(playerid,xs,ys,zs);
return IsPointInRectangle(xs,ys,x1,y1,x2,y2);
}
return 0;
}
stock IsPointInRectangle(Float:xs, Float:ys, Float:x1, Float:y1, Float:x2, Float:y2) //By Alex "******" Cole (edited by Gabriel "Larcius" Cordes)
{
if(IsBetweenFloats(xs,x1,x2) && IsBetweenFloats(ys,y1,y2))
{
return 1;
}
return 0;
}
stock IsBetweenFloats(Float:f,Float:f1,Float:f2) //By Gabriel "Larcius" Cordes
{
switch(floatcmp(f1, f2))
{
case 0: if(f==f1){return 1;}
case 1: if(f<=f1 && f>=f2){return 1;}
case -1: if(f>=f1 && f<=f2){return 1;}
}
return 0;
}