added cvar for trail lifetime, end and starth width
This commit is contained in:
parent
52a452708e
commit
1fa8a916d6
@ -15,6 +15,10 @@ int g_iSpriteModel[MAXPLAYERS + 1] = {-1, ...};
|
||||
|
||||
int g_iClientTrail[MAXPLAYERS + 1] = { -1, ... }; // index into g_hTrails, -1 = none
|
||||
|
||||
float g_fTrailsLifeTime = 1.0;
|
||||
int g_iTrailsStartWidth = 10;
|
||||
int g_iTrailsEndWidth = 6;
|
||||
|
||||
Handle g_hCookie_trailName;
|
||||
Handle g_hCookie_trailHide;
|
||||
|
||||
@ -53,6 +57,37 @@ public void OnPluginStart()
|
||||
SetCookieMenuItem(MenuHandler_CookieMenu, 0, "Unloze Trails");
|
||||
|
||||
g_hTrails = new ArrayList(sizeof(TrailData));
|
||||
|
||||
|
||||
ConVar cvar;
|
||||
HookConVarChange((cvar = CreateConVar("sm_unloze_trails_lifetime", "1.0", "Lifetime of trails")), Cvar_TrailsLifeTime);
|
||||
g_fTrailsLifeTime = cvar.FloatValue;
|
||||
delete cvar;
|
||||
|
||||
ConVar cvar1;
|
||||
HookConVarChange((cvar1 = CreateConVar("sm_unloze_trails_start_width", "10", "Start width of trails")), Cvar_TrailsStartWidth);
|
||||
g_iTrailsStartWidth = cvar1.IntValue;
|
||||
delete cvar1;
|
||||
|
||||
ConVar cvar2;
|
||||
HookConVarChange((cvar2 = CreateConVar("sm_unloze_trails_end_width", "6", "End width of trails")), Cvar_TrailsEndWidth);
|
||||
g_iTrailsEndWidth = cvar2.IntValue;
|
||||
delete cvar2;
|
||||
}
|
||||
|
||||
public void Cvar_TrailsEndWidth(ConVar convar, const char[] oldValue, const char[] newValue)
|
||||
{
|
||||
g_iTrailsEndWidth = convar.IntValue;
|
||||
}
|
||||
|
||||
public void Cvar_TrailsStartWidth(ConVar convar, const char[] oldValue, const char[] newValue)
|
||||
{
|
||||
g_iTrailsStartWidth = convar.IntValue;
|
||||
}
|
||||
|
||||
public void Cvar_TrailsLifeTime(ConVar convar, const char[] oldValue, const char[] newValue)
|
||||
{
|
||||
g_fTrailsLifeTime = convar.FloatValue;
|
||||
}
|
||||
|
||||
public void MenuHandler_CookieMenu(int client, CookieMenuAction action, any info, char[] buffer, int maxlen)
|
||||
@ -371,10 +406,14 @@ public void SpawnTrail(int client)
|
||||
|
||||
if (g_iSpriteModel[client] != -1)
|
||||
{
|
||||
|
||||
DispatchKeyValueFloat(g_iSpriteModel[client], "lifetime", 2.0);
|
||||
DispatchKeyValue(g_iSpriteModel[client], "startwidth", "10");
|
||||
DispatchKeyValue(g_iSpriteModel[client], "endwidth", "6");
|
||||
DispatchKeyValueFloat(g_iSpriteModel[client], "lifetime", g_fTrailsLifeTime);
|
||||
char startwidth[16];
|
||||
Format(startwidth, sizeof(startwidth), "%i", g_iTrailsStartWidth);
|
||||
DispatchKeyValue(g_iSpriteModel[client], "startwidth", startwidth);
|
||||
|
||||
char endwidth[16];
|
||||
Format(endwidth, sizeof(endwidth), "%i", g_iTrailsEndWidth);
|
||||
DispatchKeyValue(g_iSpriteModel[client], "endwidth", endwidth);
|
||||
|
||||
TrailData trail;
|
||||
g_hTrails.GetArray(g_iClientTrail[client], trail);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user