Raised This Month: $ Target: $400
 0% 

[HELP] Repay plugin getting runtime error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BioI-Iazard
Senior Member
Join Date: Sep 2005
Location: Calgary, Alberta
Old 12-02-2007 , 15:06   [HELP] Repay plugin getting runtime error
Reply With Quote #1

This is the repay plugin http://forums.alliedmods.net/showthread.php?p=42816

Basically rewards health when you get HS
I am getting a runtime error for it
I ran it in debug mode and i got this:

L 11/25/2007 - 17:17:57: [AMXX] Displaying debug trace (plugin "repay.amxx")
L 11/25/2007 - 17:17:57: [AMXX] Run time error 10: native error (native "set_user_health")
L 11/25/2007 - 17:17:57: [AMXX] [0] phpkGW2SV.sma::hs_kill (line 130)

I have posted coding below.

Help greatly appreciated
thanks in advance



Code:
/* Repay v1.9    by SentryIII This plugin rewards health for headshots. It takes the damage you do to others and uses that factor to get your health reward.  *******************************************************************************         Ported By KingPin( <a href="mailto:[email protected]">[email protected]</a> ). I take no responsibility     for this file in any way. Use at your own risk. No warranties of any kind.  *******************************************************************************   ADMIN COMMANDS ============== amx_repaypercent - Set Repay Percentage - Usage: amx_repaypercent <number> say /repaylimit - Toggles Whether It Checks If Your Health Exceeds 100 say /repaysave - Toggles If It Saves Your Health Into Next Round. say /repayshow - Toggles Whether Players can see how much Health Was rewarded to players for headshots. USER COMMANDS ============= say /repay - Shows Repay Plugin Info say voterepaylimit - Starts A Vote To Enable/Disable Repay's Health Limit Check say voterepaysave - Starts A Vote To Enable/Disable Repay's Save Health Feature INSTALLATION ============ 1. Compile sma to amx 2. Move repay.amx into addons/amxx/plugins 3. Add a line at the end of addons/amxx/plugins.ini to say:    repay.amx 4. Restart Server OR Change Map 5. Done */ #include <amxmodx> #include <amxmisc> #include <fun> new bool:repayLimit new bool:repaySave static const VERSION[] = "1.9" new healths[33] public plugin_init(){     register_plugin("Repay","VERSION","SentryIII")     register_cvar("amx_repay","25")     register_cvar("amx_repayshow","1")     register_cvar("amx_repaysave","0")     register_cvar("amx_repaylimit","1")     register_clcmd("say /repay","show_repay")     register_clcmd("say cheat","show_info")     register_clcmd("say hack","show_info")     register_clcmd("say voterepaylimit","vote_repaylimit",0,": Starts A Vote To Enable/Disable Repay's Health Limit Feature")     register_clcmd("say voterepaysave","vote_repaysave",0,": Starts A Vote To Enable/Disable Repay's Health Save Feature")     register_concmd("say /repaylimit","toggle_limit",ADMIN_CFG,": Toggles Whether It Checks If Your Health Exceeds 100 Before Rewarding")     register_concmd("say /repayshow","toggle_repayshow",ADMIN_CFG,": Toggles Whether Or Not You See How Much Health Is Rewarded")     register_concmd("say /repaysave","toggle_repaysave",ADMIN_CFG,": Toggles If It Saves Your Health Into Next Round")     register_concmd("amx_repaypercent","set_repaypercent",ADMIN_CFG,": Set Repay Percentage - Usage: amx_repaypercent <number>")     register_menucmd(register_menuid("Repaylimit?"),(1<<0)|(1<<1),"mvote_count")     register_menucmd(register_menuid("Repaysave?"),(1<<0)|(1<<1),"mvote_count")     register_event("DeathMsg","hs_kill","ade","3=1","5=0")     register_event("ResetHUD","load_health","be")     register_logevent("save_health",2,"1=Round_End")     return PLUGIN_CONTINUE } public load_health(id){     if (get_cvar_num("amx_repaysave") == 1){         new health = healths[id]         if (health > 100){             set_user_health(id,health)             client_print(id,print_chat,"* You have %d health because of your previous headshot!",health)         }     }     return PLUGIN_CONTINUE } public save_health(id){     if (get_cvar_num("amx_repaysave") == 1){         for(new i = 1; i <= get_maxplayers(); ++i)             {             healths[i] = get_user_health(i)         }     }     return PLUGIN_CONTINUE } public hs_kill(id){     new killer = read_data(1)     new victim = read_data(2)     new Killer[33]     new Victim[33]     new math, math2     get_user_name(killer, Killer,32)     get_user_name(victim, Victim,32)     if (get_user_health(victim) <= 100){         math = floatround(Float:(((100 - get_user_health(victim)) * (get_cvar_float("amx_repay") / 100)) + get_user_health(killer)), floatround_method:floatround_round)         math2 = floatround(Float:(((100 - get_user_health(victim)) * (get_cvar_float("amx_repay") / 100))), floatround_method:floatround_round)     }     if ((get_user_health(victim) > 100) && (get_user_health(victim) <= 200)){         math = floatround(Float:(((200 - get_user_health(victim)) * (get_cvar_float("amx_repay") / 100)) + get_user_health(killer)), floatround_method:floatround_round)         math2 = floatround(Float:(((200 - get_user_health(victim)) * (get_cvar_float("amx_repay") / 100))), floatround_method:floatround_round)     }     if (get_user_health(victim) > 200){         math = floatround(Float:(((300 - get_user_health(victim)) * (get_cvar_float("amx_repay") / 100)) + get_user_health(killer)), floatround_method:floatround_round)         math2 = floatround(Float:(((300 - get_user_health(victim)) * (get_cvar_float("amx_repay") / 100))), floatround_method:floatround_round)     }     if (get_cvar_num("amx_repaylimit") == 0){         if (get_user_team(killer) != get_user_team(victim) && get_cvar_num("amx_repay") != 0){             set_hudmessage(255,255,255, -1.0, -0.75, 2, 0.02, 10.0, 0.01, 0.1, 9)             set_user_health(killer, math)             if (get_cvar_num("amx_repayshow") == 0){                 show_hudmessage(0, "%s Was Awarded Health^nFor Killing %s With A Headshot!",Killer,Victim)                 log_message("[REPAY] %s Got %d Health : Killed %s",Killer,math2,Victim)             }             if (get_cvar_num("amx_repayshow") == 1){                 show_hudmessage(0, "%s Was Awarded %d Health^nFor Killing %s With A Headshot!",Killer,math2,Victim)                 log_message("[REPAY] %s Got %d Health : Killed %s",Killer,math2,Victim)             }         }     }     if (get_cvar_num("amx_repaylimit") == 1){         if (get_user_health(killer) >= 100 && get_cvar_num("amx_repay") != 0){             set_hudmessage(255,255,255, -1.0, -0.75, 2, 0.02, 10.0, 0.01, 0.1, 9)             show_hudmessage(0, "%s Got A Headshot On %s!^nNo Health Rewarded, MAX Health",Killer,Victim)             log_message("[REPAY] %s (MAX HEALTH) : Killed %s",Killer,Victim)         }         else if (get_user_team(killer) != get_user_team(victim) && get_cvar_num("amx_repay") != 0){             set_hudmessage(255,255,255, -1.0, -0.75, 2, 0.02, 10.0, 0.01, 0.1, 9)             set_user_health(killer, math)             if (get_user_health(killer) > 100){                 set_user_health(killer, 100)             }             if (get_cvar_num("amx_repayshow") == 0){                 show_hudmessage(0, "%s Was Awarded Health^nFor Killing %s With A Headshot!",Killer,Victim)                 log_message("[REPAY] %s Got %d Health : Killed %s",Killer,math2,Victim)             }             if (get_cvar_num("amx_repayshow") == 1){                 if (math > 100){                     show_hudmessage(0, "%s Was Awarded %d Health^nBut Was Limited To Only 100 Health^nFor Killing %s With A Headshot!",Killer,math2,Victim)                     log_message("[REPAY] %s Got %d Health (LIMITED) : Killed %s",Killer,math2,Victim)                 }                 if (math < 100){                     show_hudmessage(0, "%s Was Awarded %d Health^nFor Killing %s With A Headshot!",Killer,math2,Victim)                     log_message("[REPAY] %s Got %d Health : Killed %s",Killer,math2,Victim)                 }             }         }     }     return PLUGIN_CONTINUE } public show_repay(){     new percent = get_cvar_num("amx_repay")     set_hudmessage(255,255,255, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 9)     show_hudmessage(0, "This server is using AMX plugin : Headshot Repay^nRepay Plugin was made by SentryIII.^nCurrent Version: %s^nCurrent Repay Percentage: %d",VERSION,percent)     return PLUGIN_HANDLED } public show_info(){     set_hudmessage(255,255,255, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 9)     show_hudmessage(0, "Repay: A plugin rewards health for headshots.^nIt takes the damage you do to others and uses that factor to get your health reward.^nConsider that before you accuse anybody of cheating.")     return PLUGIN_HANDLED } public set_repaypercent(id,level,cid){     if (!cmd_access(id,level,cid,2))         return PLUGIN_HANDLED     new arg[4]     read_argv(1,arg,3)     set_cvar_num("amx_repay",str_to_num(arg))     return PLUGIN_HANDLED } public toggle_repayshow(id,level,cid){     if (!cmd_access(id,level,cid,2))         return PLUGIN_HANDLED     if (get_cvar_num("amx_repayshow") == 1){         server_cmd("amx_repayshow 0")         set_hudmessage(255,255,255, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 9)         show_hudmessage(0, "Repay^nShow Health OFF")     }     if (get_cvar_num("amx_repayshow") == 0){         server_cmd("amx_repayshow 1")         set_hudmessage(255,255,255, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 9)         show_hudmessage(0, "Repay^nShow Health ON")     }     return PLUGIN_HANDLED } public toggle_repaysave(id,level,cid){     if (!cmd_access(id,level,cid,2))         return PLUGIN_HANDLED     if (get_cvar_num("amx_repaysave") == 1){         server_cmd("amx_repaysave 0")         set_hudmessage(255,255,255, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 9)         show_hudmessage(0, "Repay^nSave Health OFF")     }     if (get_cvar_num("amx_repaysave") == 0){         server_cmd("amx_repaysave 1")         set_hudmessage(255,255,255, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 9)         show_hudmessage(0, "Repay^nSave Health ON")     }     return PLUGIN_HANDLED } public toggle_limit(id,level,cid){     if (!cmd_access(id,level,cid,2))         return PLUGIN_HANDLED     if (get_cvar_num("amx_repaylimit") == 1){         server_cmd("amx_repaylimit 0")         set_hudmessage(255,255,255, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 9)         show_hudmessage(0, "Repay^nCheck Health OFF")     }     if (get_cvar_num("amx_repaylimit") == 0){         server_cmd("amx_repaylimit 1")         set_hudmessage(255,255,255, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 9)         show_hudmessage(0, "Repay^nCheck Health ON")     }     return PLUGIN_HANDLED } new moptions[2] new voterepaylimit[] = "\y[REPAY]Health Limit (100 HP)\w^n^n1. Yes^n2. No" new voterepaysave[] = "\y[REPAY]Save Health (Untill Death)\w^n^n1. Yes^n2. No" public vote_repaylimit(id){     new Float:voting = get_cvar_float("amx_last_voting")     if (voting > get_gametime()) {         client_print(id,print_chat,"* There is already one voting...")         return PLUGIN_HANDLED     }     if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {         client_print(id,print_chat,"* Voting not allowed at this time...")         return PLUGIN_HANDLED     }     new menu_msg[256]     format(menu_msg,255,voterepaylimit,repayLimit ? "No" : "Yes")     new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0     set_cvar_float("amx_last_voting",  get_gametime() + vote_time )     show_menu(0,(1<<0)|(1<<1),menu_msg,floatround(vote_time))     set_task(vote_time,"check_mvotes")     client_print(0,print_chat,"* Voting has started...")     moptions[0]=moptions[1]=0     return PLUGIN_CONTINUE       } public vote_repaysave(id){     new Float:voting = get_cvar_float("amx_last_voting")     if (voting > get_gametime()) {         client_print(id,print_chat,"* There is already one voting...")         return PLUGIN_HANDLED     }     if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {         client_print(id,print_chat,"* Voting not allowed at this time...")         return PLUGIN_HANDLED     }     new menu_msg[256]     format(menu_msg,255,voterepaysave,repaySave ? "No" : "Yes")     new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0     set_cvar_float("amx_last_voting",  get_gametime() + vote_time )     show_menu(0,(1<<0)|(1<<1),menu_msg,floatround(vote_time))     set_task(vote_time,"check_mvotes2")     client_print(0,print_chat,"* Voting has started...")     moptions[0]=moptions[1]=0     return PLUGIN_CONTINUE       } public mvote_count(key){     ++moptions[key]     return PLUGIN_HANDLED } public check_mvotes(){     set_hudmessage(255,255,255, -1.0, -0.75)     if (moptions[0] > moptions[1]){         if (get_cvar_num("amx_repaylimit") == 1){             server_cmd("amx_repaylimit 0")             show_hudmessage(0, "Health Limit^nHas Been Turned OFF")         }         else if (get_cvar_num("amx_repaylimit") == 0){             server_cmd("amx_repaylimit 1")             show_hudmessage(0, "Health Limit^nHas Been Turned ON")         }     }     else{         if (get_cvar_num("amx_repaylimit") == 0){             server_cmd("amx_repaylimit 1")             show_hudmessage(0, "Health Limit^nHas Been Turned ON")         }         else if (get_cvar_num("amx_repaylimit") == 1){             server_cmd("amx_repaylimit 0")             show_hudmessage(0, "Health Limit^nHas Been Turned OFF")         }     }     return PLUGIN_CONTINUE } public check_mvotes2(){     set_hudmessage(255,255,255, -1.0, -0.75)     if (moptions[0] > moptions[1]){         if (get_cvar_num("amx_repaysave") == 1){             server_cmd("amx_repaysave 0")             show_hudmessage(0, "Health Save^nHas Been Turned OFF")         }         else if (get_cvar_num("amx_repaysave") == 0){             server_cmd("amx_repaysave 1")             show_hudmessage(0, "Health Save^nHas Been Turned ON")         }     }     else{         if (get_cvar_num("amx_repaysave") == 0){             server_cmd("amx_repaysave 1")             show_hudmessage(0, "Health Save^nHas Been Turned ON")         }         else if (get_cvar_num("amx_repaysave") == 1){             server_cmd("amx_repaysave 0")             show_hudmessage(0, "Health Save^nHas Been Turned OFF")         }     }     return PLUGIN_CONTINUE }
__________________
Loved by Many ....
Hated by Some ....
Respected by All !!!!
BioI-Iazard is offline
Drak
Veteran Member
Join Date: Jul 2005
Old 12-02-2007 , 15:18   Re: [HELP] Repay plugin getting runtime error
Reply With Quote #2

