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

versus tank - L4D2


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
gamer_kanelita
Senior Member
Join Date: Jun 2019
Location: Peru
Old 10-01-2020 , 23:40   versus tank - L4D2
Reply With Quote #1

There will be a plugin for versus, that when a tank appears an ad appears who gets the tank and its health HP? please? :llorar: :llorar:
gamer_kanelita is offline
Darkwob
BANNED
Join Date: Oct 2018
Old 10-02-2020 , 06:03   Re: versus tank - L4D2
Reply With Quote #2

Quote:
Originally Posted by gamer_kanelita View Post
There will be a plugin for versus, that when a tank appears an ad appears who gets the tank and its health HP? please? :llorar: :llorar:
PHP Code:
#include <sourcemod>
#pragma semicolon 1

#define HUD_INTERVAL 2.0
#define PLUGIN_VERSION "1.0.2.1"

/*
History:
#######################


v1.0.2.1:
 - updated to versus mod (only infected can see the tank status)
 - modified to all players can only see panel
 - solved minor bugs
 
v1.0.2:
 - fixed tank frustration bug

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, modified by diorfo",
    
description "Shows tank status to team",
    
version PLUGIN_VERSION,
    
url "http://forums.alliedmods.net/showthread.php?t=117431"
};

//global definitions
//#######################
new bool:TankAlive false;
new 
bool:TankIt false;
new 
TankClient = -1;

//plugin start
//#######################
public OnPluginStart()
{
    
HookEvent("tank_spawn"Tank_Spawn_Event);
    
HookEvent("tank_frustrated"Tank_Frustrated_Event);
    
HookEvent("player_death"Player_Death_Event);
    
HookEvent("round_end"Round_End_Event);
    
HookEvent("player_now_it"Player_It_Event);
    
HookEvent("player_no_longer_it"Player_Not_It_Event);
    
HookEvent("round_start"Round_Start_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:Tank_Frustrated_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
    
TankClient GetClientOfUserId(GetEventInt(event"userid"));
    
TankAlive true;
}

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

public 
Action:Player_It_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
    if (
GetClientOfUserId(GetEventInt(event"userid")) == TankClientTankIt true;
    
    return 
Plugin_Continue;
}

public 
Action:Player_Not_It_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
    if (
GetClientOfUserId(GetEventInt(event"userid")) == TankClientTankIt false;
    
    return 
Plugin_Continue;
}

public 
Action:Round_Start_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[1024];
    new 
Handle:HUD CreatePanel();

    
DrawPanelText(HUD"Tank Info:");
    
DrawPanelText(HUD"##################");
    
    if (
IsFakeClient(TankClient)) text "Player: BOT";
    else 
Format(textsizeof(text), "Player: %N"TankClient);
    
    
DrawPanelText(HUDtext);
    
    
    new 
bool:fire false;
    
//check fire status
    
if(GetEntityFlags(TankClient) & FL_ONFIREfire true;        
        
    if (
TankIt && fireFormat(textsizeof(text), "Health: %d (OnFire, InBile)"GetClientHealth(TankClient));
    else if(
TankItFormat(textsizeof(text), "Health: %d (InBile)"GetClientHealth(TankClient));
    else if(
fireFormat(textsizeof(text), "Health: %d (OnFire)"GetClientHealth(TankClient));
    else 
Format(textsizeof(text), "Health: %d"GetClientHealth(TankClient));    
    
    
DrawPanelText(HUDtext);
    
    if (
GetEntityFlags(TankClient) & FL_ONFIREtext "Control: 100";
    else 
Format(textsizeof(text), "Control: %d"100 GetEntProp(TankClientProp_Send"m_frustration"));
    
    
DrawPanelText(HUDtext);

    for(new 
client 1client MaxClients+1client++)
    {
        if (!
IsClientInGame(client)) continue;
        if (
IsFakeClient(client)) continue;
        if (
client == TankClient) continue;
        if (
GetClientTeam(client) != 3) continue;

        
SendPanelToClient(HUDclientHUDHandler3);            
    }
}  

public 
HUDHandler(Handle:menuMenuAction:actionparam1param2)
{

Darkwob is offline
gamer_kanelita
Senior Member
Join Date: Jun 2019
Location: Peru
Old 10-03-2020 , 02:45   Re: versus tank - L4D2
Reply With Quote #3

Hello friend, your PHP code has errors, the tank only appears the first time, then the announcement of who has the tank with their health no longer appears, in the entire map it only came out 3 times nothing more
gamer_kanelita is offline
Reply



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:34.


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