Raised This Month: $ Target: $400
 0% 

Modify this code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Obbin
Senior Member
Join Date: Mar 2005
Location: 192.168.1.3
Old 12-14-2005 , 12:40   Modify this code
Reply With Quote #1

could someone help me to modify this code so everybody that is holding a pistol aims good (no chat messages or anything, remove the unneedded parts like the command i_aim_good! Onley the things needed!)

Code:
/* * *Original plugin by avalanche can be found at: *<a href="http://forums.alliedmods.net/showthread.php?t=20810" target="_blank" rel="nofollow noopener">http://forums.alliedmods.net/showthread.php?t=20810</a> */  #include <amxmodx>  #include <amxmisc>  #include <fakemeta>  #include <engine>  new aiming_good[33];  public plugin_init() {     register_plugin("i aim good","0.13","Avalanche");     register_forward(FM_TraceLine,"fw_traceline");     register_concmd("i_aim_good","cmd_setaim",ADMIN_BAN,"<user> <0|1> - makes user aim good");  }  public client_putinserver(id) {     aiming_good[id] = 0;  }  public cmd_setaim(id,level,cid) {     if(!cmd_access(id,level,cid,3))         return PLUGIN_HANDLED;     new arg1[32], arg2[32];     read_argv(1,arg1,31);     read_argv(2,arg2,31);     new player = cmd_target(id,arg1,10);     if(!player)         return PLUGIN_HANDLED;     if(str_to_num(arg2))         aiming_good[player] = 1;     else         aiming_good[player] = 0;     new playername[32];     get_user_name(player,playername,31);     console_print(id,"* %s %s aims good",playername,(str_to_num(arg2)) ? "now" : "no longer");     return PLUGIN_HANDLED;  }  public fw_traceline(Float:v1[3],Float:v2[3],noMonsters,id) {     if(!is_user_alive(id))         return FMRES_IGNORED;     if(!aiming_good[id])         return FMRES_IGNORED;     // get crosshair aim     new MyAim[3], Float:flMyAim[3];     get_user_origin(id,MyAim,3);     IVecFVec(MyAim,flMyAim);     // set crosshair aim     set_tr(TR_vecEndPos,flMyAim);     // get ent looking at     new ent, body;     get_user_aiming(id,ent,body);     // if looking at something     if(is_valid_ent(ent)) {         set_tr(TR_flFraction,0.1); // 1.0 == no hit, < 1.0 == hit         set_tr(TR_pHit,ent); // entity hit         set_tr(TR_iHitgroup,body); // bodypart hit     }     return FMRES_IGNORED;  }

EDIT: changed to aims again, after all it's avas plugin and i personally think it rocks so whatever.
__________________
Sig(h)!
Obbin is offline
Obbin
Senior Member
Join Date: Mar 2005
Location: 192.168.1.3
Old 12-15-2005 , 01:58  
Reply With Quote #2

Can someone just help me width a width if() statement?
If user is holding a pistol then set aiming_good[id] = 1;
__________________
Sig(h)!
Obbin is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 12-15-2005 , 04:49  
Reply With Quote #3

Register CurWeapon event and check for weapon id.
VEN is offline
Obbin
Senior Member
Join Date: Mar 2005
Location: 192.168.1.3
Old 12-15-2005 , 09:19  
Reply With Quote #4

Like u do when changing a weapons model?
__________________
Sig(h)!
Obbin is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 12-15-2005 , 09:37  
Reply With Quote #5

Please do me a favor and, if you have any reference to "aims good" in the script, to change it to "has good aim" or "aims well".
Brad is offline
Obbin
Senior Member
Join Date: Mar 2005
Location: 192.168.1.3
Old 12-15-2005 , 10:36  
Reply With Quote #6

Quote:
Originally Posted by Brad
Please do me a favor and, if you have any reference to "aims good" in the script, to change it to "has good aim" or "aims well".
Don't understand brad :S
Should i put credits to ava in the code?
Done now anyway!
__________________
Sig(h)!
Obbin is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 12-15-2005 , 10:55  
Reply With Quote #7

All I was trying to get across is that the phrase, "aims good", is not proper English.
Brad is offline
Obbin
Senior Member
Join Date: Mar 2005
Location: 192.168.1.3
Old 12-15-2005 , 12:30  
Reply With Quote #8

Quote:
Originally Posted by Brad
All I was trying to get across is that the phrase, "aims good", is not proper English.
OK

BTW: thx VEN, that worked!
Now my plugin is allmost finished. The onley i have left to do is adding logging (log_amx) when turning on/off and adding help/credit lines.
What my plugin is doing is changing the aim to 1.3 style!

Code:
 #include <amxmodx>  #include <amxmisc>  #include <fakemeta>  #include <engine>  new g_aiming_good[33];  public plugin_init() {     register_plugin("1.3 like aim", "0.1", "Obbin");     register_cvar("amx_13aim", "1");     register_forward(FM_TraceLine, "fw_traceline");     register_event("CurWeapon", "weaponChanged", "be", "1=1");  }  public client_putinserver( id ) {     g_aiming_good[id] = 0;  }  public weaponChanged( id ) {       //Called when user is changing weapon     new clip, ammo, wpnid = get_user_weapon( id, clip, ammo );     //if client is holding a pistol then make bullets go straight even if in the air     if ( wpnid == CSW_USP || wpnid == CSW_ELITE || wpnid == CSW_GLOCK18 || wpnid == CSW_DEAGLE || wpnid == CSW_P228 || wpnid == CSW_FIVESEVEN )     {         g_aiming_good[id] = 1;     }     else     {         g_aiming_good[id] = 0;     }  }  public fw_traceline( Float:v1[3],Float:v2[3],noMonsters,id ) {     //is user alive?     if( !is_user_alive( id ) )         return FMRES_IGNORED;     //if user is holding a rifle/C4/Nade then cancel     if( !g_aiming_good[id] )         return FMRES_IGNORED;     if( !get_cvar_num( "amx_13aim" ) )         return FMRES_IGNORED;     // get crosshair aim     new MyAim[3], Float:flMyAim[3];     get_user_origin( id, MyAim,3 );     IVecFVec( MyAim, flMyAim );     // set crosshair aim     set_tr( TR_vecEndPos, flMyAim );     // get ent looking at     new ent, body;     get_user_aiming( id, ent, body );     // if looking at something     if( is_valid_ent( ent ) )     {         set_tr( TR_flFraction, 0.1 );   // 1.0 == no hit, < 1.0 == hit         set_tr( TR_pHit, ent );     // entity hit         set_tr( TR_iHitgroup, body );   // bodypart hit     }     return FMRES_IGNORED;  }
__________________
Sig(h)!
Obbin is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 12-15-2005 , 14:48  
Reply With Quote #9

Quote:
Originally Posted by Brad
All I was trying to get across is that the phrase, "aims good", is not proper English.
All the code he showed is my plugin. I used incorrect grammar purposefully. If he's going to be using the rest of my plugin as a base I see no reason to change the grammar. Troll somewhere else.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX 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 15:51.


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