AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   [REQ] bonus for headshot (https://forums.alliedmods.net/showthread.php?t=88695)

dypz 03-28-2009 06:27

[REQ] bonus for headshot
 
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

Darknightcze2 03-28-2009 07:17

Re: [REQ] bonus for headshot
 
3 Attachment(s)
Hi, I made Simple code.

cvar: amx_hsbonus "500" // Define the amount of the bonus

hleV 03-28-2009 08:07

Re: [REQ] bonus for headshot
 
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(); }

Darknightcze2 03-28-2009 08:55

Re: [REQ] bonus for headshot
 
Quote:

Originally Posted by hleV (Post 791128)
Your code wont work.

work. But dont show in hud +800 (500 + 300 by default)

dypz 03-28-2009 09:59

Re: [REQ] bonus for headshot
 
1 Attachment(s)
/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)

^^

hleV 03-28-2009 10:18

Re: [REQ] bonus for headshot
 
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);


All times are GMT -4. The time now is 20:13.

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