12.05.2012, 14:42
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]);
}
}
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");
Any ideas?