Raised This Month: $51 Target: $400
 12% 

[COD Killstreak] Fix Plugin (jet)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 04-17-2011 , 05:43   [COD Killstreak] Fix Plugin (jet)
Reply With Quote #1

i gave my best in making ks plugin
but i can't finnish it

here is the code
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <xs>

const iKillStreak 4

new Ubistva[33] = {0,...};
new 
iLevels[iKillStreak] = {3456};

new 
sounds[iKillStreak][] = 
{
    
"mw2/killstreaks/uav_give"
    
"mw2/killstreaks/counter_give",
    
"mw2/killstreaks/air_give",
    
"mw2/killstreaks/emp_give"
};

new 
messages[iKillStreak][] = 
{
    
"UAV^n^tUkucaj /ks da aktiviras!"
    
"Counter-UAV^n^tUkucaj /ks da aktiviras!",
    
"AIRSTRIKE^n^tUkucaj /ks da aktiviras!",
    
"EMP^n^tUkucaj /ks da aktiviras!"
};

new 
g_msgHostageAddg_msgHostageDelg_maxplayers;
new 
imauav[33], imacounteruav[33], imaavion[33], imaemp[33]
new 
bool:uav[33], cblocked[33], empblocked[33]

new 
Float:angles3[33][3];
new 
Float:origin3[33][3];

new 
sprite_blast;
new 
g_bombe[15]

const 
KEYSMENU MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9|MENU_KEY_0

public plugin_init()
{
    
register_plugin("KS","1.0","OvidiuS")
    
register_forward(FM_PlayerPreThink"prethink")
    
register_forward(FM_Touch"PipnuoPaIspario")
    
register_event("DeathMsg""event_death""a");
    
    
register_menu("Game Menu"KEYSMENU"menu_game")
    
register_clcmd("say /ks""killstrk")

    
g_maxplayers get_maxplayers();
}

