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

replace armor value


Post New Thread Reply   
 
Thread Tools Display Modes
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 03-20-2014 , 13:56   Re: replace armor value
Reply With Quote #11

Code:
#include <amxmodx> #include <engine> #include <cstrike> #define THINK_INTERVAL 0.05 new gEnts[33]; new bool:gEnabled[33]; public plugin_init() {         register_plugin("Armor Distance", "2.0", "[ --{-@ ]");         register_clcmd("say dis", "clcmdToggle");         register_think("distance_dummy", "entityThink");         new maxplayers = get_maxplayers();     for ( new i = 1 ; i < maxplayers ; i++ ) {         gEnts[i] = create_entity("info_target");                 entity_set_string(gEnts[i], EV_SZ_classname, "distance_dummy");         entity_set_float(gEnts[i], EV_FL_nextthink, get_gametime() + 999999.0);         entity_set_int(gEnts[i], EV_INT_iuser1, i);     } } public client_disconnect(id) {     gEnabled[id] = false;     entity_set_float(gEnts[id], EV_FL_nextthink, get_gametime() + 999999.0); } public clcmdToggle(id) {     if ( ( gEnabled[id] = ! gEnabled[id] ) )         entity_set_float(gEnts[id], EV_FL_nextthink, get_gametime() + THINK_INTERVAL);     else         entity_set_float(gEnts[id], EV_FL_nextthink, get_gametime() + 999999.0); } public entityThink(ent) {     static id, forigin[3], sorigin[3];         id = entity_get_int(ent, EV_INT_iuser1);         if ( ! is_user_alive(id) ) {         entity_set_float(ent, EV_FL_nextthink, get_gametime() + 1.0);         return;     }         get_user_origin(id, forigin);     get_user_origin(id, sorigin, 3);         cs_set_user_armor(id, clamp(get_distance(forigin, sorigin), 0, 999), CS_ARMOR_VESTHELM);         entity_set_float(ent, EV_FL_nextthink, get_gametime() + THINK_INTERVAL); }
__________________

Last edited by Black Rose; 03-20-2014 at 13:57.
Black Rose is offline
elantra86
Member
Join Date: Feb 2014
Old 03-20-2014 , 15:36   Re: replace armor value
Reply With Quote #12

Thank you! Thank you! Thank you!
Godlike!
You are very good man.
Thank you again!

Sorry it's again me)

how to enable this fun by default ?
i change
Code:
gEnabled[id] = false;
to
Code:
gEnabled[id] = true;
but he does not enable.

Last edited by elantra86; 03-21-2014 at 14:23.
elantra86 is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 03-22-2014 , 09:31   Re: replace armor value
Reply With Quote #13

Quote:
Originally Posted by elantra86 View Post
Thank you! Thank you! Thank you!
Godlike!
You are very good man.
Thank you again!

Sorry it's again me)

how to enable this fun by default ?
i change
Code:
gEnabled[id] = false;
to
Code:
gEnabled[id] = true;
but he does not enable.
No
You add this anywhere:
Code:
public client_putinserver(id) {     gEnabled[id] = true;     entity_set_float(gEnts[id], EV_FL_nextthink, get_gametime() + 1.0); }

This one will not go into idle while the player is dead/joined. Instead it will enable/disable automatically on spawn and death.
If you have a respawn plugin they need to use ExecuteHamB() to notify this plugin.

Code:
#include <amxmodx> #include <engine> #include <fakemeta> #include <hamsandwich> #include <cstrike> #define THINK_INTERVAL 0.05 new gEnts[33]; new bool:gEnabled[33]; new gpcvarDefault; public plugin_init() {         register_plugin("Armor Distance", "2.0", "[ --{-@ ]");         register_clcmd("say dis", "clcmdToggle");         RegisterHam(Ham_Killed, "player", "fwdKilled");     RegisterHam(Ham_Spawn, "player", "fwdSpawn", 1);         register_think("distance_dummy", "entThink");         gpcvarDefault = register_cvar("armordistance_default", "1");         new maxplayers = get_maxplayers();     for ( new i = 1 ; i < maxplayers ; i++ ) {         gEnts[i] = create_entity("info_target");                 entity_set_string(gEnts[i], EV_SZ_classname, "distance_dummy");         entity_set_float(gEnts[i], EV_FL_nextthink, get_gametime() + 999999.0);         entity_set_int(gEnts[i], EV_INT_iuser1, i);     } } public client_putinserver(id)     gEnabled[id] = get_pcvar_num(gpcvarDefault) ? true : false; public client_disconnect(id) {     gEnabled[id] = false;     entity_set_float(gEnts[id], EV_FL_nextthink, get_gametime() + 999999.0); } public clcmdToggle(id) {     if ( ( gEnabled[id] = ! gEnabled[id] ) )         entity_set_float(gEnts[id], EV_FL_nextthink, get_gametime() + THINK_INTERVAL);     else         entity_set_float(gEnts[id], EV_FL_nextthink, get_gametime() + 999999.0); } public fwdSpawn(id) {     if ( gEnabled[id] && is_user_alive(id) )         entity_set_float(gEnts[id], EV_FL_nextthink, get_gametime() + THINK_INTERVAL); } public fwdKilled(id) {     if ( gEnabled[id] )         entity_set_float(gEnts[id], EV_FL_nextthink, get_gametime() + 999999.0); } public entThink(ent) {     static id, forigin[3], sorigin[3];         id = entity_get_int(ent, EV_INT_iuser1);         get_user_origin(id, forigin);     get_user_origin(id, sorigin, 3);         set_pev(id, pev_armorvalue, clamp(get_distance(forigin, sorigin), 0, 999));         entity_set_float(ent, EV_FL_nextthink, get_gametime() + THINK_INTERVAL); }
__________________

Last edited by Black Rose; 03-23-2014 at 07:30.
Black Rose is offline
elantra86
Member
Join Date: Feb 2014
Old 03-22-2014 , 17:22   Re: replace armor value
Reply With Quote #14

It's very difficult to me. Understand it.
but thanks i'll try.
thank u very much.
elantra86 is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 03-23-2014 , 03:46   Re: replace armor value
Reply With Quote #15

I don't really recommend cs_set_user_armor used so often since it sends the next message.

PHP Code:
  MESSAGE_BEGIN(MSG_ONEGET_USER_MSG_ID(PLID"ArmorType"NULL), NULLpPlayer);
  
WRITE_BYTE(params[3] == CS_ARMOR_ASSAULTSUIT 0);
  
MESSAGE_END(); 
Better to use Fakemeta natives.
__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
elantra86
Member
Join Date: Feb 2014
Old 03-23-2014 , 08:11   Re: replace armor value
Reply With Quote #16

What harm from it?
& how to solution next message ?
i am beginner can u show full script?
elantra86 is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 03-23-2014 , 08:13   Re: replace armor value
Reply With Quote #17

Quote:
Originally Posted by elantra86 View Post
What harm from it?
& how to solution next message ?
i am beginner can u show full script?
I edited mine with the new native.
__________________
Black Rose is offline
elantra86
Member
Join Date: Feb 2014
Old 03-23-2014 , 08:24   Re: replace armor value
Reply With Quote #18

Ok understand. THX.
I am excused for troubling
elantra86 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 22:10.


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