Quote:
Originally Posted by Dragonshadow
Yea thats really simple
|
I was messing with this code to try and convert it to work for the rage meter but I'm not sure what the code is for the ragemeter. Is it like flRageMeter or something close to that?
PHP Code:
#include <sourcemod>
#include <tf2_stocks>
new Handle:m_Rate = INVALID_HANDLE;
new Handle:m_Size = INVALID_HANDLE;
//new Handle:m_Enabled = INVALID_HANDLE;
public Plugin:myinfo =
{
name = "[TF2] Engineer Metal Regen",
author = "DarthNinja",
description = "Regenerates engineers build metal at a configurable rate.",
version = "1.5.2",
url = "http://www.sourcemod.net/",
}
public OnPluginStart()
{
CreateConVar("sm_rmetal_version", "1.5.2", "Metal Regen Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
m_Rate = CreateConVar("sm_rmetal_rate", "5.0", "How fast in seconds to regen metal");
m_Size = CreateConVar("sm_rmetal_size", "5", "How much metal to regen per tick");
HookEvent("player_spawn", Event_PlayerSpawn);
}
public Action:Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new TFClassType:class = TF2_GetPlayerClass(client);
if(class == TFClass_Engineer)
{
CreateRegen(client)
}
else
{
//Not Engi
}
return Plugin_Continue;
}
 
CreateRegen(client)
{
new Rate = GetConVarFloat(m_Rate);
CreateTimer(Rate, Timer_Regen, client, TIMER_REPEAT);
}
public Action:Timer_Regen(Handle:timer, any:value)
{
new client = value & 0x7f;
if (!IsClientInGame(client)
|| !IsPlayerAlive(client))
{
//KillTimer(timer);
return Plugin_Stop;
}
else
{
//Add admin check here
new metal = GetEntData(client, FindDataMapOffs(client, "m_iAmmo") + (3 * 4));
if (metal < 200)
{
new Size = GetConVarInt(m_Size);
new newmetal = metal + Size
SetEntData(client, FindDataMapOffs(client, "m_iAmmo") + (3 * 4), newmetal, 4, true);
}
else if (metal > 200)
{
SetEntData(client, FindDataMapOffs(client, "m_iAmmo") + (3 * 4), 200, 4, true);
}
return Plugin_Continue;
}
}