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

[L4D2] Show Tank's HP


Post New Thread Reply   
 
Thread Tools Display Modes
Thraka
AlliedModders Donor
Join Date: Aug 2005
Old 02-04-2010 , 18:36   Re: [L4D2] Show Tank's HP
Reply With Quote #11

Screenshot?
Thraka is offline
Nataraja
Member
Join Date: Jan 2010
Old 02-05-2010 , 04:17   Re: [L4D2] Show Tank's HP
Reply With Quote #12

I translate the language and adding a function,
but still have bug, reporting:

When Tank player changed because of wasting too many time, then the tank info stop!!!!

PHP Code:
#include <sourcemod>
#pragma semicolon 1
#define HUD_INTERVAL 2.0
#define PLUGIN_VERSION "1.0.1"
/*
History:
#######################
v1.0.1:
 - added round end check
 - admins will get a hinttext, clients a panel
v1.0.0:
 - initial
*/
//plugin info
//#######################
public Plugin:myinfo =
{
 
name "Tank status",
 
author "Die Teetasse",
 
description "Shows tank status to everbody",
 
version PLUGIN_VERSION,
 
url "http://forums.alliedmods.net/showthread.php?t=117431"
};
//global definitions
//#######################
new bool:TankAlive false;
new 
TankClient = -1;
//plugin start
//#######################
public OnPluginStart()
{
 
HookEvent("tank_spawn"Tank_Spawn_Event);
 
HookEvent("player_death"Player_Death_Event);
 
HookEvent("round_end"Round_End_Event);
}
 
//events
//#######################
public Action:Tank_Spawn_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
 
TankClient GetClientOfUserId(GetEventInt(event"userid"));
 
TankAlive true;
 
CreateTimer(HUD_INTERVALHUD_TimerINVALID_HANDLETIMER_REPEAT);
}
public 
Action:Player_Death_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
 new 
client GetClientOfUserId(GetEventInt(event"userid"));
 if (
client == TankClient)
 {
  
TankClient = -1;
  
TankAlive false;
 }
}
public 
Action:Round_End_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
 
TankClient = -1;
 
TankAlive false;
}
//timer
//#######################
public Action:HUD_Timer(Handle:timer)

 if(!
TankAlive) return Plugin_Stop;
 
ShowHUD();
 return 
Plugin_Continue;
}
//private function
//#######################
ShowHUD()
{
 if (
TankClient == -|| !TankAlive) return;
 if (!
IsClientInGame(TankClient)) return;
 if (!
IsPlayerAlive(TankClient)) return;
 new 
String:text[128];
 new 
Handle:HUD CreatePanel();
 
DrawPanelText(HUD"Tank 資訊:");
 
DrawPanelText(HUD"==================");
 if (
IsFakeClient(TankClient)) text "操控者: AI";
 else 
Format(textsizeof(text), "操控者: %N"TankClient);
 
DrawPanelText(HUDtext);
 new 
health GetEntProp(TankClientProp_Send"m_iHealth");
 if (
health <= 1890Format(textsizeof(text), "status: badly hurt");
 else 
Format(textsizeof(text), "血量: %d"health);
 
DrawPanelText(HUDtext);
 for(new 
client 1client MaxClients+1client++)
 {
  if (!
IsClientInGame(client)) continue;
  if (
IsFakeClient(client)) continue;
  if (
client == TankClient) continue;
  
/* client or admin?
  client => panel
  admin => hinttext */
  
if (GetUserFlagBits(client) == 0SendPanelToClient(HUDclientHUDHandler3);
  else
  {
   if (
IsFakeClient(TankClient)) text "操控者: AI";
   else 
Format(textsizeof(text), "操控者: %N"TankClient);
 
   if (
health <= 1890PrintHintText(client"%s\nTankStatus: badly hurt"text);
   else 
PrintHintText(client"%s\n坦克血量: %d"texthealth);
  } 
 }
}  
 
public 
HUDHandler(Handle:menuMenuAction:actionparam1param2)
{

Nataraja is offline
DieTeetasse
Senior Member
Join Date: Jul 2009
Old 02-05-2010 , 08:39   Re: [L4D2] Show Tank's HP
Reply With Quote #13

I think the bug is fixed in the new version.
Attached Files
File Type: sp Get Plugin or Get Source (tankstatus.sp - 619 views - 3.1 KB)
__________________
DieTeetasse is offline
Nataraja
Member
Join Date: Jan 2010
Old 02-05-2010 , 09:51   Re: [L4D2] Show Tank's HP
Reply With Quote #14

Sometimes the second interval (2.0sec.) mach the changing controling Tank's player situatuion and still don't show tank!

i.e. When the Tank has not hit any survivor for a long time, it will change to another player. In the case, sometimes the plugin will stop showing info.

Last edited by Nataraja; 02-06-2010 at 02:53.
Nataraja is offline
Nataraja
Member
Join Date: Jan 2010
Old 02-06-2010 , 02:53   Re: [L4D2] Show Tank's HP
Reply With Quote #15

Reporting bug:

1. ↑

2. Cause player can't use solt1 and solt2 to change weapons!(normal player not included admin)

3.After death tank info will become stranged!(5000 hp)

Last edited by Nataraja; 02-06-2010 at 09:43.
Nataraja is offline
DieTeetasse
Senior Member
Join Date: Jul 2009
Old 02-06-2010 , 20:54   Re: [L4D2] Show Tank's HP
Reply With Quote #16

Updated.
Attached Files
File Type: sp Get Plugin or Get Source (l4d2_tankstatus.sp - 570 views - 2.9 KB)
__________________
DieTeetasse is offline
Nataraja
Member
Join Date: Jan 2010
Old 02-08-2010 , 11:21   Re: [L4D2] Show Tank's HP
Reply With Quote #17

still won't show the second controler, but I think it is ok.

thank u very much!

Last edited by Nataraja; 02-08-2010 at 17:28.
Nataraja is offline
DieTeetasse
Senior Member
Join Date: Jul 2009
Old 02-11-2010 , 05:10   Re: [L4D2] Show Tank's HP
Reply With Quote #18

I changed the logic.
Attached Files
File Type: sp Get Plugin or Get Source (l4d2_tankstatus.sp - 531 views - 3.1 KB)
__________________
DieTeetasse is offline
Nataraja
Member
Join Date: Jan 2010
Old 02-21-2010 , 07:30   Re: [L4D2] Show Tank's HP
Reply With Quote #19

Well, still has the bug that won't show 2nd controler
Nataraja is offline
HowGentle
Member
Join Date: Feb 2010
Old 02-24-2010 , 03:59   Re: [L4D2] Show Tank's HP
Reply With Quote #20

* bug reporting

Thanks for nice plugin.
but there's a bug.
If tank's health higher than 32,000
This plugin didn't works.
If tank's health over 32,000 ,this plugin shows tank's health is minus.

plz, fix it for me
HowGentle 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 09:05.


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