Raised This Month: $ Target: $400
 0% 

[ZP] Extra item : Call in for air raid strike


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Anggara_nothing
Veteran Member
Join Date: Jan 2009
Location: Indonesia
Old 04-26-2009 , 23:03   Re: [ZP] Extra item : Call in for air raid strike
Reply With Quote #1

Quote:
Originally Posted by roadrage View Post
Thanks for the help guys but even without buying it, you can still use it. Also both humans and zombie die when the air support comes.

Here's the code:

Code:
//--------------------------------------------------------------------------------------------------
#define MAXBOMBS 20 // Number of bombs
#define BETWEENTIME 10 // Must be greater or equal to 1
#define RADIUS 800 // Radius of bomb drops
#include <amxmodx> // Amx mod include definitions
#include <fun> // Fun Module
#include <amxmisc> // Useful functions
#include <engine> // Engine Plugin
#include <zombieplague>
//--------------------------------------------------------------------------------------------------
// Declaring info variables
new PLUGIN[]="[ZP]  Extra Air Raid Strike"
new AUTHOR[]="Roadrage"
new VERSION[]="1.0"
new inuse = 0 // variable to tell whether used already or not
new donebombs = MAXBOMBS // tells the engine how many bombs are finished dropping
new bombs[MAXBOMBS] // bomb array
new bool:g_hasAirRaid[33]
new Float:timers[MAXBOMBS] // timers array
new SpriteExplosion
//Extra Item Values
new g_itemid_airraid
new const g_item_name[] = { "Air Raid Strike" }
const g_item_cost = 100
//--------------------------------------------------------------------------------------------------
// initalize function
public plugin_init()
{
 register_plugin(PLUGIN,VERSION,AUTHOR) // Register Function
 register_clcmd("say /airraid", "CMD_airraid") // Register Airraid Command
 g_itemid_airraid = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_HUMAN) 
 register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
}
//--------------------------------------------------------------------------------------------------
// Precache
public plugin_precache()
{
 precache_sound("ambience/siren.wav") // Siren Sound
 precache_sound("ambience/jetflyby1.wav") // Fly By Sound
 precache_model("models/rpgrocket.mdl") // Bomb Model
 SpriteExplosion = precache_model("sprites/bexplo.spr") // precache explosion sprite
}
//--------------------------------------------------------------------------------------------------
// Player buys our upgrade
public zp_extra_item_selected(id, itemid)
{
 if (itemid == g_itemid_airraid){
  g_hasAirRaid[id] = true
  client_print(id, print_center, "You just bought an Air Raid Strike say /airraid to call in a STRIKE!!")
 }
 return PLUGIN_CONTINUE
}
public client_connect(id)
{
 g_hasAirRaid[id] = false
}
public client_disconnect(id)
{
 g_hasAirRaid[id] = false
}
public event_round_start()
{
 for (new i = 1; i <= 32; i++)
  g_hasAirRaid[i] = false
}
public CMD_airraid(id) // Credit to CubicVirtuoso
{
 new k
 
 if (!is_user_alive(id) || zp_get_user_zombie(id) || zp_get_user_survivor(id) ) // Checks if the command user has access
  return PLUGIN_HANDLED
 
 if (g_hasAirRaid[id])
 {
  client_print(id, print_chat, "[ZP] You already purchased an Air Raid Strike")
  return PLUGIN_HANDLED
 }
 
 if (inuse == 1 && donebombs != MAXBOMBS)
 {
  client_print(id, print_center, "You must wait longer before issuing another air strike")
  return PLUGIN_HANDLED
 }
 new name[32];
 get_user_name(id,name,31)
 client_print(0, print_center, "[ZP] %s just called in an air strike raid!! Take cover!!", name);
 
 inuse = 1
 
 emit_sound(id,CHAN_AUTO, "ambience/siren.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
 
 new Float:ftime
 ftime = float(BETWEENTIME)
 
 set_task(ftime, "ACT_resetraid")
 set_task(5.0, "ACT_stopsound")
 set_task(6.0, "ACT_flybysound", id)
 
 set_task(6.0, "CRT_bomb", id)
 
 for (k = 0; k<MAXBOMBS; k++)
 {
  timers[k] = random_float(1.0,2.0)
 }
 
 return PLUGIN_HANDLED
}
public ACT_explodebomb(id,posistion)
{
 new location[3]
 new Float:Vec[3]
 IVecFVec(location, Vec)
 entity_get_vector(bombs[posistion], EV_VEC_origin, Vec)
 FVecIVec(Vec, location)
 location[2] = location[2] + 20
 CRT_explosion(location, SpriteExplosion, 80, 10, 0)
 REM_bomb(posistion)
 
 new players[32]
 new playercount
 
 get_players(players,playercount,"a")
 
 for (new m=0; m<playercount; m++)
 {
  new playerlocation[3]
  new resultdistance
 
  get_user_origin(players[m], playerlocation)
 
  resultdistance = get_distance(playerlocation,location)
 
  if(resultdistance < 400 ||!zp_get_user_zombie(id))
  return PLUGIN_HANDLED
 
  if(resultdistance < 400 || zp_get_user_zombie(id))
  {   
   fakedamage(players[m],"Air Raid",3000.0,DMG_BLAST)
  }
 }
 return PLUGIN_CONTINUE
}
public REM_bomb(posistion)
{
 remove_entity(bombs[posistion])
 bombs[posistion] = 0
}
public CRT_bomb(id)
{
 new location[3]
 new randomlocation[3]
 new endrandomlocation[3]
 new randomx
 new randomy
 
 get_user_origin(id, location)
 
 location[2] = location[2] + 500
 
 donebombs = 0
 
 for (new i=0; i<MAXBOMBS; i++)
 {
  randomx = random_num(-RADIUS,RADIUS)
  randomy = random_num(-RADIUS,RADIUS)
 
  randomlocation[0] = location[0]+1*randomx
  randomlocation[1] = location[1]+1*randomy
  randomlocation[2] = location[2]
 
  new Float:LocVec[3]
  IVecFVec(randomlocation, LocVec)
 
  endrandomlocation[0] = randomlocation[0]
  endrandomlocation[1] = randomlocation[1]
  endrandomlocation[2] = randomlocation[2] - 5
 
  new Float:EndVec[3]
  IVecFVec(endrandomlocation, EndVec)
 
  new Float:VeloVec[3]
  VeloVec[0] = (EndVec[0] - LocVec[0])*1+1
  VeloVec[1] = (EndVec[1] - LocVec[1])*1+1
  VeloVec[2] = (EndVec[2] - LocVec[2])*1+1
 
 
  bombs[i] = create_entity("info_target") // creates the bombs
  if (!bombs[i]) // if not exist
   return PLUGIN_HANDLED
 
  entity_set_string(bombs[i], EV_SZ_classname, "Bomb") // set name
  entity_set_edict(bombs[i], EV_ENT_owner, id) // set owner
  entity_set_int(bombs[i], EV_INT_solid, 1) // not a solid but interactive
  entity_set_int(bombs[i], EV_INT_movetype, 6) // set move type to toss
  entity_set_model(bombs[i], "models/rpgrocket.mdl") // enterance sprite 
  entity_set_origin(bombs[i], LocVec) // start posistion 
  entity_set_vector(bombs[i], EV_VEC_velocity, VeloVec) // follow velocity   
  DispatchSpawn(bombs[i]) // Dispatches the Fire
 }
 
 for (new k = 0; k<MAXBOMBS; k++)
 {
  set_task(timers[k], "ACT_explodebomb", k)
 }
 
 return PLUGIN_CONTINUE
}
public ACT_resetraid()
{
 inuse = 0
 return PLUGIN_CONTINUE
}
public ACT_stopsound()
{
 client_cmd(0,"stopsound") // stops sound on all clients 
 return PLUGIN_CONTINUE
}
public ACT_flybysound(id)
{
 emit_sound(id,CHAN_AUTO, "ambience/jetflyby1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
 return PLUGIN_CONTINUE
}
public CRT_explosion(location[3], spritename, scale, framerate, flags)
{
 message_begin( MSG_BROADCAST, SVC_TEMPENTITY)
 write_byte(3) // TE_EXPLOSION
 write_coord(location[0])
 write_coord(location[1])
 write_coord(location[2])
 write_short(spritename)
 write_byte(scale)
 write_byte(framerate)
 write_byte(flags)
 message_end()
}
update your plug-in, please.
Anggara_nothing is offline
RusasKii
Junior Member
Join Date: Oct 2009
Old 12-24-2009 , 10:06   Re: [ZP] Extra item : Call in for air raid strike
Reply With Quote #2

If you put that 1 second before all the bombs all cts have god mode probably works.
RusasKii is offline
Excalibur.007
Veteran Member
Join Date: Sep 2009
Location: Singapore
Old 12-24-2009 , 20:19   Re: [ZP] Extra item : Call in for air raid strike
Reply With Quote #3

Try using this
Still buggy but better than the current 1
Note: Debug this plugin. I don't know why it spams the console if you used air strike and it doesn't kill anybody if you didn't debug it.
To debug a plugin, open plugins-zplague.ini:
Code:
zp_extra_airstrike.amxx
-->
Code:
zp_extra_airstrike.amxx debug
Attached Files
File Type: sma Get Plugin or Get Source (zp_extra_airstrike.sma - 671 views - 6.7 KB)
Excalibur.007 is offline
tempito
Senior Member
Join Date: Feb 2009
Location: Peru
Old 01-14-2010 , 11:14   Re: [ZP] Extra item : Call in for air raid strike
Reply With Quote #4

Quote:
Originally Posted by Excalibur.007 View Post
Try using this
Still buggy but better than the current 1
Note: Debug this plugin. I don't know why it spams the console if you used air strike and it doesn't kill anybody if you didn't debug it.
To debug a plugin, open plugins-zplague.ini:
Code:
zp_extra_airstrike.amxx
-->
Code:
zp_extra_airstrike.amxx debug

What kind of bug? it could crash our server?
__________________
My very first zp server movie.
http://www.youtube.com/watch?v=yvTmlFr_Y-4 <- now with translation in english

tempito is offline
Excalibur.007
Veteran Member
Join Date: Sep 2009
Location: Singapore
Old 01-14-2010 , 18:35   Re: [ZP] Extra item : Call in for air raid strike
Reply With Quote #5

It won't crash but you need to debug the edited plug-in to make it work. Most bugs is fix inside there.
Excalibur.007 is offline
striker07
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
Old 09-18-2012 , 02:55   Re: [ZP] Extra item : Call in for air raid strike
Reply With Quote #6

Quote:
Originally Posted by Excalibur.007 View Post
Try using this
Still buggy but better than the current 1
Note: Debug this plugin. I don't know why it spams the console if you used air strike and it doesn't kill anybody if you didn't debug it.
I updated yours abit to, added the deathmessages when players got killed, changed the way of targetting to where you where looking when you called th airstrike, all calculations are performed with that 1 location[3].

but now i'm stuck with the problem that there is always 1 explosion effect when infact there should be 12 i cant find a way to fix it yet.

I could use some help for this ^^

use "get source", this version requires rpgx
Attached Files
File Type: sma Get Plugin or Get Source (zp_extra_airstrike1.2.sma - 476 views - 8.2 KB)
__________________

Working on:
[CSGO/CSS] Mmorpg - an extensive XP/level modulair platform
Progress: [♣♣♣♣♣♣♣|♣♣♣]

Last edited by striker07; 09-18-2012 at 02:57.
striker07 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:03.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode