Raised This Month: $ Target: $400
 0% 

[REQ] bonus for headshot


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dypz
Senior Member
Join Date: Mar 2009
Location: Belarus, Orsha
Old 03-28-2009 , 06:27   [REQ] bonus for headshot
Reply With Quote #1

Can any body make small code: when player kill with headshot he get more then just 300$ ( dont need any messages hud, or stats for that)
And if there is that plugin just drop me the link )
+karma
__________________

dypz is offline
Send a message via Skype™ to dypz
Darknightcze2
Junior Member
Join Date: Oct 2008
Location: Czech Republic! - Middle
Old 03-28-2009 , 07:17   Re: [REQ] bonus for headshot
Reply With Quote #2

Hi, I made Simple code.

cvar: amx_hsbonus "500" // Define the amount of the bonus
Attached Files
File Type: sma Get Plugin or Get Source (hsbonus.sma - 653 views - 779 Bytes)
__________________


Last edited by Darknightcze2; 03-28-2009 at 09:02. Reason: update source
Darknightcze2 is offline
Send a message via ICQ to Darknightcze2
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 03-28-2009 , 08:07   Re: [REQ] bonus for headshot
Reply With Quote #3

Your code wont work.
Code:
#include <amxmodx> #include <fakemeta>   #define OFFSET_MONEY 115 // If I remember correctly #define EXTRAOFFSET 5   new g_Money; new g_Bonus, g_MaxMoney;   public plugin_init() {         register_plugin("Headshot Money Bonus", "1.0", "hleV");           // Player gets $300 by default and + $amount in hsmb_bonus CVar         g_Bonus = register_cvar("hsmb_bonus", "200");         g_MaxMoney = register_cvar("hsmb_maxmoney", "16000");           register_event("DeathMsg", "Death", "a", "1>0"); }   public plugin_cfg()         g_Money = get_user_msgid("Money");   public Death(Killer, Victim, Headshot) {         Killer = read_data(1);         new Money = get_pcvar_num(g_Bonus);           read_data(3, Headshot);           if (Headshot && Money)         {                 Money += GetMoney(Killer);                 new MaxMoney = get_pcvar_num(g_MaxMoney);                   if (Money >= MaxMoney)                         SetMoney(Killer, MaxMoney);                 else                         SetMoney(Killer, Money);         } }   stock GetMoney(Client)         return get_pdata_int(Client, OFFSET_MONEY, EXTRAOFFSET);   stock SetMoney(Client, Money) {         set_pdata_int(Client, OFFSET_MONEY, Money, EXTRAOFFSET);         message_begin(MSG_ONE_UNRELIABLE, g_Money, _, Client);         write_long(Money);         write_byte(1);         message_end(); }
__________________
hleV is offline
Darknightcze2
Junior Member
Join Date: Oct 2008
Location: Czech Republic! - Middle
Old 03-28-2009 , 08:55   Re: [REQ] bonus for headshot
Reply With Quote #4

Quote:
Originally Posted by hleV View Post
Your code wont work.
work. But dont show in hud +800 (500 + 300 by default)
__________________

Darknightcze2 is offline
Send a message via ICQ to Darknightcze2
dypz
Senior Member
Join Date: Mar 2009
Location: Belarus, Orsha
Old 03-28-2009 , 09:59   Re: [REQ] bonus for headshot
Reply With Quote #5

/home/groups/amxmodx/tmp3/textOihXcU.sma(0) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/textOihXcU.sma(1) : error 038: extra characters on line
/home/groups/amxmodx/tmp3/textOihXcU.sma(1) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/textOihXcU.sma(2) : error 021: symbol already defined: "get_user_msgid"
/home/groups/amxmodx/tmp3/textOihXcU.sma(3) : warning 203: symbol is never used: "_cfg"
/home/groups/amxmodx/tmp3/textOihXcU.sma(3) : error 013: no entry point (no public functions)

^^
Attached Files
File Type: sma Get Plugin or Get Source (hsbonus.sma - 612 views - 1.5 KB)
__________________

dypz is offline
Send a message via Skype™ to dypz
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 03-28-2009 , 10:18   Re: [REQ] bonus for headshot
Reply With Quote #6

My code compiles fine. And I'm not sure what do you mean by "But dont show in hud +800 (500 + 300 by default)". If you don't want the money to flash, change this:
Code:
        write_byte(1);
to
Code:
        write_byte(0);
__________________
hleV is offline
Reply


Thread Tools
Display Modes

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 20:13.


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