IsObjectInArea(objectid, Float:minx, Float:maxx, Float:miny, Float:maxy)
{
new Float:x, Float:y, Float:z;
GetObjectPos(objectid, x, y, z);
if (x > minx && x < maxx && y > miny && y < maxy) return 1;
else return 0;
}
public ControlObject()
{
if(IsObjectInArea(BALL, * Pos GangZone *))
{
SendClientMessageToAll(GREEN, "Object in Area...");
}
if(!IsObjectInArea(BALL, * Pos GangZone *))
{
SendClientMessageToAll(RED, "Object Not in Area...");
}
}
GangZoneCreate(Float:minx, Float:miny, Float:maxx, Float:maxy)
IsObjectInArea(objectid, Float:minx, Float:miny, Float:maxx, Float:maxy)
{
new Float:x, Float:y, Float:z;
GetObjectPos(objectid, x, y, z);
if (x > minx && x < maxx && y > miny && y < maxy) return 1;
else return 0;
}
How do you call ControlObject ? |
SetTimer("ControlObject", 1000, 1);
Add print statements everywhere to view the contents of variables at all points in your code. |
new Stats = 0;
forward CheckBall();
SetTimer("CheckBall", 1000, 1);
public OnPlayerCommandText(playerid, cmdtext[]) {
if(strcmp(cmd, "/CreateBall", true) == 0)
{
Stats = 1;
new Float:X, Float:Y, Float:Z;
DestroyObject(Ball);
GetXYZInFrontOfPlayer_ROT(playerid, X, Y, Z, 0.5, 0.0, 0);
Ball = CreateObject(OBJECTBALL, X, Y, Z -0.5, 359.0, 93.0, 10.0);
return 1;
}
}
public CheckBall()
{
if(Stats == 1)
{
if(IsObjectInArea(Ball, 2540.7649,-1514.6029, 2500.8064,-1546.1082))
{
SendClientMessageToAll(COLOR_GREEN, "Ball in Area! ");
}
if(!IsObjectInArea(Ball, 2540.7649,-1514.6029, 2500.8064,-1546.1082))
{
SendClientMessageToAll(COLOR_RED, "Ball not in Area! ");
}
}
}
public CheckBall()
{
if(Stats == 1)
{
if(IsObjectInArea(Ball, 2500.8064, 2540.7649,-1546.1082,-1514.6029))
{
SendClientMessageToAll(COLOR_GREEN, "Ball in Area! ");
}
else
{
SendClientMessageToAll(COLOR_RED, "Ball not in Area! ");
}
}
}