Raised This Month: $7 Target: $400
 1% 

[TF2|API] Training Messsages


Post New Thread Reply   
 
Thread Tools Display Modes
Mr_panica
Senior Member
Join Date: Jan 2017
Location: Russia, Saint-Petersburg
Old 03-05-2021 , 16:21   Re: [TF2|API] Training Messsages
Reply With Quote #21

Quote:
Originally Posted by arthurdead View Post
did you call RemoveTrainingMessageFrom* properly

can you show your code via DM or here
I'm not very good at coding.
Here are the functions that I am using.
HTML Code:
public void SendHintToClient(int client, float time, char[] title, char[] message)
{	
	if (!IsClientSourceTV(client) || !IsClientReplay(client))
	{
		if(IsPlayerAlive(client))
		{
			PrintToServer("SendHintToClient (%N)", client);
			KillHintTimer(client);
			SendTrainingMessageToClient(client, title, message);
			Timer_Hint[client] = CreateTimer(time, TIMER_END_HINT, client);
		}
	}
}

public Action TIMER_END_HINT(Handle hTimer, int client)
{
	KillHintTimer(client);
	DeleteTrainingMessageFromClient(client);

	return Plugin_Continue;
}

public void DeleteTrainingMessageFromClient(int client)
{
	if(!IsClientReplay(client) && !IsClientSourceTV(client) && IsClientConnected(client) && IsTrainingMessageVisibleToClient(client))
		RemoveTrainingMessageFromClient(client);
}


public void KillHintTimer(int client)
{
	if(Timer_Hint[client] != INVALID_HANDLE)
	{
		KillTimer(Timer_Hint[client]);
		Timer_Hint[client] = INVALID_HANDLE;
	}
}
__________________
Sorry for my English.
Mr_panica is offline
arthurdead
Senior Member
Join Date: Jul 2013
Old 03-05-2021 , 17:30   Re: [TF2|API] Training Messsages
Reply With Quote #22

Quote:
Originally Posted by Mr_panica View Post
I'm not very good at coding.
Here are the functions that I am using.
HTML Code:
public void SendHintToClient(int client, float time, char[] title, char[] message)
{	
	if (!IsClientSourceTV(client) || !IsClientReplay(client))
	{
		if(IsPlayerAlive(client))
		{
			PrintToServer("SendHintToClient (%N)", client);
			KillHintTimer(client);
			SendTrainingMessageToClient(client, title, message);
			Timer_Hint[client] = CreateTimer(time, TIMER_END_HINT, client);
		}
	}
}

public Action TIMER_END_HINT(Handle hTimer, int client)
{
	KillHintTimer(client);
	DeleteTrainingMessageFromClient(client);

	return Plugin_Continue;
}

public void DeleteTrainingMessageFromClient(int client)
{
	if(!IsClientReplay(client) && !IsClientSourceTV(client) && IsClientConnected(client) && IsTrainingMessageVisibleToClient(client))
		RemoveTrainingMessageFromClient(client);
}


public void KillHintTimer(int client)
{
	if(Timer_Hint[client] != INVALID_HANDLE)
	{
		KillTimer(Timer_Hint[client]);
		Timer_Hint[client] = INVALID_HANDLE;
	}
}
made a new commit: https://github.com/arthurdead/sm-plu...41a278e91b9f3b

try it out and see how it goes

btw you dont need the IsTrainingMessageVisibleToClient check
arthurdead is offline
arthurdead
Senior Member
Join Date: Jul 2013
Old 03-05-2021 , 18:30   Re: [TF2|API] Training Messsages
Reply With Quote #23

made a new commit:
https://github.com/arthurdead/sm-plu...5dd99ba59bf9d8

the plugin now filters out bot/reply/sourcetv by default so you dont need the bot/reply/sourcetv checks anymore

dont need the IsClientConnected check anymore either

Last edited by arthurdead; 03-05-2021 at 18:32.
arthurdead is offline
Mr_panica
Senior Member
Join Date: Jan 2017
Location: Russia, Saint-Petersburg
Old 03-06-2021 , 12:27   Re: [TF2|API] Training Messsages
Reply With Quote #24

Quote:
Originally Posted by arthurdead View Post
made a new commit: https://github.com/arthurdead/sm-plu...41a278e91b9f3b

try it out and see how it goes

btw you dont need the IsTrainingMessageVisibleToClient check

Hmm. It's okay for now.
I noticed a couple of times that the Training Message was visible when it was forbidden, but only for a moment.
__________________
Sorry for my English.
Mr_panica is offline
Mr_panica
Senior Member
Join Date: Jan 2017
Location: Russia, Saint-Petersburg
Old 03-19-2021 , 12:57   Re: [TF2|API] Training Messsages
Reply With Quote #25

I keep getting crashes on my server.
This may be due to your sendproxy extension as seen from the function names in Stack Trace.

https://crash.limetech.org/uvq2gez2e5uk

