AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Halo_Skins .5 (https://forums.alliedmods.net/showthread.php?t=27128)

FrontLine 04-15-2006 06:01

Halo_Skins .5
 
Haven't touched the juice, or scripting in a while...
Went to obtain some help, which i did from
Ye Olde Slurp :P, suicid3 and hopefully KingPin the man himself.

Anyway i had the idea, to replace the p90 with the MA5B,
for you halo lovers, that's the assault rifle...

Anyway, i got to the part, where i wanted to add tracers,
So i looked at KingPin's edition of X Weapons...

But because the advice below, went with the other way!
Which ended up being betta because of the redirects with damage :P

Anyway, here is the code as it is now.

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <fakemeta> #include <engine> #include <fun> public plugin_init() {     register_plugin("Halo Skins", "0.4", "Front Line")     register_event("ResetHUD", "resetModel", "b")     register_forward(FM_EmitSound, "EmitSound")     register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")         register_forward(FM_TraceLine,"fw_traceline",1)         register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0")     return PLUGIN_CONTINUE } public plugin_precache() {     precache_model("models/player/halo_t/halo_t.mdl")     precache_model("models/player/halo_ct/halo_ct.mdl")       precache_model("models/p_MA5B.mdl")     precache_model("models/v_MA5B.mdl")     precache_model("models/w_MA5B.mdl")     precache_sound("weapons/MA5B-1.wav")     precache_sound("weapons/MA5B_boltpull.wav")     precache_sound("weapons/MA5B_clipin.wav")     precache_sound("weapons/MA5B_clipout.wav")     precache_sound("weapons/MA5B_cliprelease.wav")     precache_sound("weapons/MA5B_draw.wav")     return PLUGIN_CONTINUE } public resetModel(id) {     new CsTeams:userTeam = cs_get_user_team(id)     if (userTeam == CS_TEAM_T) {         cs_set_user_model(id,"halo_t")                 give_item(id,"weapon_p90") // LINE 40                 set_user_health(id,150)                 set_user_armor(id,200)                 give_item(id,"ammo_p90")     }     else if(userTeam == CS_TEAM_CT) {         cs_set_user_model(id,"halo_ct")                 give_item(id,"weapon_p90") // LINE 47                 set_user_health(id,150)                 set_user_armor(id,200)                 give_item(id,"ammo_p90")     }     else {         cs_reset_user_model(id)     }     return PLUGIN_CONTINUE } public Event_CurWeapon(id) {     if(!is_user_alive(id) || !is_user_connected(id))         return PLUGIN_CONTINUE             new temp[2], weapon = get_user_weapon(id, temp[0], temp[1])     if(weapon == CSW_P90)     {             entity_set_string(id, EV_SZ_viewmodel, "models/v_MA5B.mdl")             entity_set_string(id, EV_SZ_weaponmodel, "models/p_MA5B.mdl")     }     return PLUGIN_CONTINUE } public EmitSound(id, channel, sample[]) {     if(!is_user_alive(id))         return FMRES_IGNORED     new temp[2], weapon = get_user_weapon(id, temp[0], temp[1])     if(weapon == CSW_P90)     {             if(equal(sample,"weapons/P90-1.wav"))             {                 emit_sound(id, CHAN_WEAPON, "weapons/MA5B-1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)                 return FMRES_SUPERCEDE             }             else if(equal(sample,"weapons/P90_boltpull.wav"))             {                 emit_sound(id, CHAN_WEAPON, "weapons/MA5B_boltpull.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)                 return FMRES_SUPERCEDE             }             else if(equal(sample,"weapons/P90_clipin.wav"))             {                 emit_sound(id, CHAN_WEAPON, "weapons/MA5B_clipin.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)                   return FMRES_SUPERCEDE             }             else if(equal(sample,"weapons/P90_clipout.wav"))             {                 emit_sound(id, CHAN_WEAPON, "weapons/MA5B_clipout.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)                 return FMRES_SUPERCEDE             }             else if(equal(sample,"weapons/MA5B_cliprelease.wav"))             {                 emit_sound(id, CHAN_WEAPON, "weapons/MA5B_cliprelease.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)                  return FMRES_SUPERCEDE             }             else if(equal(sample,"weapons/P90_draw.wav"))             {                 emit_sound(id, CHAN_WEAPON, "weapons/MA5B_draw.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)                 return FMRES_SUPERCEDE                     }     }     return FMRES_IGNORED } public fw_traceline(Float:v1[3],Float:v2[3],noMonsters,id) {     if(!is_user_connected(id) || !is_user_alive(id))     {         return FMRES_IGNORED;     }     new victim = get_tr(TR_pHit);     if(!is_user_connected(victim) || !is_user_alive(victim))     {         return FMRES_IGNORED;     }     new clip, ammo, weapon = get_user_weapon(id,clip,ammo);     if(weapon != CSW_P90 || clip <= 0)     {         return FMRES_IGNORED;     } new hitplace = get_tr(TR_iHitgroup); // LINE 138     if(hitplace == HIT_LEFTARM) // LINE 140     {         set_tr(TR_iHitgroup,random_num(HIT_STOMACH,HIT_CHEST)); // redirect it an arm     }     else if(hitplace == HIT_RIGHTARM)     {         set_tr(TR_iHitgroup,random_num(HIT_STOMACH,HIT_CHEST)); // redirect to a leg     }     else if(hitplace == HIT_RIGHTLEG)     {         set_tr(TR_iHitgroup,random_num(HIT_STOMACH,HIT_CHEST)); // redirect to a leg     }     else if(hitplace == HIT_LEFTLEG)     {         set_tr(TR_iHitgroup,random_num(HIT_STOMACH,HIT_CHEST)); // redirect to a leg     }         return FMRES_IGNORED;   }

/home/users/amxmodx/tmp3/phpcz7Edd.sma(40) : warning 217: loose indentation
/home/users/amxmodx/tmp3/phpcz7Edd.sma(47) : warning 217: loose indentation
/home/users/amxmodx/tmp3/phpcz7Edd.sma(138) : warning 217: loose indentation
/home/users/amxmodx/tmp3/phpcz7Edd.sma(140) : warning 217: loose indentation

I would like to get rid of these warnings...this little number may be
the reason why i'm still having problems...

Rara Avis 04-15-2006 06:23

You may find some help by looking through this plugin.

FrontLine 04-15-2006 07:19

Exactly what i was looking for!

Thanks bud.

Deviance 04-15-2006 10:20

as i know, you can't replace weapons sounds like that...

http://forums.alliedmods.net/showthread.php?t=26068

FrontLine 04-15-2006 19:52

Pretty dissapointing.
Code that stands now!
And i still need help getting rid of the warnings :)...

