Not Work...
#1

pawn Код:
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;
}
pawn Код:
public ControlObject()
{

if(IsObjectInArea(BALL, * Pos GangZone *))
{
SendClientMessageToAll(GREEN, "Object in Area...");
}

if(!IsObjectInArea(BALL, * Pos GangZone *))
{
SendClientMessageToAll(RED, "Object Not in Area...");
}

}
____________________

Help me please,
the Function flood SendClientMessageToAll(RED, "Object Not in Area..."); but the Object is in.
The Problem is not * Pos GangZone * beacouse the CreateGangZone work...
Reply
#2

And, how doesn't it work, post what is the problem. And use [ pawn ] [ /pawn ] because this code is HARD to read.
Reply
#3

Yes, sorry... Edit.
Reply
#4

I use:

pawn Код:
GangZoneCreate(Float:minx, Float:miny, Float:maxx, Float:maxy)
I have try to Edit Code:

pawn Код:
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;
}
But nothing...
Reply
#5

Up, please.
Reply
#6

How do you call ControlObject ?
Reply
#7

Quote:

How do you call ControlObject ?

With a simple Timer:

pawn Код:
SetTimer("ControlObject", 1000, 1);
Quote:

Add print statements everywhere to view the contents of variables at all points in your code.

Yes, i print all, but i don't undersand where is the problem...
Reply
#8

pawn Код:
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! ");
}
}
}
I didn't add the scripts for playing (It isn't completed)

****** you mean this?
Reply
#9

Try this

pawn Код:
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! ");
        }
    }
}
Reply
#10

Ok thanks, now try...

Edit: Nothing...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)