Raised This Month: $ Target: $400
 0% 

Ivinsibility depending on ratio


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Tyler_durden (gsr)
Junior Member
Join Date: Apr 2005
Old 06-30-2005 , 13:42   Ivinsibility depending on ratio
Reply With Quote #1

Hi , I'am yrying to set up a plugin thats sets invisibility on a player depending on a ratio
this is what i made but the plugins doesnt work in-game
Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init() {     register_plugin("Invisibilty frags's ratio ","0.2","Tyler")     register_event("Curratio","Set_ratio","b","1=1")     return PLUGIN_CONTINUE } public set_ratio(id) {         new frags = get_user_frags (id)     new deaths = get_user_deaths (id)     new ratio     ratio = frags/deaths         new alphaVal     alphaVal *=20             set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,alphaVal)     new name[33]     get_user_name(id,name,32)     set_hudmessage(200, 100, 0, -2.0, 0.20, 0, 6.0, 6.0, 0.5, 0.15, 1)         show_hudmessage(id,"Visibility: %i ^nRatio: %r",alphaVal,ratio)         return PLUGIN_HANDLED }

my problem
Code:
ratio = frags/deaths

I know this is completely noobish but i am a noob
__________________
IM on xooit.xooit.com
Tyler_durden (gsr) is offline
Send a message via MSN to Tyler_durden (gsr)
faluco
Developer
Join Date: Mar 2005
Location: Valencia, Spain
Old 06-30-2005 , 13:44  
Reply With Quote #2

see if making ratio of type float fixes it
faluco is offline
faluco
Developer
Join Date: Mar 2005
Location: Valencia, Spain
Old 06-30-2005 , 13:54  
Reply With Quote #3

put
Code:
new Float:ratio
faluco is offline
mobytoss
Senior Member
Join Date: Jun 2004
Location: On my TS server
Old 06-30-2005 , 14:13  
Reply With Quote #4

and

Code:
ratio = float(frags/deaths)
__________________
"As we know, There are known knowns. There are things we know we know. We also know There are known unknowns. That is to say We know there are some things We do not know. But there are also unknown unknowns, The ones we don't know We don't know."
mobytoss is offline
Tyler_durden (gsr)
Junior Member
Join Date: Apr 2005
Old 06-30-2005 , 15:10  
Reply With Quote #5

ouh this plugin is making me sick

Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init() {     register_plugin("Invisibilty frags's ratio ","0.2","Tyler")     register_event("Curratio","Set_ratio","b","1=1")     register_cvar("amx_multiplier_invis","18")     register_cvar("amx_min_alphaVal","50")         return PLUGIN_CONTINUE } public set_ratio(id) {         new frags = get_user_frags (id)     new deaths = get_user_deaths (id)     new Float:ratio     new Float:multi     new Float:mulratio         multi = get_cvar_float("amx_multiplier_invis")         ratio = float(frags/deaths)         mulratio = floatmul(ratio,multi)         new float:alpha     new minAlphaVal     minAlphaVal = get_cvar_num("amx_min_alphaVal")     ]alpha = float(minAlphaVal+mulratio)     new alphaVal         alphaVal = floatround(alpha, floatround_round)             set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,alphaVal)     new name[33]     get_user_name(id,name,32)     set_hudmessage(200, 100, 0, -2.0, 0.20, 0, 6.0, 6.0, 0.5, 0.15, 1)     show_hudmessage(id,"Visibility: %i ^nRatio: %r",alphaVal,ratio)         return PLUGIN_HANDLED }

getting errors like this
Code:
/home/groups/amxmodx/tmp/phpWAR6ay.sma(32) : warning 213: tag mismatch
/home/groups/amxmodx/tmp/phpWAR6ay.sma(32 -- 33) : warning 213: tag mismatch
/home/groups/amxmodx/tmp/phpWAR6ay.sma(34) : warning 213: tag mismatch
__________________
IM on xooit.xooit.com
Tyler_durden (gsr) is offline
Send a message via MSN to Tyler_durden (gsr)
faluco
Developer
Join Date: Mar 2005
Location: Valencia, Spain
Old 06-30-2005 , 15:21  
Reply With Quote #6

