MapAndreas (V1.1) weird issue.
#1

While playing around with the MapAndreas (v1.1), I noticed that it makes explosions under some objects.
Such as(It ignores):

Buildings ( House objects, Random shacks etc.. )
Nature or map itself ( Hills .. )

It will always make the explosion when "it" finds a "flat surface", such as:

Roads.

The code:

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_FIRE)
    {
        if (IsPlayerInAnyVehicle(playerid) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 476)
        {
            if(Bombs{playerid} >= 1)
            {
                if(CanUseRBombs{ playerid })
                {
                    Bombs{ playerid }--;
                    new string[74];
                    new Float:VBPos[3];
                    GetVehiclePos(GetPlayerVehicleID(playerid),VBPos[0],VBPos[1],VBPos[2]);
                    objects = CreateObject(1636, VBPos[0], VBPos[1], VBPos[2]-2.5, 0, 0, -26); //Object..
                    MapAndreas_FindZ_For2DCoord(VBPos[0], VBPos[1], VBPos[2]); //Finds the Z
                    MoveObject(objects, VBPos[0], VBPos[1], VBPos[2], 35); //Moves object to the Z(Ground).
                    format(string, sizeof(string), "* Bomb dropped! Remaining bombs: %d/3", Bombs{ playerid });
                    SendClientMessage(playerid, COLOR_RED, string);
                    CanUseRBombs{ playerid } = false;
                    SetTimerEx("AllowRBombs", 2500, false, "i", playerid);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "* You need to wait for the bombs to load before using them again!");
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "* There are no bombs remaining on your plane!");
            }
        }
        return 1; //not sure if i need this return 1; :pp
    }
    return 1;
}

forward AllowRBombs(playerid);
public AllowRBombs(playerid)
{
    CanUseRBombs{ playerid } = true;
    return 1;
}

public OnObjectMoved( objectid )
{
    if(objectid == objects)
    {
        new Float:X, Float:Y, Float:Z;
        GetObjectPos(objects, X,Y,Z);
        CreateExplosion(X,Y,Z, 2, 18.5);
        CreateExplosion(X,Y,Z+4, 7, 4.5);
        DestroyObject( objects );
    }
}
...
Reply
#2

Bump..

I was reading about the 1.1 stuff ( https://sampforum.blast.hk/showthread.php?tid=275492 )

Should i try the "MapAndreas_FindAverageZ(Float: x, Float:y, &Float:z);"?

Quote:

MapAndreas_FindAverageZ is more accurate than the normal FindZ, but also about 3 times slower. It apporximates the z-level using the height neighbor fields, but might return unlogical values sometimes (e.g. at the edge of a house) I recommend using it when you need really exact data only.

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)