/home/users/amxmodx/tmp3/phpp4BYSX.sma(34) : warning 217: loose indentation
/home/users/amxmodx/tmp3/phpp4BYSX.sma(41) : warning 217: loose indentation
/home/users/amxmodx/tmp3/phpp4BYSX.sma(89) : warning 217: loose indentation
/home/users/amxmodx/tmp3/phpp4BYSX.sma(91) : warning 217: loose indentation

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <fakemeta> #include <engine> #include <fun> public plugin_init() {     register_plugin("Halo Skins", "0.5", "Front Line")     register_event("ResetHUD", "resetModel", "b")         register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")         register_forward(FM_TraceLine,"fw_traceline",1)         register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0")     return PLUGIN_CONTINUE } public plugin_precache() {     precache_model("models/player/halo_t/halo_t.mdl")     precache_model("models/player/halo_ct/halo_ct.mdl")       precache_model("models/p_MA5B.mdl")     precache_model("models/v_MA5B.mdl")         return PLUGIN_CONTINUE } public resetModel(id) {     new CsTeams:userTeam = cs_get_user_team(id)     if (userTeam == CS_TEAM_T) {         cs_set_user_model(id,"halo_t")                 give_item(id,"weapon_p90") // LINE 34                 set_user_health(id,150)                 set_user_armor(id,200)                 give_item(id,"ammo_p90")     }     else if(userTeam == CS_TEAM_CT) {         cs_set_user_model(id,"halo_ct")                 give_item(id,"weapon_p90") // LINE 41                 set_user_health(id,150)                 set_user_armor(id,200)                 give_item(id,"ammo_p90")     }     else {         cs_reset_user_model(id)     }     return PLUGIN_CONTINUE } public Event_CurWeapon(id) {     if(!is_user_alive(id) || !is_user_connected(id))         return PLUGIN_CONTINUE             new temp[2], weapon = get_user_weapon(id, temp[0], temp[1])     if(weapon == CSW_P90)     {             entity_set_string(id, EV_SZ_viewmodel, "models/v_MA5B.mdl")             entity_set_string(id, EV_SZ_weaponmodel, "models/p_MA5B.mdl")     }     return PLUGIN_CONTINUE } public fw_traceline(Float:v1[3],Float:v2[3],noMonsters,id) {     if(!is_user_connected(id) || !is_user_alive(id))     {         return FMRES_IGNORED;     }     new victim = get_tr(TR_pHit);     if(!is_user_connected(victim) || !is_user_alive(victim))     {         return FMRES_IGNORED;     }     new clip, ammo, weapon = get_user_weapon(id,clip,ammo);     if(weapon != CSW_P90 || clip <= 0)     {         return FMRES_IGNORED;     } new hitplace = get_tr(TR_iHitgroup); // LINE 89     if(hitplace == HIT_LEFTARM) // LINE 91     {         set_tr(TR_iHitgroup,random_num(HIT_STOMACH,HIT_CHEST)); // redirect it an arm     }     else if(hitplace == HIT_RIGHTARM)     {         set_tr(TR_iHitgroup,random_num(HIT_STOMACH,HIT_CHEST)); // redirect to a leg     }     else if(hitplace == HIT_RIGHTLEG)     {         set_tr(TR_iHitgroup,random_num(HIT_STOMACH,HIT_CHEST)); // redirect to a leg     }     else if(hitplace == HIT_LEFTLEG)     {         set_tr(TR_iHitgroup,random_num(HIT_STOMACH,HIT_CHEST)); // redirect to a leg     }         return FMRES_IGNORED;   }

