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

[TF2] Halloween Footprints


Post New Thread Reply   
 
Thread Tools Display Modes
AeroAcrobat
AlliedModders Donor
Join Date: Apr 2011
Location: lives in a circus
Old 02-03-2014 , 03:21   Re: [TF2] Halloween Footprints
Reply With Quote #21

Quote:
Originally Posted by talpa View Post
see screenshot
This does not happen it you go in 3rd person mode.
I haven't yet tested if others can see but I'm going to do soon.
__________________

Last edited by AeroAcrobat; 02-03-2014 at 03:23.
AeroAcrobat is offline
HelpMe
Senior Member
Join Date: Jun 2013
Location: Home
Old 02-09-2014 , 10:12   Re: [TF2] Halloween Footprints
Reply With Quote #22

Fixed my version of the plugin. Download provided down there and please upload a better version if needed.
Attached Files
File Type: sp Get Plugin or Get Source (footprints_public.sp - 234 views - 6.1 KB)
File Type: smx footprints_public.smx (6.5 KB, 129 views)

Last edited by HelpMe; 02-09-2014 at 10:12.
HelpMe is offline
vadia111
Senior Member
Join Date: Dec 2013
Old 03-15-2014 , 10:54   Re: [TF2] Halloween Footprints
Reply With Quote #23

how to use To make this a public command ???? i I could not
vadia111 is offline
Oshizu
Veteran Member
Join Date: Nov 2012
Location: Warsaw
Old 03-15-2014 , 13:10   Re: [TF2] Halloween Footprints
Reply With Quote #24

Quote:
Originally Posted by vadia111 View Post
how to use To make this a public command ???? i I could not
Quote:
Originally Posted by Konoha-Chan ❤ View Post
- Default flag is RESERVATION use admins_override.cfg to change it
Modify admin_override.cfg
__________________
...
Oshizu is offline
vadia111
Senior Member
Join Date: Dec 2013
Old 03-15-2014 , 13:35   Re: [TF2] Halloween Footprints
Reply With Quote #25

