29.12.2015, 07:17
Hello, i was working at a bomb system, this bomb is suppose to be planted inside a vehicle and get exploded after 15 seconds. There are 3 types of bombs available, but as soon as i use this one, the server goes off itself. I'm pretty sure this is the only peice of code which is crashing the server.
Well, this is the callback.
Help.
Код:
else if (!strcmp(params, "time", true))
{
if(!Inventory_HasItem(playerid, "Warhead"))
return SendErrorMessage(playerid, "You Don't Have Any Warheads In Your Inventory.");
if(!IsPlayerInAnyVehicle(playerid))
return SendErrorMessage(playerid, "You Are Not Inside Any Vehicle.");
if(PlantedBomb[playerid] == 1)
return SendErrorMessage(playerid, "You Already Have A Bomb Planted.");
Inventory_Remove(playerid, "Warhead", 1);
PlantedBomb[playerid] = 1;
SetTimerEx("CarExplosion", 15000, false, "i", playerid);
SendServerMessage(playerid, "You've Planted A Warhead In this %s, It Will Explode In 15 Seconds");
Код:
forward CarExplosion(playerid);
public CarExplosion(playerid)
{
new Float:x,Float:y,Float:z;
GetVehiclePos(VehicleExplode[playerid],x,y,z);
CreateExplosion(x, y, z, 10, 30);
CreateExplosion(x, y, z, 10, 30);
CreateExplosion(x, y+1, z, 6, 30);
CreateExplosion(x, y+2, z, 6, 30);
CreateExplosion(x+1, y, z, 7, 30);
CreateExplosion(x+2, y, z, 7, 30);
SendServerMessage(playerid, "Your Warhead Exploded");
PlantedBomb[playerid] = 0;
return 1;
}

