AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Zombie Plague Mod (https://forums.alliedmods.net/forumdisplay.php?f=126)
-   -   Subplugin Submission [ZP] Game Stats Hud Information. (https://forums.alliedmods.net/showthread.php?t=253065)

happy_2012 12-14-2014 14:38

[ZP] Game Stats Hud Information.
 
1 Attachment(s)
Zombie Plague 5.0.8
[Compatible with Assassins vs Sniper version]

Hello fellows,
I have created this very simple plugins, as many have requested it around the Zombie Plague forum, it has a very simple code, easy to modify and even more easier to customize.

Features:
  • Hud information at top center
  • Information about current game-mod
  • Information about zombies team score
  • Information about humans team score

Parts that can be customized:
1. Hud stats position (Top center by default)
PHP Code:

const Float:HUD_GAME_X = -1.0
const Float:HUD_GAME_Y 0.02 

2. Hud stats color (Red by default)
PHP Code:

const HUD_GAME_STATS_R 250
const HUD_GAME_STATS_G 0
const HUD_GAME_STATS_B 

Credits:
  • MeRcyLeZZ - Zombie Plague mod
  • funkyfresh (me) - Coding this plugin

Kind Regards,
funkyfresh (happy_2012)

New.ZM.Life 12-14-2014 15:52

Re: [ZP] Game Stats Hud Information.
 
Some screens? :)

happy_2012 12-14-2014 16:46

Re: [ZP] Game Stats Hud Information.
 
Quote:

Originally Posted by New.ZM.Life (Post 2235361)
Some screens? :)

Sure!

No game mode started: Click to view
Infection Mode started: Click to view

Same goes for other game modes :)

happy_2012 12-14-2014 16:50

Re: [ZP] Game Stats Hud Information.
 
Sorry for multiposting!

zmd94 12-18-2014 08:13

Re: [ZP] Game Stats Hud Information.
 
Nice sharing. I learn new thing from this plugin:
PHP Code:

new g_szStrings[32];

public Function(
id)
{
    
formatex(g_szStringscharsmax(g_szStrings), "zmd94!")
}

public 
Function2(id)
{
    
client_print(idprint_chat"[ZP] %s!"g_szStrings)


However, below code can can be optimized:
Code:

public zp_round_ended(winteam)
{
    switch(winteam)
    {
        case WIN_ZOMBIES: ZombieScore++
        case WIN_HUMANS: HumanScore++
      case WIN_NO_ONE: return PLUGIN_CONTINUE; // This code is not needed as you don't do anything with it. So, just remove it. ;)
    }
   
    g_Mode = MODE_NONE;
   
    return PLUGIN_CONTINUE;
}

-->
Code:

public zp_round_ended(winteam)
{
    switch(winteam)
    {
        case WIN_ZOMBIES: ZombieScore++
        case WIN_HUMANS: HumanScore++
    }
   
    g_Mode = MODE_NONE;
}


happy_2012 12-18-2014 22:11

Re: [ZP] Game Stats Hud Information.
 
1 Attachment(s)
Hello,
zmd94 Thanks for the optimizing suggestions, and I am glad that this plugin somehow helped you figuring new thing out.

But actually, you got the idea wrong. I will explain why!

This block of code:
PHP Code:

new g_szStrings[32];

public Function(
id)
{
    
formatex(g_szStringscharsmax(g_szStrings), "zmd94!")
}

public 
Function2(id)
{
    
client_print(idprint_chat"[ZP] %s!"g_szStrings)


Should actually be like the following block to get it working as intended :)
PHP Code:

new g_szStrings[32];

public Function(
id)
{
    
formatex(g_szStringscharsmax(g_szStrings), "zmd94!")
    
client_print(idprint_chat"[ZP] %s!"g_szStrings)


I also updated the code with the optimizations you have suggested :)

zmd94 12-18-2014 23:26

Re: [ZP] Game Stats Hud Information.
 
It is not correct. Actually, you can use g_szStrings as global variable.

Below is as an example of working code:
PHP Code:

#include <amxmodx>
#include <hamsandwich>

new g_szStrings[32];

public 
plugin_init()
{
    
RegisterHam(Ham_Spawn"player""fw_PlayerRespawn"1)
}

public 
fw_PlayerRespawn(id)
{
    if(
is_user_alive(id))
    {
        
formatex(g_szStringscharsmax(g_szStrings), "Just don't let zombies eat your brain!")
        
set_task(10.0"iLiving"id)
    }
}

public 
iLiving(id)
{
    
client_print(idprint_chat"[ZP] %s!"g_szStrings)



happy_2012 12-18-2014 23:41

Re: [ZP] Game Stats Hud Information.
 
I will try it :)


All times are GMT -4. The time now is 15:02.

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