It wasn't checking if the victim was still alive. That error usually shows when it's setting a dead player's health. Try this:
Code:
/* Repay v1.9    by SentryIII This plugin rewards health for headshots. It takes the damage you do to others and uses that factor to get your health reward.  *******************************************************************************         Ported By KingPin( <a href="mailto:[email protected]">[email protected]</a> ). I take no responsibility     for this file in any way. Use at your own risk. No warranties of any kind.  *******************************************************************************   ADMIN COMMANDS ============== amx_repaypercent - Set Repay Percentage - Usage: amx_repaypercent <number> say /repaylimit - Toggles Whether It Checks If Your Health Exceeds 100 say /repaysave - Toggles If It Saves Your Health Into Next Round. say /repayshow - Toggles Whether Players can see how much Health Was rewarded to players for headshots. USER COMMANDS ============= say /repay - Shows Repay Plugin Info say voterepaylimit - Starts A Vote To Enable/Disable Repay's Health Limit Check say voterepaysave - Starts A Vote To Enable/Disable Repay's Save Health Feature INSTALLATION ============ 1. Compile sma to amx 2. Move repay.amx into addons/amxx/plugins 3. Add a line at the end of addons/amxx/plugins.ini to say:    repay.amx 4. Restart Server OR Change Map 5. Done */ #include <amxmodx> #include <amxmisc> #include <fun> new bool:repayLimit new bool:repaySave static const VERSION[] = "1.9" new healths[33] public plugin_init(){     register_plugin("Repay","VERSION","SentryIII")     register_cvar("amx_repay","25")     register_cvar("amx_repayshow","1")     register_cvar("amx_repaysave","0")     register_cvar("amx_repaylimit","1")     register_clcmd("say /repay","show_repay")     register_clcmd("say cheat","show_info")     register_clcmd("say hack","show_info")     register_clcmd("say voterepaylimit","vote_repaylimit",0,": Starts A Vote To Enable/Disable Repay's Health Limit Feature")     register_clcmd("say voterepaysave","vote_repaysave",0,": Starts A Vote To Enable/Disable Repay's Health Save Feature")     register_concmd("say /repaylimit","toggle_limit",ADMIN_CFG,": Toggles Whether It Checks If Your Health Exceeds 100 Before Rewarding")     register_concmd("say /repayshow","toggle_repayshow",ADMIN_CFG,": Toggles Whether Or Not You See How Much Health Is Rewarded")     register_concmd("say /repaysave","toggle_repaysave",ADMIN_CFG,": Toggles If It Saves Your Health Into Next Round")     register_concmd("amx_repaypercent","set_repaypercent",ADMIN_CFG,": Set Repay Percentage - Usage: amx_repaypercent <number>")     register_menucmd(register_menuid("Repaylimit?"),(1<<0)|(1<<1),"mvote_count")     register_menucmd(register_menuid("Repaysave?"),(1<<0)|(1<<1),"mvote_count")     register_event("DeathMsg","hs_kill","ade","3=1","5=0")     register_event("ResetHUD","load_health","be")     register_logevent("save_health",2,"1=Round_End")     return PLUGIN_CONTINUE } public load_health(id){     if (get_cvar_num("amx_repaysave") == 1){         new health = healths[id]         if (health > 100){             set_user_health(id,health)             client_print(id,print_chat,"* You have %d health because of your previous headshot!",health)         }     }     return PLUGIN_CONTINUE } public save_health(id){     if (get_cvar_num("amx_repaysave") == 1){         for(new i = 1; i <= get_maxplayers(); ++i)             {             healths[i] = get_user_health(i)         }     }     return PLUGIN_CONTINUE } public hs_kill(id) {     new killer = read_data(1)     new victim = read_data(2)     new Killer[33]     new Victim[33]     new math, math2     get_user_name(killer, Killer,32)     get_user_name(victim, Victim,32)         if(is_user_alive(victim))     {         new health = get_user_health(victim)         if(health <= 100)         {                 math = floatround(Float:(((100 - get_user_health(victim)) * (get_cvar_float("amx_repay") / 100)) + get_user_health(killer)), floatround_method:floatround_round)                 math2 = floatround(Float:(((100 - get_user_health(victim)) * (get_cvar_float("amx_repay") / 100))), floatround_method:floatround_round)         }         if(health > 100 && health <= 200)         {                 math = floatround(Float:(((200 - get_user_health(victim)) * (get_cvar_float("amx_repay") / 100)) + get_user_health(killer)), floatround_method:floatround_round)                 math2 = floatround(Float:(((200 - get_user_health(victim)) * (get_cvar_float("amx_repay") / 100))), floatround_method:floatround_round)         }         if(health > 200)         {                 math = floatround(Float:(((300 - get_user_health(victim)) * (get_cvar_float("amx_repay") / 100)) + get_user_health(killer)), floatround_method:floatround_round)                 math2 = floatround(Float:(((300 - get_user_health(victim)) * (get_cvar_float("amx_repay") / 100))), floatround_method:floatround_round)         }         if(get_cvar_num("amx_repaylimit") == 0)         {             if (get_user_team(killer) != get_user_team(victim) && get_cvar_num("amx_repay") != 0)             {                 set_hudmessage(255,255,255, -1.0, -0.75, 2, 0.02, 10.0, 0.01, 0.1, 9)                 set_user_health(killer, math)                             if (get_cvar_num("amx_repayshow") == 0)                 {                     show_hudmessage(0, "%s Was Awarded Health^nFor Killing %s With A Headshot!",Killer,Victim)                     log_message("[REPAY] %s Got %d Health : Killed %s",Killer,math2,Victim)                 }                 if (get_cvar_num("amx_repayshow") == 1)                 {                     show_hudmessage(0, "%s Was Awarded %d Health^nFor Killing %s With A Headshot!",Killer,math2,Victim)                     log_message("[REPAY] %s Got %d Health : Killed %s",Killer,math2,Victim)                 }             }         }         if(get_cvar_num("amx_repaylimit") == 1)         {             if(get_user_health(killer) >= 100 && get_cvar_num("amx_repay") != 0)             {                 set_hudmessage(255,255,255, -1.0, -0.75, 2, 0.02, 10.0, 0.01, 0.1, 9)                 show_hudmessage(0, "%s Got A Headshot On %s!^nNo Health Rewarded, MAX Health",Killer,Victim)                 log_message("[REPAY] %s (MAX HEALTH) : Killed %s",Killer,Victim)             }             else if (get_user_team(killer) != get_user_team(victim) && get_cvar_num("amx_repay") != 0)             {                 set_hudmessage(255,255,255, -1.0, -0.75, 2, 0.02, 10.0, 0.01, 0.1, 9)                 set_user_health(killer, math)                             if(get_user_health(killer) > 100)                 {                     set_user_health(killer, 100)                 }                     if(get_cvar_num("amx_repayshow") == 0)                 {                     show_hudmessage(0, "%s Was Awarded Health^nFor Killing %s With A Headshot!",Killer,Victim)                     log_message("[REPAY] %s Got %d Health : Killed %s",Killer,math2,Victim)                 }                         if(get_cvar_num("amx_repayshow") == 1)                 {                     if (math > 100)                     {                         show_hudmessage(0, "%s Was Awarded %d Health^nBut Was Limited To Only 100 Health^nFor Killing %s With A Headshot!",Killer,math2,Victim)                         log_message("[REPAY] %s Got %d Health (LIMITED) : Killed %s",Killer,math2,Victim)                     }                     if (math < 100)                     {                         show_hudmessage(0, "%s Was Awarded %d Health^nFor Killing %s With A Headshot!",Killer,math2,Victim)                         log_message("[REPAY] %s Got %d Health : Killed %s",Killer,math2,Victim)                     }                 }             }         }     }     return PLUGIN_CONTINUE } public show_repay(){     new percent = get_cvar_num("amx_repay")     set_hudmessage(255,255,255, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 9)     show_hudmessage(0, "This server is using AMX plugin : Headshot Repay^nRepay Plugin was made by SentryIII.^nCurrent Version: %s^nCurrent Repay Percentage: %d",VERSION,percent)     return PLUGIN_HANDLED } public show_info(){     set_hudmessage(255,255,255, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 9)     show_hudmessage(0, "Repay: A plugin rewards health for headshots.^nIt takes the damage you do to others and uses that factor to get your health reward.^nConsider that before you accuse anybody of cheating.")     return PLUGIN_HANDLED } public set_repaypercent(id,level,cid){     if (!cmd_access(id,level,cid,2))         return PLUGIN_HANDLED     new arg[4]     read_argv(1,arg,3)     set_cvar_num("amx_repay",str_to_num(arg))     return PLUGIN_HANDLED } public toggle_repayshow(id,level,cid){     if (!cmd_access(id,level,cid,2))         return PLUGIN_HANDLED     if (get_cvar_num("amx_repayshow") == 1){         server_cmd("amx_repayshow 0")         set_hudmessage(255,255,255, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 9)         show_hudmessage(0, "Repay^nShow Health OFF")     }     if (get_cvar_num("amx_repayshow") == 0){         server_cmd("amx_repayshow 1")         set_hudmessage(255,255,255, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 9)         show_hudmessage(0, "Repay^nShow Health ON")     }     return PLUGIN_HANDLED } public toggle_repaysave(id,level,cid){     if (!cmd_access(id,level,cid,2))         return PLUGIN_HANDLED     if (get_cvar_num("amx_repaysave") == 1){         server_cmd("amx_repaysave 0")         set_hudmessage(255,255,255, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 9)         show_hudmessage(0, "Repay^nSave Health OFF")     }     if (get_cvar_num("amx_repaysave") == 0){         server_cmd("amx_repaysave 1")         set_hudmessage(255,255,255, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 9)         show_hudmessage(0, "Repay^nSave Health ON")     }     return PLUGIN_HANDLED } public toggle_limit(id,level,cid){     if (!cmd_access(id,level,cid,2))         return PLUGIN_HANDLED     if (get_cvar_num("amx_repaylimit") == 1){         server_cmd("amx_repaylimit 0")         set_hudmessage(255,255,255, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 9)         show_hudmessage(0, "Repay^nCheck Health OFF")     }     if (get_cvar_num("amx_repaylimit") == 0){         server_cmd("amx_repaylimit 1")         set_hudmessage(255,255,255, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 9)         show_hudmessage(0, "Repay^nCheck Health ON")     }     return PLUGIN_HANDLED } new moptions[2] new voterepaylimit[] = "\y[REPAY]Health Limit (100 HP)\w^n^n1. Yes^n2. No" new voterepaysave[] = "\y[REPAY]Save Health (Untill Death)\w^n^n1. Yes^n2. No" public vote_repaylimit(id){     new Float:voting = get_cvar_float("amx_last_voting")     if (voting > get_gametime()) {         client_print(id,print_chat,"* There is already one voting...")         return PLUGIN_HANDLED     }     if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {         client_print(id,print_chat,"* Voting not allowed at this time...")         return PLUGIN_HANDLED     }     new menu_msg[256]     format(menu_msg,255,voterepaylimit,repayLimit ? "No" : "Yes")     new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0     set_cvar_float("amx_last_voting",  get_gametime() + vote_time )     show_menu(0,(1<<0)|(1<<1),menu_msg,floatround(vote_time))     set_task(vote_time,"check_mvotes")     client_print(0,print_chat,"* Voting has started...")     moptions[0]=moptions[1]=0     return PLUGIN_CONTINUE       } public vote_repaysave(id){     new Float:voting = get_cvar_float("amx_last_voting")     if (voting > get_gametime()) {         client_print(id,print_chat,"* There is already one voting...")         return PLUGIN_HANDLED     }     if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {         client_print(id,print_chat,"* Voting not allowed at this time...")         return PLUGIN_HANDLED     }     new menu_msg[256]     format(menu_msg,255,voterepaysave,repaySave ? "No" : "Yes")     new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0     set_cvar_float("amx_last_voting",  get_gametime() + vote_time )     show_menu(0,(1<<0)|(1<<1),menu_msg,floatround(vote_time))     set_task(vote_time,"check_mvotes2")     client_print(0,print_chat,"* Voting has started...")     moptions[0]=moptions[1]=0     return PLUGIN_CONTINUE       } public mvote_count(key){     ++moptions[key]     return PLUGIN_HANDLED } public check_mvotes(){     set_hudmessage(255,255,255, -1.0, -0.75)     if (moptions[0] > moptions[1]){         if (get_cvar_num("amx_repaylimit") == 1){             server_cmd("amx_repaylimit 0")             show_hudmessage(0, "Health Limit^nHas Been Turned OFF")         }         else if (get_cvar_num("amx_repaylimit") == 0){             server_cmd("amx_repaylimit 1")             show_hudmessage(0, "Health Limit^nHas Been Turned ON")         }     }     else{         if (get_cvar_num("amx_repaylimit") == 0){             server_cmd("amx_repaylimit 1")             show_hudmessage(0, "Health Limit^nHas Been Turned ON")         }         else if (get_cvar_num("amx_repaylimit") == 1){             server_cmd("amx_repaylimit 0")             show_hudmessage(0, "Health Limit^nHas Been Turned OFF")         }     }     return PLUGIN_CONTINUE } public check_mvotes2(){     set_hudmessage(255,255,255, -1.0, -0.75)     if (moptions[0] > moptions[1]){         if (get_cvar_num("amx_repaysave") == 1){             server_cmd("amx_repaysave 0")             show_hudmessage(0, "Health Save^nHas Been Turned OFF")         }         else if (get_cvar_num("amx_repaysave") == 0){             server_cmd("amx_repaysave 1")             show_hudmessage(0, "Health Save^nHas Been Turned ON")         }     }     else{         if (get_cvar_num("amx_repaysave") == 0){             server_cmd("amx_repaysave 1")             show_hudmessage(0, "Health Save^nHas Been Turned ON")         }         else if (get_cvar_num("amx_repaysave") == 1){             server_cmd("amx_repaysave 0")             show_hudmessage(0, "Health Save^nHas Been Turned OFF")         }     }     return PLUGIN_CONTINUE }
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
BioI-Iazard
Senior Member
Join Date: Sep 2005
Location: Calgary, Alberta
Old 12-04-2007 , 16:00   Re: [HELP] Repay plugin getting runtime error
Reply With Quote #3

