Raised This Month: $ Target: $400
 0% 

Hook restartgame


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
rodrigo286
Veteran Member
Join Date: Sep 2010
Location: Brazil, São Paulo
Old 11-18-2012 , 13:18   Hook restartgame
Reply With Quote #1

Is there a way to detect the event command mp_restartgame 1?

For every time you use this command, even if I put the event roundend to finish something, it does not work if the game is restarted, now it is stopped using a command eg sm_slay @ all, it works, example:

PHP Code:
HookEvent("round_end"RoundEnd);

public 
Action:RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));

    
bClientsShow[client] = false;

If I used a sm_slay @all, everything goes normal, but if I use mp_restartgame 1, everything that I put into the "RoundEnd" is ignored.

Thanks.
__________________
My Plugins | VIEW HERE | I accept private requests, send me a PM.
Buy respawn | Uber Recall | Grenade drop | Damage Supperssor
Meet the Medic | Disguise Expert | Crazy Jet

CZSBrasil TEAM

Last edited by rodrigo286; 11-18-2012 at 13:20.
rodrigo286 is offline
minimoney1
SourceMod Donor
Join Date: Dec 2010
Old 11-18-2012 , 13:47   Re: Hook restartgame
Reply With Quote #2

Quote:
Originally Posted by rodrigo286 View Post
Is there a way to detect the event command mp_restartgame 1?

For every time you use this command, even if I put the event roundend to finish something, it does not work if the game is restarted, now it is stopped using a command eg sm_slay @ all, it works, example:

PHP Code:
HookEvent("round_end"RoundEnd);

public 
Action:RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));

    
bClientsShow[client] = false;

If I used a sm_slay @all, everything goes normal, but if I use mp_restartgame 1, everything that I put into the "RoundEnd" is ignored.

Thanks.
If this is CS:S, then try using CS_OnTerminateRound().
__________________
Need help? PM me or add me on Steam.
My Steam




Quote:
Originally Posted by Rp.KryptoNite View Post
For some reason his Plugin never worked for me ,
@credits were added
im not stealing any plugins dude its my THING
minimoney1 is offline
Sheepdude
SourceMod Donor
Join Date: Aug 2012
Location: Chicago
Old 11-18-2012 , 19:25   Re: Hook restartgame
Reply With Quote #3

Will this work for what you need?

Code:
#pragma semicolon 1
#include <sourcemod>

new Handle:h_MP_RESTARTGAME = INVALID_HANDLE;

public OnPluginStart()
{
	h_MP_RESTARTGAME = FindConVar("mp_restartgame");
	if(h_MP_RESTARTGAME != INVALID_HANDLE)
		HookConVarChange(h_MP_RESTARTGAME, ConvarChanged);
}

public ConvarChanged(Handle:cvar, const String:oldVal[], const String:newVal[])
{
	if(StrEqual(newVal, "1"))
	{
		// Do stuff
	}
}
__________________
Sheepdude is offline
Zephyrus
Cool Pig B)
Join Date: Jun 2010
Location: Hungary
Old 11-19-2012 , 01:19   Re: Hook restartgame
Reply With Quote #4

i think mp_restartgame is a command
__________________
Taking private C++/PHP/SourcePawn requests, PM me.
Zephyrus is offline
mcpan313
Senior Member
Join Date: Mar 2010
Old 11-19-2012 , 02:28   Re: Hook restartgame
Reply With Quote #5

Quote:
Originally Posted by Zephyrus View Post
i think mp_restartgame is a command
Is indeed convar.
__________________
sorry, for my poor english.
mcpan313 is offline
Send a message via MSN to mcpan313
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 10:11.


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