AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Zombie Plague Mod (https://forums.alliedmods.net/forumdisplay.php?f=126)
-   -   [REQ] [ZP 4.3] Ammo packs get/lose show (https://forums.alliedmods.net/showthread.php?t=310119)

itzBogdaN69 08-19-2018 13:05

[REQ] [ZP 4.3] Ammo packs get/lose show
 
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.

georgik57 08-19-2018 14:34

Re: [REQ] [ZP 4.3] Ammo packs get/lose show
 
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.

itzBogdaN69 08-19-2018 16:46

Re: [REQ] [ZP 4.3] Ammo packs get/lose show
 
Quote:

Originally Posted by georgik57 (Post 2611177)
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?

georgik57 08-19-2018 18:22

Re: [REQ] [ZP 4.3] Ammo packs get/lose show
 
1 Attachment(s)
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.

itzBogdaN69 08-20-2018 04:35

Re: [REQ] [ZP 4.3] Ammo packs get/lose show
 
Thank you man. Btw, how you did hud bigger?

georgik57 08-20-2018 05:44

Re: [REQ] [ZP 4.3] Ammo packs get/lose show
 
dhud


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

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