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

[REQ] [ZP 4.3] Ammo packs get/lose show


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
itzBogdaN69
Junior Member
Join Date: Aug 2018
Old 08-19-2018 , 13:05   [REQ] [ZP 4.3] Ammo packs get/lose show
Reply With Quote #1

Hi guys. I want a plugin that show you a message on screen when you get/lose ammo packs, like that: https://imgur.com/a/LlqV0DS. Thank you for your payed attention, have a good day.
itzBogdaN69 is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 08-19-2018 , 14:34   Re: [REQ] [ZP 4.3] Ammo packs get/lose show
Reply With Quote #2

simplest method would be to make a task which scans player's ammo packs at a certain interval and remember his old ammo packs value then if the new value is different print newammo - oldammo.
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
itzBogdaN69
Junior Member
Join Date: Aug 2018
Old 08-19-2018 , 16:46   Re: [REQ] [ZP 4.3] Ammo packs get/lose show
Reply With Quote #3

Quote:
Originally Posted by georgik57 View Post
simplest method would be to make a task which scans player's ammo packs at a certain interval and remember his old ammo packs value then if the new value is different print newammo - oldammo.
Can you make it for me please?
itzBogdaN69 is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 08-19-2018 , 18:22   Re: [REQ] [ZP 4.3] Ammo packs get/lose show
Reply With Quote #4

PHP Code:
#include <amxmodx>

#if AMXX_VERSION_NUM <= 182
#include <dhudmessage>
#endif

#include <zombieplague>

new g_iIDPCVarIntervalg_iAmmoPacksOld[33], g_iAmmoPacksNew[33];

public 
plugin_init()
{
    
register_plugin("ZP ammopacks change print hud""0.0.1""D7")
    
    
register_dictionary("zombie_plague.txt")
    
    
g_iIDPCVarInterval register_cvar("ZPAmPksScanInterval""3.0")
}

public 
client_putinserver(iID)
{
    
g_iAmmoPacksOld[iID] = 0;
    
g_iAmmoPacksNew[iID] = 0;
    
    
set_task(get_pcvar_float(g_iIDPCVarInterval), "fwTaskDisplayAmPksChange"iID)
}

#if AMXX_VERSION_NUM <= 182
public client_disconnect(iID)
#else
public client_disconnected(iID)
#endif
{
    
remove_task(iID)
}

public 
fwTaskDisplayAmPksChange(const iID)
{
    
#if AMXX_VERSION_NUM <= 182
    
if (!is_user_connected(iID))
    {
        return;
    }
    
#endif
    
    
g_iAmmoPacksNew[iID] = zp_get_user_ammo_packs(iID);
    
    if (
g_iAmmoPacksNew[iID] != g_iAmmoPacksOld[iID])
    {
        new 
Float:fCVarInterval get_pcvar_float(g_iIDPCVarInterval);
        
        
// red = 0, green = 160, blue = 0, Float:x = -1.0, Float:y = 0.65,
        // effects = 2, Float:fxtime = 6.0, Float:holdtime = 3.0,
        // Float:fadeintime = 0.1, Float:fadeouttime = 1.5, bool:reliable = true
        #if defined _dhudmessage_included
        
set_dhudmessage
        
(
            (
g_iAmmoPacksNew[iID] > g_iAmmoPacksOld[iID]) ? 255,
            (
g_iAmmoPacksNew[iID] > g_iAmmoPacksOld[iID]) ? 255 0,
            
0,
            
0.80.82fCVarInterval 2fCVarInterval0.010.0false
        
)
        
#else
        
set_dhudmessage
        
(
            (
g_iAmmoPacksNew[iID] > g_iAmmoPacksOld[iID]) ? 255,
            (
g_iAmmoPacksNew[iID] > g_iAmmoPacksOld[iID]) ? 255 0,
            
0,
            
0.80.82fCVarInterval 2fCVarIntervalfCVarInterval 20.0
        
)
        
#endif
        
show_dhudmessage(iID"%s%d %L", ((g_iAmmoPacksNew[iID] > g_iAmmoPacksOld[iID]) ? "+" ""), g_iAmmoPacksNew[iID] - g_iAmmoPacksOld[iID], iID"AMMO_PACKS2")
        
        
g_iAmmoPacksOld[iID] = g_iAmmoPacksNew[iID];
    }
    
    
set_task(get_pcvar_float(g_iIDPCVarInterval), "fwTaskDisplayAmPksChange"iID)

dhudmessage.inc



Have fun.
Attached Files
File Type: sma Get Plugin or Get Source (ZPAmmoChangePrintHUD.sma - 780 views - 2.0 KB)
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
itzBogdaN69
Junior Member
Join Date: Aug 2018
Old 08-20-2018 , 04:35   Re: [REQ] [ZP 4.3] Ammo packs get/lose show
Reply With Quote #5

Thank you man. Btw, how you did hud bigger?
itzBogdaN69 is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 08-20-2018 , 05:44   Re: [REQ] [ZP 4.3] Ammo packs get/lose show
Reply With Quote #6

dhud
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
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 06:16.


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