help with explosion
#1

im trying to make explsion happen at ls city hall very few secs this is what i got but it don't work the way it should

Код:
forward Kaboom();
Код:
if (strcmp(cmdtext, "/kaboom", true, 7) == 0)
{
SetTimer("kaboom", 1000, true);
format(string, sizeof(string), "** %s To Dispatch: FIRE REPORTED AT CITYHALL **", sendername);
SendRadioMessage(1, COLOR_BLUE, string);
SendRadioMessage(2, COLOR_BLUE, string);
SendRadioMessage(3, COLOR_BLUE, string);
SendRadioMessage(4, COLOR_BLUE, string);
  return 1;
}
Код:
public Kaboom()
{
  CreateExplosion(1485.4962,-1744.5206,13.5469,1,5);
  return 1;
}
sorry for been such a noob this is the 1st time i ever messed with timers and explosion's
Reply
#2

Quote:
Originally Posted by bristan
im trying to make explsion happen at ls city hall very few secs this is what i got but it don't work the way it should

Код:
forward Kaboom();
Код:
if (!strcmp(cmdtext, "/kaboom", true)
{
SetTimer("Kaboom", 1000, true);
format(string, sizeof(string), "** %s To Dispatch: FIRE REPORTED AT CITYHALL **", sendername);
SendRadioMessage(1, COLOR_BLUE, string);
SendRadioMessage(2, COLOR_BLUE, string);
SendRadioMessage(3, COLOR_BLUE, string);
SendRadioMessage(4, COLOR_BLUE, string);
  return 1;
}
Код:
public Kaboom()
{
  CreateExplosion(1485.4962,-1744.5206,13.5469,1,5);
  return 1;
}
sorry for been such a noob this is the 1st time i ever messed with timers and explosion's
Fixed some stuff in quote....
Try messing with the explosion type and radius if it doesn't work....
And also this will create an explosion at the same place every second and won't stop until you restart the server... if you want to I'll tell you how to stop it....
Reply
#3

yea might be a good idea to have a way to stop it as well lol

ok i did what u fixed and now i got this lol

Код:
(33362) : error 001: expected token: ")", but found "{"
Код:
if (!strcmp(cmdtext, "/kaboom", true)
line 33362 > {
SetTimer("Kaboom", 1000, true);
format(string, sizeof(string), "** %s To Dispatch: FIRE REPORTED AT CITYHALL **", sendername);
SendRadioMessage(1, COLOR_BLUE, string);
SendRadioMessage(2, COLOR_BLUE, string);
SendRadioMessage(3, COLOR_BLUE, string);
SendRadioMessage(4, COLOR_BLUE, string);
  return 1;
}
Reply
#4

Ok I'm gonna make it stop after AMOUNT_OF_BOOMS times (see in script), and there will be explosions not only in the cordinates you gave me but also around them in a random way, you can change the distance from the cordinates you gave me by changing DISTANCE_FROM_CENTER_MAX
pawn Код:
forward Kaboom();
new boomTimes = 0;
new timerkiller;
#define DISTANCE_FROM_CENTER_MAX 30
#define AMOUNT_OF_BOOMS 10 //Change this to the amount of booms you want
pawn Код:
if (!strcmp(cmdtext, "/kaboom", true)
{
  timerkiller = SetTimer("Kaboom", 1000, true);
  format(string, sizeof(string), "** %s To Dispatch: FIRE REPORTED AT CITYHALL **", sendername);
  SendRadioMessage(1, COLOR_BLUE, string);
  SendRadioMessage(2, COLOR_BLUE, string);
  SendRadioMessage(3, COLOR_BLUE, string);
  SendRadioMessage(4, COLOR_BLUE, string);
  return 1;
}
pawn Код:
public Kaboom()
{
  if(boomTimes >= AMOUNT_OF_BOOMS) {
    boomTimes = 0;
    KillTimer(timerkiller);
    return 1;
  }
  CreateExplosion(1485.4962 + random(DISTANCE_FROM_CENTER_MAX),-1744.5206 + random(DISTANCE_FROM_CENTER_MAX) ,13.5469 + random(DISTANCE_FROM_CENTER_MAX) ,1,5);
  boomTimes++;
  return 1;
}
There might be some mistakes since I didn't script for like 2 months and I also didn't check it so... if there are any errors tell me and I'll fix them...
Reply
#5

i got the same error i got when i edited my post up above
Reply
#6

Quote:
Originally Posted by bristan
yea might be a good idea to have a way to stop it as well lol

ok i did what u fixed and now i got this lol

Код:
(33362) : error 001: expected token: ")", but found "{"
Код:
if (!strcmp(cmdtext, "/kaboom", true)
line 33362 > {
SetTimer("Kaboom", 1000, true);
format(string, sizeof(string), "** %s To Dispatch: FIRE REPORTED AT CITYHALL **", sendername);
SendRadioMessage(1, COLOR_BLUE, string);
SendRadioMessage(2, COLOR_BLUE, string);
SendRadioMessage(3, COLOR_BLUE, string);
SendRadioMessage(4, COLOR_BLUE, string);
  return 1;
}
pawn Код:
if (!strcmp(cmdtext, "/kaboom", true)
Should be:
pawn Код:
if (!strcmp(cmdtext, "/kaboom", true))
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)