Code:
]alpha = float(minAlphaVal+mulratio)
note there is a [
edit: i have compiled this and it doesnt give more warnings
Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init() {     register_plugin("Invisibilty frags's ratio ","0.2","Tyler")     register_event("Curratio","Set_ratio","b","1=1")     register_cvar("amx_multiplier_invis","18")     register_cvar("amx_min_alphaVal","50")           return PLUGIN_CONTINUE } public set_ratio(id) {           new frags = get_user_frags (id)     new deaths = get_user_deaths (id)     new Float:ratio     new Float:multi     new Float:mulratio           multi = get_cvar_float("amx_multiplier_invis")           ratio = float(frags/deaths)           mulratio = floatmul(ratio,multi)           new Float:alpha     new minAlphaVal     minAlphaVal = get_cvar_num("amx_min_alphaVal")     alpha = minAlphaVal+mulratio     new alphaVal         alphaVal = floatround(alpha, floatround_round)                 set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,alphaVal)     new name[33]     get_user_name(id,name,32)     set_hudmessage(200, 100, 0, -2.0, 0.20, 0, 6.0, 6.0, 0.5, 0.15, 1)     show_hudmessage(id,"Visibility: %i ^nRatio: %r",alphaVal,ratio)           return PLUGIN_HANDLED }
faluco is offline
Tyler_durden (gsr)
Junior Member
Join Date: Apr 2005
Old 06-30-2005 , 15:28  
Reply With Quote #7

fixed an important MATHS error but i get the same errors as before

added
Code:
// arg deaths cant be equals to 0         if (deaths == 0)         {          return PLUGIN_HANDLED         } else {         return PLUGIN_CONTINUE     }     // ouh fixed it

ok this is the final strip of my code , still errors (memory leaks)


Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init() {     register_plugin("Invisibilty frags's ratio ","0.2","Tyler")     register_event("Curratio","Set_ratio","b","1=1")     register_cvar("amx_multiplier_invis","18")     register_cvar("amx_min_alphaVal","50")     register_event("distance","set_distance","b",1=1")         return PLUGIN_CONTINUE } public set_ratio(id) {         new frags = get_user_frags (id)     new deaths = get_user_deaths (id)     new Float:ratio     // arg deaths cant be equals to 0         if (deaths == 0)         {         return PLUGIN_HANDLED         } else {         return PLUGIN_CONTINUE     }     // ouh fixed it     new Float:multi     new Float:mulratio     multi = get_cvar_float("amx_multiplier_invis")      ratio = float(frags/deaths)     mulratio = floatmul(ratio,multi)        new float:alpha     new minAlphaVal     minAlphaVal = get_cvar_num("amx_min_alphaVal")     alpha = float(minAlphaVal+mulratio)     new alphaVal     alphaVal = floatround(alpha, floatround_round)             set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,alphaVal)     new name[33]     get_user_name(id,name,32)     set_hudmessage(200, 100, 0, -2.0, 0.20, 0, 6.0, 6.0, 0.5, 0.15, 1)     show_hudmessage(id,"Visibility: %i ^nRatio: %r",alphaVal,ratio)         return PLUGIN_CONTINUE } Public set_distance(id) {             /* Get the distance between two entities */     stock get_entity_distance(ent1, ent2)     {         new Float:orig1[3], Float:orig2[3], origin1[3], origin2[3]         entity_get_vector(ent1, EV_VEC_origin, orig1)         for(new a = 0; a < 3; a++)         origin1[a] = floatround(orig1[a])                 entity_get_vector(ent2, EV_VEC_origin, orig2)         for(new b = 0; b < 3; b++)         origin2[b] = floatround(orig2[b])                 return get_distance(origin1, origin2)     }             public client_PreThink( id )     {         new players[32], inum         get_players( players, inum, "a" )         for( new i = 0; i < inum; ++i )         {             if( id == players[i] ) continue                             if( get_entity_distance(id, players[i])  > 350 )                 {                 new player                 player = get_user_name(players[i])                 print_center(id,"Player %p is close to you",player)             }         }         return PLUGIN_CONTINUE             }         return PLUGIN_HANDLED                         }
__________________
IM on xooit.xooit.com
Tyler_durden (gsr) is offline
Send a message via MSN to Tyler_durden (gsr)
moldrat
Junior Member
Join Date: Jun 2005
Old 06-30-2005 , 21:01  
Reply With Quote #8

lol i wonder whats wrong
moldrat is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 06-30-2005 , 21:46  
Reply With Quote #9

color = cool......fix the color and it will probably work just fine
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
Tyler_durden (gsr)
Junior Member
Join Date: Apr 2005
Old 07-01-2005 , 03:34  
Reply With Quote #10

hum thx
i'll do that ,maybe if I use amx edit v2 i'll probabaly get the colors right
__________________
IM on xooit.xooit.com
Tyler_durden (gsr) is offline
Send a message via MSN to Tyler_durden (gsr)
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 00:27.


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