Solved Need help to convert Airstrike

Unpaid Requests, Public Plugins
Post Reply
User avatar
GODFATHER
Member
Member
India
Posts: 25
Joined: 7 years ago
Location: INDIA,Karnataka,Banglore
Contact:

Need help to convert Airstrike

#1

Post by GODFATHER » 6 years ago

Need help some one Plz convert Airstrike plugin https://forums.alliedmods.net/showthread.php?t=218822

i tried disastrous error :lol: :P
I Cant keep Calm im a Gamer ;)

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#2

Post by Raheem » 6 years ago

Here:
  • Code: Select all

    #include <zombie_escape> 
    #include <fun> 
    #include <engine> 
    #include <fakemeta_util>
    #include <cstrike>
    
    new PLUGIN[]="Addon: Air Strike"
    new AUTHOR[]="Catastrophe"
    new VERSION[]="1.1"
    
    
    new bool:has_airstrike[33]
    new spr_explode, cache_spr_line
    
    new strike_dam, strike_mode, strike_radius,  strike_timer, g_iItemID
    
    const g_item_cost = 85
    
    public plugin_init()
    {
     register_plugin(PLUGIN,VERSION,AUTHOR) 
     register_clcmd("drop", "call_strike")
     register_concmd("give_airstrike", "give_strike", ADMIN_BAN, "<name/@all> gives an airstrike to the spcified target")
     
     strike_mode = register_cvar("airstrike_mode", "1")
     strike_timer = register_cvar("airstrike_delay", "2.5")
     strike_dam = register_cvar("airstrike_damage", "5000.0")
     strike_radius = register_cvar("airstrike_radius", "500.0")
     
     g_iItemID = ze_register_item("Air-Strike", g_item_cost, 0)
    }
    
    
    public plugin_precache()
    {
    
    
     precache_sound("ambience/siren.wav") 
     precache_sound("ambience/jetflyby1.wav")
     precache_sound("weapons/airstrike_explosion.wav")
     precache_model("models/rpgrocket.mdl") 
     spr_explode = precache_model("sprites/fexplo.spr") 
     cache_spr_line = precache_model("sprites/laserbeam.spr")
    
    
    }
    
    
    public client_connect(id)
    {
    
     has_airstrike[id] = false
    
    }
    
    
    public client_disconnect(id)
    {
    
     has_airstrike[id] = false
    
    }
    
    public give_strike(id,level,cid)
    {
    	if (!cmd_access(id,level,cid,1)) 
    	{
    		console_print(id,"You have no access to that command");
    		return;
    	}
    	if (read_argc() > 2) 
    	{
    		console_print(id,"Too many arguments supplied.");
    		return;
    	}
    	
    	new arg1[32];
    	read_argv(1, arg1, sizeof(arg1) - 1);
    	new player = cmd_target(id, arg1, 10);
    	
    	if ( !player ) 
    	{
    		if ( arg1[0] == '@' ) 
    		{
    			for ( new i = 1; i <= 32; i++ ) 
    			{
    				if ( is_user_connected(i) && !has_airstrike[i]) 
    				{
    					has_airstrike[id] = true
    					emit_sound(id, CHAN_WEAPON, "items/gunpickup2.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
    					client_print(id, print_center, "You just got an Air Strike. Press G holding knife to call in for an AIRSTRIKE !!")
    
    				}
    			}
    		} 
    		else 
    		{
    			client_print(id, print_center, "[ZP] No Such Player/Team");
    			return;
    		}
    	} 
    	else if ( !has_airstrike[player]) 
    	{
    		has_airstrike[id] = true
    		emit_sound(id, CHAN_WEAPON, "items/gunpickup2.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
    		client_print(id, print_center, "You just got an Air Strike. Press G holding knife to call in for an AIRSTRIKE !!")
    	}
    }
    
    public ze_select_item_pre(id, itemid)
    {
        // Return Available and we will block it in Post, So it dosen't affect other plugins
        if (itemid != g_iItemID)
            return ZE_ITEM_AVAILABLE
       
        // Available for Humans only, So don't show it for zombies
        if (ze_is_user_zombie(id))
            return ZE_ITEM_DONT_SHOW
       
        return ZE_ITEM_AVAILABLE
    }
    
    public ze_select_item_post(player, itemid)
    {
        if (itemid != g_iItemID)
            return
    	
    	has_airstrike[player] = true
    	client_print(player, print_center, "You just bought an Air Strike. Press G holding knife to call in for an AIRSTRIKE !!")
    }
    
    public call_strike(id) 
    {
    
           if(!has_airstrike[id] || get_user_weapon(id) != CSW_KNIFE) 
             return;
    
             
           static Float:origin[3]
    
           fm_get_aim_origin(id, origin)
    
           new bomb = create_entity("info_target")   
    
           entity_set_string(bomb, EV_SZ_classname, "Bomb") // set name
           entity_set_edict(bomb, EV_ENT_owner, id) // set owner
           entity_set_origin(bomb, origin) // start posistion 
            
           line(origin)
    
           emit_sound(id,CHAN_AUTO, "ambience/siren.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)  
    
           has_airstrike[id] = false
    
           set_task(get_pcvar_float(strike_timer), "stop_siren")
           set_task(get_pcvar_float(strike_timer)+0.1, "jet_sound", id)
           set_task(get_pcvar_float(strike_timer)+0.2, "make_bomb", id)
           set_task(get_pcvar_float(strike_timer)+0.3, "removebomb", id)
    
    
    
    }
    
    public make_bomb(id)
    {
            
           new ent
    
           ent  = find_ent_by_class(-1,"Bomb")
    
           static Float:origin[3]
           pev(ent, pev_origin, origin)  
    
           CRT_explosion(origin)
           emit_sound(ent, CHAN_WEAPON, "weapons/mortarhit.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
           emit_sound(ent, CHAN_VOICE, "weapons/mortarhit.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM); 
    
           for (new i = 1; i < get_maxplayers(); i++)
           {
    
             shake_screen(i) 
    
             if(is_user_alive(i) && entity_range(i, ent) <= get_pcvar_float(strike_radius) && cs_get_user_team(id) != cs_get_user_team(i))
               {
    
                 if(get_pcvar_num(strike_mode) == 1)
                 {        
                   ExecuteHam(Ham_TakeDamage, i, 0, id, get_pcvar_float(strike_dam), DMG_BULLET)		
                 }
    
                 else
    
                 {
                   ExecuteHam(Ham_Killed, i, 0, id)                
      
                 } 
    
    
               }
    
           }
    
    
    }
      
    public stop_siren()
    {
    
    
     client_cmd(0,"stopsound") // stops sound on all clients 
    
    
    
    }
    
    public jet_sound(id)
    {
    
    
     emit_sound(id,CHAN_AUTO, "ambience/jetflyby1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
     
    
    
    }
    
    public removebomb(id)
    {
    
       new ent = find_ent_by_class(-1,"Bomb")
       remove_entity(ent)
    
    
    
    }
    
    public line(const Float:origin[3])
    {
           engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)
           write_byte(TE_BEAMPOINTS)	// temp entity event
           engfunc(EngFunc_WriteCoord, origin[0]) // x
           engfunc(EngFunc_WriteCoord, origin[1]) // y
           engfunc(EngFunc_WriteCoord, origin[2]) // z
           engfunc(EngFunc_WriteCoord, origin[0]) // x axis
           engfunc(EngFunc_WriteCoord, origin[1]) // y axis
           engfunc(EngFunc_WriteCoord, origin[2]+36.0) // z axis
           write_short(cache_spr_line)	// sprite index
           write_byte(0)			// start frame
           write_byte(0)			// framerate
           write_byte(60)			// life in 0.1's
           write_byte(15)			// line width in 0.1's
           write_byte(0)			// noise amplitude in 0.01's
           write_byte(0)		        // color: red
           write_byte(200)		        // color: green
           write_byte(0)		        // color: blue
           write_byte(200)			// brightness
           write_byte(0)			// scroll speed in 0.1's
           message_end() 
     
    }
    
    public CRT_explosion(const Float:origin[3])
    {
    
       new vec1[3];
       vec1[0] = floatround(origin[0]);
       vec1[1] = floatround(origin[1]);
       vec1[2] = floatround(origin[2]); 
    
    
       message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1) 
       write_byte( 3 ) 
       write_coord(vec1[0]) 
       write_coord(vec1[1]) 
       write_coord(vec1[2] + 20)
       write_short( spr_explode ) 
       write_byte( 50 ) 
       write_byte( 10 )
       write_byte( 0 )  
       message_end() 
    
       message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1) 
       write_byte( 3 ) 
       write_coord(vec1[0] + 250) 
       write_coord(vec1[1] + 250) 
       write_coord(vec1[2] + 20)
       write_short( spr_explode ) 
       write_byte( 50 ) 
       write_byte( 10 )
       write_byte( 0 )  
       message_end()
    
       message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1) 
       write_byte( 3 ) 
       write_coord(vec1[0] -250) 
       write_coord(vec1[1] -250) 
       write_coord(vec1[2] + 20)
       write_short( spr_explode ) 
       write_byte( 50 ) 
       write_byte( 10 )
       write_byte( 0 )  
       message_end()
    
       message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1) 
       write_byte( 3 ) 
       write_coord(vec1[0] +250) 
       write_coord(vec1[1]) 
       write_coord(vec1[2] + 20)
       write_short( spr_explode ) 
       write_byte( 50 ) 
       write_byte( 10 )
       write_byte( 0 )  
       message_end()
    
       message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1) 
       write_byte( 3 ) 
       write_coord(vec1[0] -250) 
       write_coord(vec1[1]) 
       write_coord(vec1[2] + 20)
       write_short( spr_explode ) 
       write_byte( 50 ) 
       write_byte( 10 )
       write_byte( 0 )  
       message_end()
    
       message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1) 
       write_byte( 3 ) 
       write_coord(vec1[0]) 
       write_coord(vec1[1] +250) 
       write_coord(vec1[2] + 20)
       write_short( spr_explode ) 
       write_byte( 50 ) 
       write_byte( 10 )
       write_byte( 0 )  
       message_end()
    
       message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1) 
       write_byte( 3 ) 
       write_coord(vec1[0]) 
       write_coord(vec1[1] - 250) 
       write_coord(vec1[2] + 20)
       write_short( spr_explode ) 
       write_byte( 50 ) 
       write_byte( 10 )
       write_byte( 0 )  
       message_end()
    
       message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1) 
       write_byte( 3 ) 
       write_coord(vec1[0] +250) 
       write_coord(vec1[1] -250) 
       write_coord(vec1[2] + 20)
       write_short( spr_explode ) 
       write_byte( 50 ) 
       write_byte( 10 )
       write_byte( 0 )  
       message_end()
    
       message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1) 
       write_byte( 3 ) 
       write_coord(vec1[0] -250) 
       write_coord(vec1[1] +250) 
       write_coord(vec1[2] + 20)
       write_short( spr_explode ) 
       write_byte( 50 ) 
       write_byte( 10 )
       write_byte( 0 )  
       message_end()
    
    }
    
    stock shake_screen(id)
    {
    	message_begin(MSG_ONE, get_user_msgid("ScreenShake"),{0,0,0}, id)
    	write_short(255<< 14 ) //ammount 
            write_short(10 << 14) //lasts this long 
            write_short(255<< 14) //frequency 
    	message_end()	
    }
He who fails to plan is planning to fail

User avatar
GODFATHER
Member
Member
India
Posts: 25
Joined: 7 years ago
Location: INDIA,Karnataka,Banglore
Contact:

#3

Post by GODFATHER » 6 years ago

thanks bro
I Cant keep Calm im a Gamer ;)

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 4 guests