public 
plugin_precache()
{
    for (new 
0<iKillStreaki++)
        
engfunc(EngFunc_PrecacheSoundsounds[i])

    
precache_sound("ambience/jetflyby1.wav"// Leti Leti Avion
    
precache_sound("mw2/killstreaks/uav_friend.wav"// Dobio si ku*ac
    
precache_sound("mw2/killstreaks/uav_enemy.wav"// Pozvao si ku*ac
    
precache_sound("mw2/killstreaks/air_friend.wav"// kolega ti je mocan
    
precache_sound("mw2/killstreaks/air_enemy.wav"// najebase
    
precache_sound("mw2/killstreaks/emp_effect.wav"// EMP CALL
    
precache_sound("mw2/killstreaks/emp_enemy.wav"// EMP
    
precache_sound("mw2/killstreaks/emp_friend.wav"// EMP
    
precache_model("models/rpgrocket.mdl"// Amerikanci
    
precache_model("models/Mig29.mdl"// f117 samo da se ne srusi
    
sprite_blast precache_model("sprites/dexplo.spr"); // ka booom
}

public 
PipnuoPaIspario(entid// jebena baba
{
    if (!
pev_valid(ent)) 
        return 
FMRES_IGNORED
        
    
new EntClassName[32]
    
entity_get_string(entEV_SZ_classnameEntClassNamecharsmax(EntClassName))

    if(
equal(EntClassName"Bomb"))
    {
        
ka_boom(ent)
        
remove_entity(ent)
        return 
FMRES_IGNORED
    
}
    if(
equal(EntClassName"Airplane"))
    {
        
remove_entity(ent)
        return 
FMRES_IGNORED
    
}
    return 
FMRES_IGNORED
}

public 
prethink(id// magija 
{    
    if(
uav[id])
    {
        new 
PlayerCoords[3];
        new 
Players[32];
        new 
id;
        new 
i;
        new 
playerCount 0;
        
        for (
id=1id<=g_maxplayersid++)
        {
            if(
get_players(PlayersplayerCount"a") && is_user_alive(id))
            {
                
playerCount++; 
            }
            for (
i=1;i<=playerCount;i++)
            {
                
get_user_origin(iPlayerCoords)
        
                
message_begin(MSG_ONE_UNRELIABLEg_msgHostageAdd, {0,0,0}, id)
                
write_byte(id)
                
write_byte(i)        
                
write_coord(PlayerCoords[0])
                
write_coord(PlayerCoords[1])
                
write_coord(PlayerCoords[2])
                
message_end()
        
                
message_begin(MSG_ONE_UNRELIABLEg_msgHostageDel, {0,0,0}, id)
                
write_byte(i)
                
message_end()
            }
        }
    }
    if(
cblocked[id])
    {
        
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("Radar"), _id)
        
write_byte(id)
        
write_coord(0)
        
write_coord(0)
        
write_coord(0)
        
message_end()
    }
    if(
empblocked[id])
    {
        
message_begin(MSG_ONEget_user_msgid("HideWeapon"), _id)
        
write_byte(1<<2)
        
message_end()
    }
}

public 
event_death(id// smrt
{
    new 
killer read_data(1);
    new 
victim read_data(2);
    
    if(
get_user_team(victim) != get_user_team(killer))
        
Ubistva[killer] += 1;
    
    
Ubistva[victim] = 0;
    
    
set_hudmessage(02552550.500.3317.01.0);
    
show_hudmessage(killer"%i"Ubistva[killer]);
    
    for (new 
0<iKillStreaki++) 
    {
        if (
Ubistva[killer] == iLevels[i]) 
        {
            
informisi(killeri);
            return 
PLUGIN_CONTINUE;
        }
    }
    return 
PLUGIN_CONTINUE;
}

informisi(killerlevel// daje se na znanje
{
    
set_hudmessage(255255255, -1.00.3305.02.4);
    
show_hudmessage(killermessages[level]);
    
client_cmd(killer"spk %s"sounds[level]);
    
    return 
PLUGIN_CONTINUE;    
}

public 
client_connect(id// novajlija
{
    
Ubistva[id] = 0
    uav
[id] = false
    cblocked
[id] = false
    empblocked
[id] = false
    imauav
[id] = false
    imacounteruav
[id] = false
    imaemp
[id] = false
}

public 
killstrk(id// koliko ih je ubio
{
    if (!
is_user_alive(id))
        return 
PLUGIN_HANDLED
    
    
if(Ubistva[id] >= 3)
        
imauav[id] = true
    
if(Ubistva[id] >= 4)
        
imacounteruav[id] = true
    
if(Ubistva[id] >= 5)
        
imaavion[id] = true
    
if(Ubistva[id] >= 6)
        
imaemp[id] = true
        
    show_menu_game
(id)
        
    return 
PLUGIN_CONTINUE;
}
    
show_menu_game(id// sta zelite da narucite
{
    static 
menu[250], len
    len 
0
    
    len 
+= formatex(menu[len], charsmax(menu) - len"yOvidiuS | Call Of Duty : Modern Warfare 2^n^n")
    
    if (
imauav[id] && is_user_alive(id))
        
len += formatex(menu[len], charsmax(menu) - len"r1.w UAV^n"id)
        else
        
len += formatex(menu[len], charsmax(menu) - len"d1. UAV^n"id)
    
    if (
imacounteruav[id] && is_user_alive(id))
        
len += formatex(menu[len], charsmax(menu) - len"r2.w Conter-UAV^n"id)
        else
        
len += formatex(menu[len], charsmax(menu) - len"d2. Conter-UAV^n"id)
        
    if (
imaavion[id] && is_user_alive(id))
        
len += formatex(menu[len], charsmax(menu) - len"r3.w Airstrike^n"id)
        else
        
len += formatex(menu[len], charsmax(menu) - len"d3. Airstrike^n"id)
        
    if (
imaemp[id] && is_user_alive(id))
        
len += formatex(menu[len], charsmax(menu) - len"r4.w EMP^n"id)
        else
        
len += formatex(menu[len], charsmax(menu) - len"d4. EMP^n"id)
    
    
len += formatex(menu[len], charsmax(menu) - len"^n^nr0.w Exit"id)
    
    
show_menu(idKEYSMENUmenu, -1"Game Menu")
}

public 
menu_game(idkey// meni, a za sve ostalo tu je mastercard
{
    switch (
key)
    {
        case 
0:
        {
            
uav_player(id)
            
Ubistva[id] -= 3
        
}
        case 
1:
        {
            
radar_block(id)
            
Ubistva[id] -= 4
        
}
        case 
2:
        {
            if (
imaavion[id])
            {
                
Ubistva[id] -= 5
                Create_raid
(id)
                return 
PLUGIN_HANDLED;
            }
        }
        case 
3:
        {
            
emp_block(id
            
Ubistva[id] -= 6
        
}
    }
    
    return 
PLUGIN_HANDLED;
}

public 
uav_player(id// postajem balkanska prorocica
{
    
imauav[id] = false
    set_task
(15.0"remove_uav"id)
    
    if(
is_user_connected(id) && is_user_alive(id))
    {
        
uav[id] = true
        
for(new 1<= g_maxplayersi++)
        {
            if(
get_user_team(i) != get_user_team(id))
            {
                
emit_sound(iCHAN_ITEM"mw2/killstreaks/uav_enemy.wav"1.0ATTN_NORM0PITCH_NORM);
            }
            else if(
get_user_team(i) == get_user_team(id))
            {
                
emit_sound(iCHAN_ITEM"mw2/killstreaks/uav_friend.wav"1.0ATTN_NORM0PITCH_NORM);
            }
        }
    }
}

public 
radar_block(id// i ode radar komsiji
{
    
imacounteruav[id] = false
    
    
for(new 1<= g_maxplayersi++)
    {
        if(
is_user_connected(i) && is_user_alive(i))
        {
            if(
get_user_team(i) != get_user_team(id))
            {
                 
emit_sound(iCHAN_ITEM"mw2/killstreaks/counter_enemy.wav"1.0ATTN_NORM0PITCH_NORM);
                 
cblocked[i] = true
                 set_task
(15.0"remove_block"i)
            }
            else if(
get_user_team(i) == get_user_team(id))
            {
                 
emit_sound(iCHAN_ITEM"mw2/killstreaks/counter_friend.wav"1.0ATTN_NORM0PITCH_NORM);
               }
          }
     }
}  

public 
emp_block(id// slepci
{
    
imaemp[id] = false
    emit_sound
(idCHAN_ITEM"mw2/killstreaks/emp_effect.wav"1.0ATTN_NORM0PITCH_NORM);

    for(new 
1<= g_maxplayersi++)
    {
        if(
is_user_connected(i) && is_user_alive(i))
        {
            if(
get_user_team(i) != get_user_team(id))
            {
                
emit_sound(iCHAN_ITEM"mw2/killstreaks/emp_enemy.wav"1.0ATTN_NORM0PITCH_NORM);
                
empblocked[i] = true
                set_task
(15.0"remove_eblock"i)
            }
            else if(
get_user_team(i) == get_user_team(id))
            {
                
emit_sound(iCHAN_ITEM"mw2/killstreaks/emp_friend.wav"1.0ATTN_NORM0PITCH_NORM);
            }
        }
    }
}

public 
remove_uav(id)
    
uav[id] = false

public remove_cblock(i)
    
cblocked[i] = false

public remove_eblock(i)
    
empblocked[i] = false

public Create_raid(id// leti-leti avion
{
    if (!
is_user_alive(id) || !imaavion[id])
        return 
PLUGIN_HANDLED
    
    get_user_hitpoint
(idorigin3[id])
    
    if(
engfunc(EngFunc_PointContents,origin3) == CONTENTS_SKY)
    {
        
client_print(idprint_center"Ne mozes da pozoves airstrike na to mesto!");
        return 
PLUGIN_HANDLED;
    }
    
imaavion[id] = false;
    
    
entity_get_vector(id,EV_VEC_angles,angles3[id])
    
angles3[id][0] = (angles3[id][0] * 0)
    
    new 
Players[32]
    new 
playerCountiplayer
    get_players
(PlayersplayerCount"c")
    for (
i=0i<playerCounti++)
    {
        
player Players[i
        if (
get_user_team(player) == get_user_team(id)) 
            
emit_sound(playerCHAN_ITEM"mw2/killstreaks/air_friend.wav"1.0ATTN_NORM0PITCH_NORM);
            
        else if (
get_user_team(player) != get_user_team(id))
            
emit_sound(playerCHAN_ITEM"mw2/killstreaks/air_enemy.wav"1.0ATTN_NORM0PITCH_NORM);
    }
    
set_task(7.0"Create_jet"id)
    
set_task(8.0"Create_bombs"id)
    
set_task(8.0"Create_jet"id)
    
set_task(9.5"Create_bombs"id)
    
set_task(9.0"Create_jet"id)
    
set_task(11.0"Create_bombs"id)
    
    return 
PLUGIN_HANDLED
}

public 
Create_bombs(id// miljenko pazi bombina
{
    if(
is_user_alive(id))
    {     
        
emit_sound(idCHAN_ITEM"ambience/jetflyby1.wav"1.0ATTN_NORM0PITCH_NORM);
        
        new 
Float:radlocation[3]; 
        new 
Float:endlocation[3]; 
        new 
Float:randomx
        new 
Float:randomy;
        
        static 
Float:neworigin[3];
        
neworigin origin3[id]
                
        
neworigin[2] += 50;
        
        for(new 
konj 0konj<15konj++) 
        {    
            
randomx random_float(-180.0180.0); 
            
randomy random_float(-180.0180.0); 
                        
            
radlocation[0] = neworigin[0]+1*randomx
            
radlocation[1] = neworigin[1]+1*randomy
            
radlocation[2] = neworigin[2];
                 
            
endlocation[0] = radlocation[0]; 
            
endlocation[1] = radlocation[1];
            
endlocation[2] = radlocation[2] - 5;  
                 
            new 
FloatVeloVec[3]; 
            
VeloVec[0] = (endlocation[0] - radlocation[0])*1+1
            
VeloVec[1] = (endlocation[1] - radlocation[1])*1+1
            
VeloVec[2] = (endlocation[2] - radlocation[2])*1+1;
                        
            
g_bombe[konj] = create_entity("info_target");
                        
            
entity_set_string(g_bombe[konj], EV_SZ_classname"Bomb");
            
entity_set_int(g_bombe[konj], EV_INT_solidSOLID_TRIGGER);
            
entity_set_int(g_bombe[konj], EV_INT_movetypeMOVETYPE_BOUNCE);
            
entity_set_edict(g_bombe[konj], EV_ENT_ownerid); 
            
entity_set_model(g_bombe[konj], "models/rpgrocket.mdl");
            
entity_set_size(g_bombe[konj], Float:{- 16.0, - 16.00.0 }, Float:{ 16.016.012.0 });
            
entity_set_origin(g_bombe[konj], radlocation);
        }
    }
}  

public 
Create_jet(id// f117 ce zagine preko srbije
{
    new 
FloatVelocity[3];
    
    static 
Float:neworigin[3];
    
neworigin origin3[id
    
    
neworigin[2] = neworigin[2] + 250;
    
    static 
Float:newangles[3];
    
newangles angles3[id]
    
    new 
g_samolot create_entity("info_target");
    
    
entity_set_string(g_samolotEV_SZ_classname"Airplane");
    
entity_set_vector(g_samolotEV_VEC_anglesnewangles);
    
entity_set_int(g_samolotEV_INT_solidSOLID_TRIGGER);
    
entity_set_int(g_samolotEV_INT_movetypeMOVETYPE_FLY);
    
entity_set_edict(g_samolotEV_ENT_ownerid); 
    
entity_set_model(g_samolot"models/Mig29.mdl");
    
entity_set_origin(g_samolotneworigin);       
    
VelocityByAim(id1500Velocity);
    
Velocity[2] = neworigin[2]
    
entity_set_vector(g_samolotEV_VEC_velocityVelocity);
}

ka_boom(ent// da nikola ka boom!!
{
    if (! 
pev_valid(ent)) 
        return;
        
    new 
attacker pev(entpev_owner)
        
    new 
Float:entOrigin[3], Float:fDistanceFloat:fDamageFloat:nade_damageFloat:nade_radiusFloat:vOrigin[3]
    
nade_damage =  80.0
    nade_radius 
=  180.0
    pev
(entpev_originentOrigin)
    
entOrigin[2] += 1.0
        
    
new victim = -1
    
while((victim engfunc(EngFunc_FindEntityInSpherevictimentOriginnade_radius)) != 0)
    {
        if(
attacker == victim || !pev_valid(victim))  
            continue;
                
        
pev(victimpev_originvOrigin)
        
fDistance get_distance_f(vOriginentOrigin)
        
fDamage nade_damage floatmul(nade_damagefloatdiv(fDistancenade_radius))
        
fDamage *= estimate_take_hurt(entOriginvictim0)
        if(
fDamage 0.0)
        {
            if(
get_user_team(attacker)!= get_user_team(victim)) 
            {
                if(
pev(victimpev_health))
                { 
                    if(
fDamage 0.0
                        
fakedamage(victim,"AirRaid",fDamage,DMG_BLAST)
                }
            }
        }
    }    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
    
write_byte(TE_EXPLOSION);
    
write_coord(floatround(entOrigin[0]));
    
write_coord(floatround(entOrigin[1])); 
    
write_coord(floatround(entOrigin[2]));
    
write_short(sprite_blast);
    
write_byte(32);
    
write_byte(20); 
    
write_byte(0);
    
message_end();
}

stock get_user_hitpoint(idFloat:hOrigin[3]) // gde sam naciljao
{
    if ( ! 
is_user_aliveid ))
        return 
0;
    
    new 
Float:fOrigin[3], Float:fvAngle[3], Float:fvOffset[3], Float:fvOrigin[3], Float:feOrigin[3];
    new 
Float:fTemp[3];
    
    
pev(idpev_originfOrigin);
    
pev(idpev_v_anglefvAngle);
    
pev(idpev_view_ofsfvOffset);
    
    
xs_vec_add(fOriginfvOffsetfvOrigin);
    
    
engfunc(EngFunc_AngleVectorsfvAnglefeOriginfTempfTemp);
    
    
xs_vec_mul_scalar(feOrigin9999.9feOrigin);
    
xs_vec_add(fvOriginfeOriginfeOrigin);
    
    
engfunc(EngFunc_TraceLinefvOriginfeOrigin0id);
    
global_get(glb_trace_endposhOrigin);
    
    return 
1;
}

stock Float:estimate_take_hurt(Float:fPoint[3], entignored)  // neam pojma
{
    new 
Float:fOrigin[3]
    new 
tr
    
new Float:fFraction
    pev
(entpev_originfOrigin)
    
engfunc(EngFunc_TraceLinefPointfOriginDONT_IGNORE_MONSTERSignoredtr)
    
get_tr2(trTR_flFractionfFraction)
    if (
fFraction == 1.0 || get_tr2(trTR_pHit) == ent)
        return  
1.0
            
    
return  0.6

can someone fix it and optimize it?

main problem is jet :S

Last edited by OvidiuS; 04-22-2011 at 10:25.
OvidiuS is offline
Send a message via Skype™ to OvidiuS
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-17-2011 , 12:02   Re: [COD Killstreak] Fix Plugin (jet)
Reply With Quote #2

PreThink. != efficiency
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
StuntJunkie
Junior Member
Join Date: Apr 2011
Old 04-17-2011 , 12:04   Re: [COD Killstreak] Fix Plugin (jet)
Reply With Quote #3

does this work?
how to put it on my server???
StuntJunkie is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 04-17-2011 , 12:15   Re: [COD Killstreak] Fix Plugin (jet)
Reply With Quote #4

Quote:
Originally Posted by ConnorMcLeod View Post
PreThink. != efficiency
i think i could do the same thing with EventResetHUD
but that's not so big problem...

problem are jet origins...
I want to spawn jet at the location where user called airraid first time, and jet should fly over the location where user aimed when he called jet...

in my case jet fly's over the location where user aimed, but it doesn't spawn on right place :S

Quote:
Originally Posted by StuntJunkie View Post
does this work?
how to put it on my server???
no it doesn't
OvidiuS is offline
Send a message via Skype™ to OvidiuS
StuntJunkie
Junior Member
Join Date: Apr 2011
Old 04-17-2011 , 13:59   Re: [COD Killstreak] Fix Plugin (jet)
Reply With Quote #5

is that killstreak like this?
http://www.youtube.com/watch?v=oMSh2...eature=related
StuntJunkie is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 04-17-2011 , 14:23   Re: [COD Killstreak] Fix Plugin (jet)
Reply With Quote #6

it should be like that, but at this moment, it isn't
OvidiuS is offline
Send a message via Skype™ to OvidiuS
darkbad945
Senior Member
Join Date: May 2008
Old 04-18-2011 , 17:46   Re: [COD Killstreak] Fix Plugin (jet)
Reply With Quote #7

Actually nothing works... i try it and non of the killstreaks work ;\
darkbad945 is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 04-19-2011 , 04:09   Re: [COD Killstreak] Fix Plugin (jet)
Reply With Quote #8

do you have models??
i know that sound's work, so i guess ks works, i tried with bots

i had another version with client_cmd and it's working 100%, but that's also slowhacking, so i wanted to do other way :S
btw thanks for testing
OvidiuS is offline
Send a message via Skype™ to OvidiuS
darkbad945
Senior Member
Join Date: May 2008
Old 04-19-2011 , 06:45   Re: [COD Killstreak] Fix Plugin (jet)
Reply With Quote #9

amm i tested with podbot . The menu opens always but i make 5 kill 4 example and uav doesnt work... i will try all of the killstreaks and i am going to tell u if any of them work at all. As far as the sounds go... i didnt heart any of them and yes i do have the sounds and the movels
darkbad945 is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 04-19-2011 , 08:30   Re: [COD Killstreak] Fix Plugin (jet)
Reply With Quote #10

I don't think you can precache sounds without specifying their extension (.wav).
__________________
hleV 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 09:46.


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