My code should work.
#1

it should explode when target is near the object (While the object is Moving)
pawn Код:
GetPlayerPos(targetid, tx, ty, tz);
        if(IsPlayerInRangeOfPoint(targetid,3.0, x, y, z) && targetid != playerid && IsPlayerInAnyVehicle(targetid))
        {
            for(new i;i<MAX_PLAYERS;i++)
            {
                CreateExplosion(tx, ty, tz, 11, 5.0);
                DestroyObject(gRocketObj[i]);
            }
        }
        else if(!IsPlayerInRangeOfPoint(targetid,3.0, x, y, z))
        {

        }
    }
}
it's under OnPlayerKeyStateChange and i'm using MoveObject
Reply
#2

Show the other pieces of the code,
I don't know what x, y and z are, don't know what targetid is, etc.

Show us all information, and not 40%
Reply
#3

That's fixed.
It dosen't explode now when the object is "Moving" & IsInRange of target

pawn Код:
forward detectbomb(playerid);
public detectbomb(playerid)
{
    new
        Float:tx,
        Float:ty,
        Float:tz,
        Float:x,
        Float:y,
        Float:z;

    for(new targetid = 0; targetid < MAX_PLAYERS; targetid++)
    {
        if(!IsPlayerConnected(targetid) || targetid == playerid || !IsPlayerInAnyVehicle(targetid)) continue;
        GetPlayerPos(targetid, tx, ty, tz);
        GetObjectPos(gRocketObj[playerid], x, y, z);
        if(IsPlayerInRangeOfPoint(targetid, 3.0, x, y, z))
        {
            CreateExplosion(tx, ty, tz, 11, 5.0);
            DestroyObject(gRocketObj[playerid]);
            KillTimer(detecttimer[playerid]);
        }
        else if(!IsPlayerInRangeOfPoint(targetid,3.0, x, y, z))
        {

        }
    }
    return 1;
}
It should explode.
Reply
#4

It still dosen't works :/
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)