Car bomb - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Car bomb (
/showthread.php?tid=184002)
Car bomb -
Criss_Angel - 17.10.2010
So i made this suicide bomber system, works like a charm.But then when i used the same structure to make a car bombb it didnt turn out so good:
pawn Код:
public CarBomb(playerid, vehicleid)
{
new Float: Pos[3];
new pname[246];
GetPlayerName(playerid, pname, sizeof(pname));
GetVehiclePos(vehicleid, Pos[0], Pos[1], Pos[2]);
CreateLoopingExplosion(Pos[0], Pos[1], Pos[2], 6, 60.0, 5);
SendClientMessageToAll(COLOR_RED, "lol");
return 1;
}
That is my Car Bomb timer and this is the cmd (also works for the onfoot):
pawn Код:
if (strcmp("/explode", cmdtext, true, 10) == 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
new pname[245];
SetTimer("CarBomb", 5000, false);
format(pname, sizeof(pname),"%s Detonated a Car bomb!", pname);
SendClientMessageToAll(COLOR_RED, pname);
return 1;
}
else
{
new Float: Pos[3];
new pname[246];
GetPlayerName(playerid, pname, sizeof(pname));
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
CreateLoopingExplosion(Pos[0], Pos[1], Pos[2], 6, 60.0, 5);
format(pname, sizeof(pname),"%s Exploded himself (Suicide Bomber)", pname);
SendClientMessageToAll(COLOR_RED, pname);
}
return 1;
}
Help pl0x
Respuesta: Car bomb -
The_Moddler - 17.10.2010
pawn Код:
if (strcmp("/explode", cmdtext, true, 10) == 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
new pname[25], vehid = GetPlayerVehicleID(playerid);
SetTimerEx("CarBomb", 5000, false, "ii", playerid, vehid);
format(pname, 25,"%s Detonated a Car bomb!", pname);
SendClientMessageToAll(COLOR_RED, pname);
return 1;
}
else
{
new Float: Pos[3];
new pname[25];
GetPlayerName(playerid, pname, sizeof(pname));
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
CreateLoopingExplosion(Pos[0], Pos[1], Pos[2], 6, 60.0, 5);
format(pname, 25,"%s Exploded himself (Suicide Bomber)", pname);
SendClientMessageToAll(COLOR_RED, pname);
}
return 1;
}
You lol'ed at you pname string size, you should read ****** post about strings..
And for the explosion, you have to use SetTimerEx like I did there.
Re: Car bomb -
Criss_Angel - 17.10.2010
Aww thanks dude, your a life saver.