Script is crashing with a command. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Script is crashing with a command. (
/showthread.php?tid=597296)
Script is crashing with a command. -
Ritzy2K - 29.12.2015
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.
Код:
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");
Well, this is the callback.
Код:
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;
}
Help.
Re: Script is crashing with a command. -
Ritzy2K - 29.12.2015
Fixed, im stupid.
Код:
SendServerMessage(playerid, "You've Planted A Warhead In this %s, It Will Explode In 15 Seconds");
this was causing it to crash XD