AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   General (https://forums.alliedmods.net/forumdisplay.php?f=58)
-   -   tank_hud.sp (https://forums.alliedmods.net/showthread.php?t=311942)

sharkyyy 11-09-2018 12:04

tank_hud.sp
 
Hello! i am new to the forum so i am sorry if i post in wrong place
im trying to compile a plugin but i keep getting same error tried different versions of SM (never had problems with it before) would be really nice if someone can tell me whats wrong been trying for long time

Here is the error:
PHP Code:

//SourceMod Batch Compiler
// by the SourceMod Dev Team


//// tank_hud.sp
// C:\Users\Sharky\Downloads\sourcemod-1.6.0-hg4317-windows\addons\sourcemod\scripting\tank_hud.sp(103) : error 017: undefined symbol "L4D2Direct_GetTankPassedCount"
// C:\Users\Sharky\Downloads\sourcemod-1.6.0-hg4317-windows\addons\sourcemod\scripting\tank_hud.sp(127) : warning 213: tag mismatch
//
// 1 Error.
//
// Compilation Time: 0,36 sec
// ----------------------------------------

Press enter to exit ... 

and there is the .sp

PHP Code:

#pragma semicolon 1
#include <sourcemod>
#include <l4d2_direct>
#define L4D2UTIL_STOCKS_ONLY
#include <l4d2util>
new bool:isTankActive;
new 
tankClient = -1;
new 
Handle:burnDurationCvar;
new 
bool:hiddenTankPanel[MAXPLAYERS 1];
new 
bool:showTankPanel[MAXPLAYERS 1];
public 
OnPluginStart()
{
 
HookEvent("round_start"Round_EventEventHookMode_PostNoCopy);
 
HookEvent("round_end"Round_EventEventHookMode_PostNoCopy);
 
HookEvent("tank_spawn"TankSpawn_Event);
 
HookEvent("player_death"PlayerDeath_Event);
 
burnDurationCvar FindConVar("tank_burn_duration");
 
 
RegConsoleCmd("sm_tankhud"ToggleTankPanel_Cmd"Toggles the tank panel visibility so other menus can be seen");
 
RegConsoleCmd("sm_thud"ToggleTanksPanel_Cmd"Toggles the tank panel visibility so other menus can be seen");
}
public 
Round_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
 
isTankActive false;
 
tankClient = -1;
}
public 
TankSpawn_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
 
tankClient GetClientOfUserId(GetEventInt(event"userid"));
 if (!
isTankActive)
 {
  
isTankActive true;
  
CreateTimer(0.5MenuRefresh_Timer_TIMER_REPEAT);
 }
}
stock UpdateTank(client) {
 new 
newTank = -1;
 for (new 
1<= MaxClientsi++)
 {
  if (
client != && IsClientInGame(i) && GetClientTeam(i) == 3
    
&& GetZombieClass(i) == 8)
  {
   
newTank i;
   break;
  }
 }
 if (
newTank <= 0)
 {
  
isTankActive false;
 }
}
public 
PlayerDeath_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
 new 
client GetClientOfUserId(GetEventInt(event"userid"));
 if (
client && client <= MaxClients && GetClientTeam(client) == && GetZombieClass(client) == 8)
 {
  
UpdateTank(client);
 }
}
public 
Action:MenuRefresh_Timer(Handle:timer)
{
 static 
Handle:menuPanel INVALID_HANDLE;
 if (
isTankActive)
 {
  static 
String:buffer[64], String:rageBuffer[64];
  if (
menuPanel != INVALID_HANDLE)
  {
   
CloseHandle(menuPanel);
  }
  
menuPanel CreatePanel();
  
// Header
  
SetPanelTitle(menuPanel"Tank HUD"); 
  
// Name
  
if (!IsFakeClient(tankClient))
  {
   
GetClientName(tankClientbuffersizeof(buffer));
   
   if (
strlen(buffer) > 25)
   {
    
buffer[23] = '.';
    
buffer[24] = '.';
    
buffer[25] = '.';
    
buffer[26] = 0;
   }
   
   
Format(buffersizeof(buffer), "Control: %s"buffer);
   
DrawPanelText(menuPanelbuffer);
  }
  else
  {
   
DrawPanelText(menuPanel"Control: AI");
  }
  
// Health
  
static maxHealth = -1;
  if (
maxHealth 0) {
   
maxHealth RoundToNearest(GetConVarFloat(FindConVar("z_tank_health"))*1.5);
  }
  new 
health GetClientHealth(tankClient);
  
Format(buffersizeof(buffer), "Health : %i / %.1f%%"health100.0*health/maxHealth);
  
DrawPanelText(menuPanelbuffer);
  
// Rage
  
if (!IsFakeClient(tankClient)) {
   
FormatEx(rageBuffersizeof(rageBuffer), "Rage   : %d%% (Pass #%i)"GetTankFrustration(tankClient), L4D2Direct_GetTankPassedCount());
   
DrawPanelText(menuPanelrageBuffer);
  }
  
// Fire
  
if (GetEntityFlags(tankClient) & FL_ONFIRE)
  {
   
FormatEx(buffersizeof(buffer), "Burning: %.1f sec"health/GetConVarInt(burnDurationCvar));
   
DrawPanelText(menuPanelbuffer);
  }
  for (new 
1<= MaxClientsi++)
  {
   if (
IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(i) != && != tankClient && !hiddenTankPanel[tankClient])
   {
    
SendPanelToClient(menuPaneliDummyHandler3);
   }
  }

  
// tank-only hud
  
static Handle:tankPanel INVALID_HANDLE;
  if (!
IsFakeClient(tankClient) && !showTankPanel[tankClient]) {
   if (
tankPanel != INVALID_HANDLE)
   {
    
CloseHandle(tankPanel);
   }
   
tankPanel CreatePanel(0);
   
SetPanelTitle(tankPanel"Tank HUD");
   
DrawPanelText(tankPanelrageBuffer);
   
SendPanelToClient(tankPaneltankClientDummyHandler3);
  }
  return 
Plugin_Continue;
 }
 return 
Plugin_Stop;
}
stock GetZombieClass(client) return GetEntProp(clientProp_Send"m_zombieClass");
public 
DummyHandler(Handle:menuMenuAction:actionparam1param2) { }
public 
Action:ToggleTankPanel_Cmd(client,args)
{
 
hiddenTankPanel[tankClient] = !hiddenTankPanel[tankClient];
 if(
hiddenTankPanel[tankClient])
 {
  
ReplyToCommand(client,"Tank HUD is now disabled.");
 }
 else
 {
  
ReplyToCommand(client,"Tank HUD is now enabled.");
 }
  
}
public 
Action:ToggleTanksPanel_Cmd(client,args)
{
 
showTankPanel[tankClient] = !showTankPanel[tankClient];
 if(
showTankPanel[tankClient])
 {
  
ReplyToCommand(client,"Tank HUD is now disabled.");
 }
 else
 {
  
ReplyToCommand(client,"Tank HUD is now enabled.");
 }
  
}
public 
OnClientDisconnect(client)
{
 if (
client == tankClient) {
  
UpdateTank(client);
 }
 
hiddenTankPanel[client] = false;
 
showTankPanel[tankClient] = true;



8guawong 11-09-2018 12:20

Re: tank_hud.sp
 
you probably don't have the l4d2_direct include and this should go to https://forums.alliedmods.net/forumdisplay.php?f=107

Fyren 11-09-2018 17:57

Re: tank_hud.sp
 
If the include were missing, that would error instead. The include doesn't contain that function. Perhaps it's an older version.


All times are GMT -4. The time now is 03:51.

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