Now the plugin doesnt seem to work...
Plugin is compiling fine
Its running when i type amx_plugins in console

Not sure what went wrong
__________________
Loved by Many ....
Hated by Some ....
Respected by All !!!!
BioI-Iazard is offline
Drak
Veteran Member
Join Date: Jul 2005
Old 12-04-2007 , 19:18   Re: [HELP] Repay plugin getting runtime error
Reply With Quote #4

Try this:
Code:
#include <amxmodx> #include <amxmisc> #include <fun> new bool:repayLimit new bool:repaySave static const VERSION[] = "1.9" new healths[33] public plugin_init(){     register_plugin("Repay","VERSION","SentryIII")     register_cvar("amx_repay","25")     register_cvar("amx_repayshow","1")     register_cvar("amx_repaysave","0")     register_cvar("amx_repaylimit","1")     register_clcmd("say /repay","show_repay")     register_clcmd("say cheat","show_info")     register_clcmd("say hack","show_info")     register_clcmd("say voterepaylimit","vote_repaylimit",0,": Starts A Vote To Enable/Disable Repay's Health Limit Feature")     register_clcmd("say voterepaysave","vote_repaysave",0,": Starts A Vote To Enable/Disable Repay's Health Save Feature")     register_concmd("say /repaylimit","toggle_limit",ADMIN_CFG,": Toggles Whether It Checks If Your Health Exceeds 100 Before Rewarding")     register_concmd("say /repayshow","toggle_repayshow",ADMIN_CFG,": Toggles Whether Or Not You See How Much Health Is Rewarded")     register_concmd("say /repaysave","toggle_repaysave",ADMIN_CFG,": Toggles If It Saves Your Health Into Next Round")     register_concmd("amx_repaypercent","set_repaypercent",ADMIN_CFG,": Set Repay Percentage - Usage: amx_repaypercent <number>")     register_menucmd(register_menuid("Repaylimit?"),(1<<0)|(1<<1),"mvote_count")     register_menucmd(register_menuid("Repaysave?"),(1<<0)|(1<<1),"mvote_count")     register_event("DeathMsg","hs_kill","ade","3=1","5=0")     register_event("ResetHUD","load_health","be")     register_logevent("save_health",2,"1=Round_End")     return PLUGIN_CONTINUE } public load_health(id){     if (get_cvar_num("amx_repaysave") == 1){         new health = healths[id]         if (health > 100){             set_user_health(id,health)             client_print(id,print_chat,"* You have %d health because of your previous headshot!",health)         }     }     return PLUGIN_CONTINUE } public save_health(id){     if (get_cvar_num("amx_repaysave") == 1){         for(new i = 1; i <= get_maxplayers(); ++i)         {             healths[i] = get_user_health(i)         }     }     return PLUGIN_CONTINUE } public hs_kill(id) {     new killer = read_data(1)     new victim = read_data(2)     new Killer[33]     new Victim[33]     new math, math2     get_user_name(killer, Killer,32)     get_user_name(victim, Victim,32)         if(is_user_alive(victim) && is_user_alive(killer))     {         new VicHealth = get_user_health(victim);         new KillerHealth = get_user_health(killer);                 if(VicHealth <= 100)         {             math = floatround(Float:(((100 - VicHealth) * (get_cvar_float("amx_repay") / 100)) + KillerHealth), floatround_method:floatround_round)             math2 = floatround(Float:(((100 - VicHealth) * (get_cvar_float("amx_repay") / 100))), floatround_method:floatround_round)         }         if(VicHealth > 100 && VicHealth <= 200)         {             math = floatround(Float:(((200 - VicHealth) * (get_cvar_float("amx_repay") / 100)) + KillerHealth), floatround_method:floatround_round)             math2 = floatround(Float:(((200 - VicHealth) * (get_cvar_float("amx_repay") / 100))), floatround_method:floatround_round)         }         if(VicHealth > 200)         {             math = floatround(Float:(((300 - VicHealth) * (get_cvar_float("amx_repay") / 100)) + KillerHealth), floatround_method:floatround_round)             math2 = floatround(Float:(((300 - VicHealth) * (get_cvar_float("amx_repay") / 100))), floatround_method:floatround_round)         }     }         if(get_cvar_num("amx_repaylimit") == 0)     {         if (get_user_team(killer) != get_user_team(victim) && get_cvar_num("amx_repay") != 0)         {             set_hudmessage(255,255,255, -1.0, -0.75, 2, 0.02, 10.0, 0.01, 0.1, 9)             set_user_health(killer, math)                             if (get_cvar_num("amx_repayshow") == 0)             {                 show_hudmessage(0, "%s Was Awarded Health^nFor Killing %s With A Headshot!",Killer,Victim)                 log_message("[REPAY] %s Got %d Health : Killed %s",Killer,math2,Victim)             }             if (get_cvar_num("amx_repayshow") == 1)             {                 show_hudmessage(0, "%s Was Awarded %d Health^nFor Killing %s With A Headshot!",Killer,math2,Victim)                 log_message("[REPAY] %s Got %d Health : Killed %s",Killer,math2,Victim)             }         }     }     if(get_cvar_num("amx_repaylimit") == 1)     {         if(get_user_health(killer) >= 100 && get_cvar_num("amx_repay") != 0)         {             set_hudmessage(255,255,255, -1.0, -0.75, 2, 0.02, 10.0, 0.01, 0.1, 9)             show_hudmessage(0, "%s Got A Headshot On %s!^nNo Health Rewarded, MAX Health",Killer,Victim)             log_message("[REPAY] %s (MAX HEALTH) : Killed %s",Killer,Victim)         }         else if (get_user_team(killer) != get_user_team(victim) && get_cvar_num("amx_repay") != 0)         {             set_hudmessage(255,255,255, -1.0, -0.75, 2, 0.02, 10.0, 0.01, 0.1, 9)             set_user_health(killer, math)                             if(get_user_health(killer) > 100)             {                 set_user_health(killer, 100)             }                                 if(get_cvar_num("amx_repayshow") == 0)             {                 show_hudmessage(0, "%s Was Awarded Health^nFor Killing %s With A Headshot!",Killer,Victim)                 log_message("[REPAY] %s Got %d Health : Killed %s",Killer,math2,Victim)             }                   if(get_cvar_num("amx_repayshow") == 1)             {                 if (math > 100)                 {                     show_hudmessage(0, "%s Was Awarded %d Health^nBut Was Limited To Only 100 Health^nFor Killing %s With A Headshot!",Killer,math2,Victim)                     log_message("[REPAY] %s Got %d Health (LIMITED) : Killed %s",Killer,math2,Victim)                 }                 if (math < 100)                 {                     show_hudmessage(0, "%s Was Awarded %d Health^nFor Killing %s With A Headshot!",Killer,math2,Victim)                     log_message("[REPAY] %s Got %d Health : Killed %s",Killer,math2,Victim)                 }             }         }     }     return PLUGIN_CONTINUE } public show_repay(){     new percent = get_cvar_num("amx_repay")     set_hudmessage(255,255,255, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 9)     show_hudmessage(0, "This server is using AMX plugin : Headshot Repay^nRepay Plugin was made by SentryIII.^nCurrent Version: %s^nCurrent Repay Percentage: %d",VERSION,percent)     return PLUGIN_HANDLED } public show_info(){     set_hudmessage(255,255,255, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 9)     show_hudmessage(0, "Repay: A plugin rewards health for headshots.^nIt takes the damage you do to others and uses that factor to get your health reward.^nConsider that before you accuse anybody of cheating.")     return PLUGIN_HANDLED } public set_repaypercent(id,level,cid){     if (!cmd_access(id,level,cid,2))         return PLUGIN_HANDLED     new arg[4]     read_argv(1,arg,3)     set_cvar_num("amx_repay",str_to_num(arg))     return PLUGIN_HANDLED } public toggle_repayshow(id,level,cid){     if (!cmd_access(id,level,cid,2))         return PLUGIN_HANDLED     if (get_cvar_num("amx_repayshow") == 1){         server_cmd("amx_repayshow 0")         set_hudmessage(255,255,255, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 9)         show_hudmessage(0, "Repay^nShow Health OFF")     }     if (get_cvar_num("amx_repayshow") == 0){         server_cmd("amx_repayshow 1")         set_hudmessage(255,255,255, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 9)         show_hudmessage(0, "Repay^nShow Health ON")     }     return PLUGIN_HANDLED } public toggle_repaysave(id,level,cid){     if (!cmd_access(id,level,cid,2))         return PLUGIN_HANDLED     if (get_cvar_num("amx_repaysave") == 1){         server_cmd("amx_repaysave 0")         set_hudmessage(255,255,255, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 9)         show_hudmessage(0, "Repay^nSave Health OFF")     }     if (get_cvar_num("amx_repaysave") == 0){         server_cmd("amx_repaysave 1")         set_hudmessage(255,255,255, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 9)         show_hudmessage(0, "Repay^nSave Health ON")     }     return PLUGIN_HANDLED } public toggle_limit(id,level,cid){     if (!cmd_access(id,level,cid,2))         return PLUGIN_HANDLED     if (get_cvar_num("amx_repaylimit") == 1){         server_cmd("amx_repaylimit 0")         set_hudmessage(255,255,255, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 9)         show_hudmessage(0, "Repay^nCheck Health OFF")     }     if (get_cvar_num("amx_repaylimit") == 0){         server_cmd("amx_repaylimit 1")         set_hudmessage(255,255,255, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 9)         show_hudmessage(0, "Repay^nCheck Health ON")     }     return PLUGIN_HANDLED } new moptions[2] new voterepaylimit[] = "\y[REPAY]Health Limit (100 HP)\w^n^n1. Yes^n2. No" new voterepaysave[] = "\y[REPAY]Save Health (Untill Death)\w^n^n1. Yes^n2. No" public vote_repaylimit(id){     new Float:voting = get_cvar_float("amx_last_voting")     if (voting > get_gametime()) {         client_print(id,print_chat,"* There is already one voting...")         return PLUGIN_HANDLED     }         if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {         client_print(id,print_chat,"* Voting not allowed at this time...")         return PLUGIN_HANDLED     }         new menu_msg[256]     format(menu_msg,255,voterepaylimit,repayLimit ? "No" : "Yes")     new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0     set_cvar_float("amx_last_voting",  get_gametime() + vote_time )     show_menu(0,(1<<0)|(1<<1),menu_msg,floatround(vote_time))     set_task(vote_time,"check_mvotes")     client_print(0,print_chat,"* Voting has started...")     moptions[0]=moptions[1]=0     return PLUGIN_CONTINUE       } public vote_repaysave(id){     new Float:voting = get_cvar_float("amx_last_voting")     if (voting > get_gametime()) {         client_print(id,print_chat,"* There is already one voting...")         return PLUGIN_HANDLED     }         if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {         client_print(id,print_chat,"* Voting not allowed at this time...")         return PLUGIN_HANDLED     }         new menu_msg[256]     format(menu_msg,255,voterepaysave,repaySave ? "No" : "Yes")     new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0     set_cvar_float("amx_last_voting",  get_gametime() + vote_time )     show_menu(0,(1<<0)|(1<<1),menu_msg,floatround(vote_time))     set_task(vote_time,"check_mvotes2")     client_print(0,print_chat,"* Voting has started...")     moptions[0]=moptions[1]=0     return PLUGIN_CONTINUE       } public mvote_count(key){     ++moptions[key]     return PLUGIN_HANDLED } public check_mvotes(){     set_hudmessage(255,255,255, -1.0, -0.75)     if (moptions[0] > moptions[1]){         if (get_cvar_num("amx_repaylimit") == 1){             server_cmd("amx_repaylimit 0")             show_hudmessage(0, "Health Limit^nHas Been Turned OFF")         }         else if (get_cvar_num("amx_repaylimit") == 0){             server_cmd("amx_repaylimit 1")             show_hudmessage(0, "Health Limit^nHas Been Turned ON")         }     }     else{         if (get_cvar_num("amx_repaylimit") == 0){             server_cmd("amx_repaylimit 1")             show_hudmessage(0, "Health Limit^nHas Been Turned ON")         }         else if (get_cvar_num("amx_repaylimit") == 1){             server_cmd("amx_repaylimit 0")             show_hudmessage(0, "Health Limit^nHas Been Turned OFF")         }     }     return PLUGIN_CONTINUE } public check_mvotes2(){     set_hudmessage(255,255,255, -1.0, -0.75)     if (moptions[0] > moptions[1]){         if (get_cvar_num("amx_repaysave") == 1){             server_cmd("amx_repaysave 0")             show_hudmessage(0, "Health Save^nHas Been Turned OFF")         }         else if (get_cvar_num("amx_repaysave") == 0){             server_cmd("amx_repaysave 1")             show_hudmessage(0, "Health Save^nHas Been Turned ON")         }     }     else{         if (get_cvar_num("amx_repaysave") == 0){             server_cmd("amx_repaysave 1")             show_hudmessage(0, "Health Save^nHas Been Turned ON")         }         else if (get_cvar_num("amx_repaysave") == 1){             server_cmd("amx_repaysave 0")             show_hudmessage(0, "Health Save^nHas Been Turned OFF")         }     }     return PLUGIN_CONTINUE }
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
BioI-Iazard
Senior Member
Join Date: Sep 2005
Location: Calgary, Alberta
Old 12-05-2007 , 22:49   Re: [HELP] Repay plugin getting runtime error
Reply With Quote #5

Now when you get a HS you kill yourself
Like when i get a HS it will be like this player1 (picture of HS) player2
and then right away it will be (picture of gun) player1


The picture stuff is what u see in top right
__________________
Loved by Many ....
Hated by Some ....
Respected by All !!!!
BioI-Iazard is offline
BioI-Iazard
Senior Member
Join Date: Sep 2005
Location: Calgary, Alberta
Old 12-09-2007 , 14:26   Re: [HELP] Repay plugin getting runtime error
Reply With Quote #6

any idea why?
__________________
Loved by Many ....
Hated by Some ....
Respected by All !!!!
BioI-Iazard 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 11:02.


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