Raised This Month: $ Target: $400
 0% 

Subplugin Submission [ZP] Game Stats Hud Information.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
happy_2012
Senior Member
Join Date: Aug 2012
Old 12-14-2014 , 14:38   [ZP] Game Stats Hud Information.
Reply With Quote #1

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)
Attached Files
File Type: sma Get Plugin or Get Source (zp50_sub_gamestats.sma - 1709 views - 2.6 KB)
__________________
Discord contacts:
I rarely look at private messages here, but I am very active on Discord!
happy_2012 is offline
New.ZM.Life
Veteran Member
Join Date: Sep 2014
Location: Iran
Old 12-14-2014 , 15:52   Re: [ZP] Game Stats Hud Information.
Reply With Quote #2

Some screens?
__________________
PLUGINS

Zombie Plague 5.0 + New Modes

Added NightCrawler Mode to ZP





New.ZM.Life is offline
happy_2012
Senior Member
Join Date: Aug 2012
Old 12-14-2014 , 16:46   Re: [ZP] Game Stats Hud Information.
Reply With Quote #3

Quote:
Originally Posted by New.ZM.Life View Post
Some screens?
Sure!

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

Same goes for other game modes
__________________
Discord contacts:
I rarely look at private messages here, but I am very active on Discord!

Last edited by happy_2012; 12-14-2014 at 16:51.
happy_2012 is offline
happy_2012
Senior Member
Join Date: Aug 2012
Old 12-14-2014 , 16:50   Re: [ZP] Game Stats Hud Information.
Reply With Quote #4

Sorry for multiposting!
__________________
Discord contacts:
I rarely look at private messages here, but I am very active on Discord!

Last edited by happy_2012; 12-14-2014 at 16:50.
happy_2012 is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-18-2014 , 08:13   Re: [ZP] Game Stats Hud Information.
Reply With Quote #5

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;
}

Last edited by zmd94; 12-18-2014 at 08:14.
zmd94 is offline
happy_2012
Senior Member
Join Date: Aug 2012
Old 12-18-2014 , 22:11   Re: [ZP] Game Stats Hud Information.
Reply With Quote #6

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
Attached Files
File Type: sma Get Plugin or Get Source (zp50_sub_gamestats.sma - 990 views - 2.5 KB)
__________________
Discord contacts:
I rarely look at private messages here, but I am very active on Discord!

Last edited by happy_2012; 12-18-2014 at 22:14.
happy_2012 is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-18-2014 , 23:26   Re: [ZP] Game Stats Hud Information.
Reply With Quote #7

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)

zmd94 is offline
happy_2012
Senior Member
Join Date: Aug 2012
Old 12-18-2014 , 23:41   Re: [ZP] Game Stats Hud Information.
Reply With Quote #8

I will try it
__________________
Discord contacts:
I rarely look at private messages here, but I am very active on Discord!
happy_2012 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 15:02.


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