Code:
Stack Trace
Function
0	linux-gate.so!__kernel_vsyscall + 0x10
1	libc-2.17.so!__GI_raise + 0x47
2	libc-2.17.so!__GI_abort + 0x143
3	accelerator.ext.so!terminateHandler() + 0x54
4	libstdc++.so.6.0.19!std::rethrow_exception(std::__exception_ptr::exception_ptr) + 0x93
5	libstdc++.so.6.0.19!std::terminate() + 0x1f
6	libstdc++.so.6.0.19!__cxa_pure_virtual + 0x32
7	sdktools.ext.2.tf2.so!GetGameRulesProxyEnt [gamerulesnatives.cpp:56 + 0x6] 
8	sdktools.ext.2.tf2.so!GameRules_SetProp [gamerulesnatives.cpp:237 + 0x5] 
9	0xcc8929ce
10	0xd37bfe5b
11	0xcc8925ff
12	0xe499806f
13	sourcepawn.jit.x86.so!sp::Environment::Invoke [environment.cpp:296 + 0xe] 
14	sourcepawn.jit.x86.so!sp::PluginContext::Invoke [plugin-context.cpp:454 + 0x1a] 
15	sourcepawn.jit.x86.so!sp::ScriptedInvoker::Invoke [scripted-invoker.cpp:301 + 0x21] 
16	sourcemod.logic.so!FakeNativeRouter [smn_fakenatives.cpp:90 + 0x12] 
17	0xe49ad2e3
18	0xcff68832
19	0xcff686ba
20	0xe499806f
21	sourcepawn.jit.x86.so!sp::Environment::Invoke [environment.cpp:296 + 0xe] 
22	sourcepawn.jit.x86.so!sp::PluginContext::Invoke [plugin-context.cpp:454 + 0x1a] 
23	sourcepawn.jit.x86.so!sp::ScriptedInvoker::Invoke [scripted-invoker.cpp:301 + 0x21] 
24	sourcepawn.jit.x86.so!sp::ScriptedInvoker::Execute [scripted-invoker.cpp:190 + 0xc] 
25	sourcemod.logic.so!<name omitted> [smn_timers.cpp:144 + 0xf] 
26	sourcemod.2.tf2.so!TimerSystem::RunFrame [TimerSys.cpp:257 + 0xf] 
27	sourcemod.2.tf2.so!TimerSystem::GameFrame [TimerSys.cpp:232 + 0x8] 
28	sourcemod.2.tf2.so!__SourceHook_FHCls_IServerGameDLLGameFramefalse::CMyDelegateImpl::Call [FastDelegate.h:994 + 0xc] 
29	sourcemod.2.tf2.so!__SourceHook_FHCls_IServerGameDLLGameFramefalse::Func [sourcemod.cpp:54 + 0x20] 
30	engine_srv.so!SV_Think(bool) + 0x1df
31	engine_srv.so!SV_Frame(bool) + 0x1c8
32	engine_srv.so!_Host_RunFrame_Server(bool) + 0x158
33	engine_srv.so!_Host_RunFrame(float) + 0x4c7
34	engine_srv.so!CHostState::State_Run(float) + 0xc7
35	engine_srv.so!CHostState::FrameUpdate(float) + 0x166
36	engine_srv.so!HostState_Frame(float) + 0x1d
37	engine_srv.so!CEngine::Frame() + 0x773
38	engine_srv.so!CDedicatedServerAPI::RunFrame() + 0x26
39	dedicated_srv.so!RunServer() + 0x3a
40	engine_srv.so!CModAppSystemGroup::Main() + 0x9d
41	engine_srv.so!CAppSystemGroup::Run() + 0x38
42	engine_srv.so!CDedicatedServerAPI::ModInit(ModInfo_t&) + 0x1dd
43	dedicated_srv.so!CDedicatedAppSystemGroup::Main() + 0x93
44	dedicated_srv.so!CAppSystemGroup::Run() + 0x38
45	dedicated_srv.so!CAppSystemGroup::Run() + 0x38
46	dedicated_srv.so!main + 0x1c8
47	srcds_linux!main + 0x27b
48	libc-2.17.so!__libc_start_main + 0xf3
49	srcds_linux + 0xb85
50	srcds_linux + 0x750
51	srcds_linux + 0xc50
52	srcds_linux + 0xcc0
53	ld-2.17.so + 0x10020
__________________
Sorry for my English.
Mr_panica is offline
arthurdead
Senior Member
Join Date: Jul 2013
Old 03-19-2021 , 17:14   Re: [TF2|API] Training Messsages
Reply With Quote #26

Quote:
Originally Posted by Mr_panica View Post
I keep getting crashes on my server.
This may be due to your sendproxy extension as seen from the function names in Stack Trace.

https://crash.limetech.org/uvq2gez2e5uk
download the latest version of both the plugin and the extension

https://github.com/arthurdead/sm-plu...trainingmsg.sp
https://github.com/arthurdead/sendproxy/releases
arthurdead is offline
Mr_panica
Senior Member
Join Date: Jan 2017
Location: Russia, Saint-Petersburg
Old 03-19-2021 , 18:11   Re: [TF2|API] Training Messsages
Reply With Quote #27

Thank.
I downloaded the new version of the plugin.
But I already have the latest version of your extension.
__________________
Sorry for my English.
Mr_panica is offline
Mr_panica
Senior Member
Join Date: Jan 2017
Location: Russia, Saint-Petersburg
Old 03-21-2021 , 07:00   Re: [TF2|API] Training Messsages
Reply With Quote #28

Can you add the ability to color the text as in the standard tooltips from the game?
__________________
Sorry for my English.
Mr_panica is offline
arthurdead
Senior Member
Join Date: Jul 2013
Old 03-21-2021 , 18:58   Re: [TF2|API] Training Messsages
Reply With Quote #29

Quote:
Originally Posted by Mr_panica View Post
Can you add the ability to color the text as in the standard tooltips from the game?
edit: see below

Last edited by arthurdead; 03-22-2021 at 07:35.
arthurdead is offline
arthurdead
Senior Member
Join Date: Jul 2013
Old 03-22-2021 , 07:37   Re: [TF2|API] Training Messsages
Reply With Quote #30

i have realized that i am retarded......

you can just use \x2 to make the text hinted and \x1 to return it to normal
i removed the stock

https://github.com/arthurdead/sm-plu...sg.inc#L48-L51
arthurdead is offline
Reply


Thread Tools
Display Modes

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 05:55.


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