[ --<-@ ] Black Rose 04-15-2006 23:24

You could ignore those warnings. it will still work.
But still, indent.
If you're using amxx studio ( wich you should ) go Tools > Indenter and *poof* your script will look like this.
Code:
#include <amxmodx>   #include <amxmisc>   #include <cstrike>   #include <fakemeta> #include <engine> #include <fun> public plugin_init() {       register_plugin("Halo Skins", "0.5", "Front Line")       register_event("ResetHUD", "resetModel", "b")           register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")     register_forward(FM_TraceLine,"fw_traceline",1)     register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0")     return PLUGIN_CONTINUE   }   public plugin_precache() {       precache_model("models/player/halo_t/halo_t.mdl")     precache_model("models/player/halo_ct/halo_ct.mdl")       precache_model("models/p_MA5B.mdl")     precache_model("models/v_MA5B.mdl")             return PLUGIN_CONTINUE   }   public resetModel(id)       {         new CsTeams:userTeam = cs_get_user_team(id)     if (userTeam == CS_TEAM_T) {         cs_set_user_model(id,"halo_t")         give_item(id,"weapon_p90") // LINE 34         set_user_health(id,150)         set_user_armor(id,200)         give_item(id,"ammo_p90")     }     else if(userTeam == CS_TEAM_CT) {         cs_set_user_model(id,"halo_ct")         give_item(id,"weapon_p90") // LINE 41         set_user_health(id,150)         set_user_armor(id,200)         give_item(id,"ammo_p90")             }     else {         cs_reset_user_model(id)                     }     return PLUGIN_CONTINUE   }   public Event_CurWeapon(id)     {     if(!is_user_alive(id) || !is_user_connected(id))           return PLUGIN_CONTINUE         new temp[2], weapon = get_user_weapon(id, temp[0], temp[1])     if(weapon == CSW_P90)         {         entity_set_string(id, EV_SZ_viewmodel, "models/v_MA5B.mdl")         entity_set_string(id, EV_SZ_weaponmodel, "models/p_MA5B.mdl")             }     return PLUGIN_CONTINUE } public fw_traceline(Float:v1[3],Float:v2[3],noMonsters,id)       {     if(!is_user_connected(id) || !is_user_alive(id))           {         return FMRES_IGNORED;     }         new victim = get_tr(TR_pHit);         if(!is_user_connected(victim) || !is_user_alive(victim))           {         return FMRES_IGNORED;     }         new clip, ammo, weapon = get_user_weapon(id,clip,ammo);         if(weapon != CSW_P90 || clip <= 0)           {         return FMRES_IGNORED;     }     new hitplace = get_tr(TR_iHitgroup); // LINE 89         if(hitplace == HIT_LEFTARM) // LINE 91         {         set_tr(TR_iHitgroup,random_num(HIT_STOMACH,HIT_CHEST)); // redirect it an arm     }     else if(hitplace == HIT_RIGHTARM)           {         set_tr(TR_iHitgroup,random_num(HIT_STOMACH,HIT_CHEST)); // redirect to a leg     }     else if(hitplace == HIT_RIGHTLEG)         {         set_tr(TR_iHitgroup,random_num(HIT_STOMACH,HIT_CHEST)); // redirect to a leg     }     else if(hitplace == HIT_LEFTLEG)           {         set_tr(TR_iHitgroup,random_num(HIT_STOMACH,HIT_CHEST)); // redirect to a leg     }         return FMRES_IGNORED;     }

FrontLine 04-16-2006 20:25

the plugin seems to be giving a bad load...
Any ideas?

FL.

FrontLine 04-17-2006 09:34

lol my bad chief, both hosts deleted files before re-test...

Al-Good

slurpycof 04-17-2006 10:09

check your names and caps of the filenames just to be sure. Current code works right.


All times are GMT -4. The time now is 05:08.

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