Overrides
{
/**
* By default, commands are registered with three pieces of information:
* 1)Command Name (for example, "csdm_enable")
* 2)Command Group Name (for example, "CSDM")
* 3)Command Level (for example, "changemap")
*
* You can override the default flags assigned to individual commands or command groups in this way.
* To override a group, use the "@" character before the name. Example:
* Examples:
* "@CSDM" "b" // Override the CSDM group to 'b' flag
* "csdm_enable" "bgi" // Override the csdm_enable command to 'bgi' flags
*
* Note that for overrides, order is important. In the above example, csdm_enable overwrites
* any setting that csdm_enable previously had.
*
* You can make a command completely public by using an empty flag string.



"sm_footsteps" "a" // fogo
}





and so it has to be configured? I do not know how it will look inside the admin_overrides??

Last edited by vadia111; 03-15-2014 at 13:36.
vadia111 is offline
Oshizu
Veteran Member
Join Date: Nov 2012
Location: Warsaw
Old 03-15-2014 , 13:39   Re: [TF2] Halloween Footprints
Reply With Quote #26

"sm_footsteps" ""
__________________
...
Oshizu is offline
lionheart1066
Senior Member
Join Date: Aug 2009
Old 04-03-2014 , 18:10   Re: [TF2] Halloween Footprints
Reply With Quote #27

Quote:
Originally Posted by HelpMe View Post
Fixed my version of the plugin. Download provided down there and please upload a better version if needed.
What exactly did you fix? Because I was still getting a player now and then ending up with the random footprints.
lionheart1066 is offline
HelpMe
Senior Member
Join Date: Jun 2013
Location: Home
Old 04-04-2014 , 12:28   Re: [TF2] Halloween Footprints
Reply With Quote #28

Quote:
Originally Posted by lionheart1066 View Post
What exactly did you fix? Because I was still getting a player now and then ending up with the random footprints.

Iunno what is wrong with it.

I also realized that it doesn't save the random prints option so I tried to fix that one.

Code:
#include <tf2attributes>
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <clientprefs>

new Float:FootprintID[MAXPLAYERS+1] = 0.0
new Handle:g_hCookieFoot;
new b_random[MAXPLAYERS + 1];
new Handle:g_hCookieRandomFoot;

public Plugin:myinfo = 
{
	name = "[TF2] Halloween Footprints with clientprefs",
	author = "Oshizu + Dyl0n + Pelipoika + Benjamin",
	description = "Looks Fancy Ahhhh",
	version ="1.0",
	url = "www.otaku-gaming.net"
}

public OnPluginStart()
{
	RegAdminCmd("sm_footprints", FootSteps, ADMFLAG_RESERVATION)
	RegAdminCmd("sm_footsteps", FootSteps, ADMFLAG_RESERVATION)

	g_hCookieFoot = RegClientCookie("footprints", "", CookieAccess_Private);
	g_hCookieRandomFoot = RegClientCookie("footprintsRandom", "", CookieAccess_Private);
	HookEvent("player_spawn", PlayerSpawn, EventHookMode_Post)
	for(new i = 1; i <= MaxClients; i++)
	{
		b_random[i] = 0;
	}
}

public OnClientDisconnect(client)
{
	if(FootprintID[client] > 0.0)
	{
		FootprintID[client] = 0.0
	}
}

public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
	new client = GetClientOfUserId(GetEventInt(event, "userid"));
	if(FootprintID[client] > 0.0)
	{
		TF2Attrib_SetByName(client, "SPELL: set Halloween footstep type", FootprintID[client]);
	}
}

public Action:FootSteps(client, args)
{
	new Handle:ws = CreateMenu(FootStepsCALLBACK);
	SetMenuTitle(ws, "Choose Your Footprints Effect");

	AddMenuItem(ws, "0", "No Effect");
	AddMenuItem(ws, "X", "----------", ITEMDRAW_DISABLED);
	AddMenuItem(ws, "1", "Team Based");
	AddMenuItem(ws, "7777", "Blue");
	AddMenuItem(ws, "933333", "Light Blue")
	AddMenuItem(ws, "8421376", "Yellow");
	AddMenuItem(ws, "4552221", "Corrupted Green");
	AddMenuItem(ws, "3100495", "Dark Green");
	AddMenuItem(ws, "51234123", "Lime");
	AddMenuItem(ws, "5322826", "Brown");
	AddMenuItem(ws, "8355220", "Oak Tree Brown");
	AddMenuItem(ws, "13595446", "Flames");
	AddMenuItem(ws, "8208497", "Cream");
	AddMenuItem(ws, "41234123", "Pink");
	AddMenuItem(ws, "300000", "Satan's Blue");
	AddMenuItem(ws, "2", "Purple");
	AddMenuItem(ws, "3", "4 8 15 16 23 42");
	AddMenuItem(ws, "83552", "Ghost In The Machine");
	AddMenuItem(ws, "9335510", "Holy Flame");
	AddMenuItem(ws, "1", "[Random]");

	DisplayMenu(ws, client, MENU_TIME_FOREVER);

	return Plugin_Handled;
}

public FootStepsCALLBACK(Handle:menu, MenuAction:action, client, param2)
{
	if(action == MenuAction_End) CloseHandle(menu);

	if(action == MenuAction_Select)
	{
		decl String:info[12];
		decl String:strFootprintsRandom[32];
		GetMenuItem(menu, param2, info, sizeof(info));
		
		new Float:weapon_glow = StringToFloat(info);
		FootprintID[client] = weapon_glow;
		if(weapon_glow == 0.0)
		{
			TF2Attrib_RemoveByName(client, "SPELL: set Halloween footstep type");
			SetClientCookie(client, g_hCookieFoot, info);
		}
		else
		{
			TF2Attrib_SetByName(client, "SPELL: set Halloween footstep type", weapon_glow);
			SetClientCookie(client, g_hCookieFoot, info);
		}
		if(param2 == 19)
		{
			b_random[client] = 1;
			IntToString(b_random[client], strFootprintsRandom, sizeof(strFootprintsRandom));
			SetClientCookie(client, g_hCookieRandomFoot, strFootprintsRandom);
		}
		else
		{
			b_random[client] = 0;
			IntToString(b_random[client], strFootprintsRandom, sizeof(strFootprintsRandom));
			SetClientCookie(client, g_hCookieRandomFoot, strFootprintsRandom);
		}
	}
}

public OnClientPutInServer(client)
{
	new iClient = client;
	CreateTimer(10.0, LoadCookies, iClient);
        //Ignore if it wasn't a valid client (rare).
        if(!IsClientInGame(client))
                return;
			
        SDKHook(client, SDKHook_PostThink, OnPostThink);
}

public OnPostThink(client)
{
	if(b_random[client] == 1)
	{
		switch(GetRandomInt(0,16))
		{
			case 0:
				TF2Attrib_SetByName(client, "SPELL: set Halloween footstep type", 1.0);
			case 1:
				TF2Attrib_SetByName(client, "SPELL: set Halloween footstep type", 7777.0);
			case 2:
				TF2Attrib_SetByName(client, "SPELL: set Halloween footstep type", 933333.0);
			case 3:
				TF2Attrib_SetByName(client, "SPELL: set Halloween footstep type", 8421376.0);
			case 4:
				TF2Attrib_SetByName(client, "SPELL: set Halloween footstep type", 4552221.0);
			case 5:
				TF2Attrib_SetByName(client, "SPELL: set Halloween footstep type", 3100495.0);
			case 6:
				TF2Attrib_SetByName(client, "SPELL: set Halloween footstep type", 51234123.0);
			case 7:
				TF2Attrib_SetByName(client, "SPELL: set Halloween footstep type", 5322826.0);
			case 8:
				TF2Attrib_SetByName(client, "SPELL: set Halloween footstep type", 8355220.0);
			case 9:
				TF2Attrib_SetByName(client, "SPELL: set Halloween footstep type", 13595446.0);
			case 10:
				TF2Attrib_SetByName(client, "SPELL: set Halloween footstep type", 8208497.0);
			case 11:
				TF2Attrib_SetByName(client, "SPELL: set Halloween footstep type", 41234123.0);
			case 12:
				TF2Attrib_SetByName(client, "SPELL: set Halloween footstep type", 300000.0);
			case 13:
				TF2Attrib_SetByName(client, "SPELL: set Halloween footstep type", 2.0);
			case 14:
				TF2Attrib_SetByName(client, "SPELL: set Halloween footstep type", 3.0);
			case 15:
				TF2Attrib_SetByName(client, "SPELL: set Halloween footstep type", 83552.0);
			case 16:
				TF2Attrib_SetByName(client, "SPELL: set Halloween footstep type", 9335510.0);
		}
	}
}

public OnClientPostAdminCheck(iClient)
{
	if(IsValidClient(iClient) && AreClientCookiesCached(iClient))
		LoadClientCookies(iClient);
	else
		CreateTimer(1.0, Timer_LoadCookies, iClient, TIMER_REPEAT);
}

public Action:Timer_LoadCookies(Handle:hTimer, any:iClient)
{
	if(!IsValidClient(iClient) || !AreClientCookiesCached(iClient))
		return Plugin_Continue;

	LoadClientCookies(iClient);
	return Plugin_Stop;
}

public Action:LoadCookies(Handle:hTimer, any:iClient)
{
	LoadClientCookies(iClient);

	return Plugin_Stop;
}

stock LoadClientCookies(iClient)
{
	if(!IsUserDesignated(iClient))
		return;

	decl String:strCookie[32];
	decl String:strSecondCookie[32];
	//
	GetClientCookie(iClient, g_hCookieFoot, strCookie, sizeof(strCookie));
	GetClientCookie(iClient, g_hCookieRandomFoot, strSecondCookie, sizeof(strSecondCookie));
	//
	new Float:footprintValue = 0.0;
	new footprintRandomValue = 0;
	//
	footprintValue = StringToFloat(strCookie);
	footprintRandomValue = StringToInt(strSecondCookie);
	//
	FootprintID[iClient] = footprintValue;
	b_random[iClient] = footprintRandomValue;
	
}

stock bool:IsUserDesignated(iClient)
{
	if(!CheckCommandAccess(iClient, "sm_footprints", 0))
		return false;

	return true;
}

stock bool:IsValidClient(iClient, bool:bReplay = true)
{
	if(iClient <= 0 || iClient > MaxClients || !IsClientInGame(iClient))
		return false;
	if(bReplay && (IsClientSourceTV(iClient) || IsClientReplay(iClient)))
		return false;
	return true;
}
Attached Files
File Type: smx footprints_public.smx (6.8 KB, 209 views)
File Type: sp Get Plugin or Get Source (footprints_public.sp - 205 views - 6.9 KB)
HelpMe is offline
lionheart1066
Senior Member
Join Date: Aug 2009
Old 04-08-2014 , 02:37   Re: [TF2] Halloween Footprints
Reply With Quote #29

Quote:
Originally Posted by HelpMe View Post
Iunno what is wrong with it.

I also realized that it doesn't save the random prints option so I tried to fix that one.
Then it sounds like there's something up with the way it's remembering client choices, cause this person in this screenshot doesn't have access to the menus, I even made sure and he gets random footprints.

http://steamcommunity.com/sharedfile.../?id=247004483
lionheart1066 is offline
Oshizu
Veteran Member
Join Date: Nov 2012
Location: Warsaw
Old 04-08-2014 , 07:27   Re: [TF2] Halloween Footprints
Reply With Quote #30

Quote:
Originally Posted by lionheart1066 View Post
Then it sounds like there's something up with the way it's remembering client choices, cause this person in this screenshot doesn't have access to the menus, I even made sure and he gets random footprints.

http://steamcommunity.com/sharedfile.../?id=247004483

Try this version
I've added variable reset on disconnect, so it shouldn't bug anymore
Attached Files
File Type: sp Get Plugin or Get Source (footprints.sp - 242 views - 6.9 KB)
File Type: smx footprints.smx (6.8 KB, 245 views)
__________________
...

Last edited by Oshizu; 04-08-2014 at 09:08.
Oshizu 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 09:41.


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