Some bombs don't detonate?
#1

pawn Код:
public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
{

    if(newkeys & KEY_NO && IsBombPlane(GetVehicleModel(GetPlayerVehicleID(playerid))) )
    {
        new Float:x, Float:y, Float:z, Float:ground;
        GetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
        ground = GetPointZPos(x, y);
        new bombid = 0;
        for(new i; i < MAX_BOMBS; i++)
        {
            if(IsValidObject(bomb[playerid][i]))
            {
                bombid++;
            }
        }
        if(bombid > MAX_BOMBS)
            return SendClientMessage(playerid, RED, "Max bombs dropped, wait for them to explode");
        bomb[playerid][bombid] = CreateObject(1636, x, y, z, 0, 0, 0);
        new time = MoveObject(bomb[playerid][bombid], x, y, ground, 40);
        bombtimer[bombid] = SetTimerEx("Detonate", time, 0, "iii", playerid, bombid, bomb[playerid][bombid]);
    }
    return 1;
}
pawn Код:
PUB:Detonate(playerid, bombid, objectid)
{
    if(objectid == bomb[playerid][bombid])
    {
        new Float:x, Float:y, Float:z;
        GetObjectPos(bomb[playerid][bombid], x, y, z);
        CreateExplosion(x, y, z, 2, 140);
        CreateExplosion(x, y, z, 5, 150);
        DestroyObject(bomb[playerid][bombid]);
    }
}
So here's my code.. I'm using Ryder's MapAndreas include.

The bombs drop and explode, but sometimes, one doesn't , or the whole session doesn't. They just move and sit there.

Also, the

pawn Код:
if(bombid > MAX_BOMBS)
            return SendClientMessage(playerid, RED, "Max bombs dropped, wait for them to explode");
never gets called...

Any ideas?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)