Raised This Month: $ Target: $400
 0% 

changelevel


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Backstabnoob
Veteran Member
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-06-2012 , 14:10   changelevel
Reply With Quote #1

Is there any way to hook "changelevel" command, so you can change the map to something else before the server does?
__________________
Currently busy working on a very large scale anime database project.
Backstabnoob is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 06-06-2012 , 14:25   Re: changelevel
Reply With Quote #2

public server_changelevel ( map[] )
jimaway is offline
rak
Veteran Member
Join Date: Oct 2011
Location: banned country
Old 06-06-2012 , 19:37   Re: changelevel
Reply With Quote #3

or you can hook the intermission and change the map or change the cvar "amx_nextmap"
__________________

www.amxmodx-es.com

Steam: Luchokoldo
rak is offline
Send a message via MSN to rak Send a message via Skype™ to rak
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-07-2012 , 00:21   Re: changelevel
Reply With Quote #4

To hook changelevel command i'm affraid you have to hook engine, using orpheu or rage module.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 06-07-2012 , 09:59   Re: changelevel
Reply With Quote #5

Quote:
Originally Posted by jimaway View Post
public server_changelevel ( map[] )
There's no return for that forward. It's called afterwards.


You can't actually hook CGameRules::ChangeLevel, use GoToIntermission instead. The advantage of this is that it will not be called when a server admin changes the map via amxmodmenu or amx_map:

Code:
#include <amxmodx> #include <orpheu> #include <orpheu_stocks> new g_pGameRules; public plugin_precache() {     OrpheuRegisterHook( OrpheuGetFunction( "InstallGameRules" ), "On_InstallGameRules", OrpheuHookPost ); } public plugin_init() {     OrpheuRegisterHookFromObject( g_pGameRules, "GoToIntermission", "CGameRules", "On_GoToIntermission" ); } public On_InstallGameRules() {     g_pGameRules = OrpheuGetReturn(); } public OrpheuHookReturn: On_GoToIntermission() {     /* Change level / set short task to change level here / change amx_nextmap */ }
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
WaLkMaN
Senior Member
Join Date: Oct 2010
Location: Varna, Bulgaria
Old 05-06-2023 , 09:53   Re: changelevel
Reply With Quote #6

Quote:
Originally Posted by hornet View Post
There's no return for that forward. It's called afterwards.


You can't actually hook CGameRules::ChangeLevel, use GoToIntermission instead. The advantage of this is that it will not be called when a server admin changes the map via amxmodmenu or amx_map:

Code:
#include <amxmodx> #include <orpheu> #include <orpheu_stocks> new g_pGameRules; public plugin_precache() {     OrpheuRegisterHook( OrpheuGetFunction( "InstallGameRules" ), "On_InstallGameRules", OrpheuHookPost ); } public plugin_init() {     OrpheuRegisterHookFromObject( g_pGameRules, "GoToIntermission", "CGameRules", "On_GoToIntermission" ); } public On_InstallGameRules() {     g_pGameRules = OrpheuGetReturn(); } public OrpheuHookReturn: On_GoToIntermission() {     /* Change level / set short task to change level here / change amx_nextmap */ }
With ReAPI:

Code:
#include <amxmodx> #include <reapi> public plugin_init() {     RegisterHookChain( RG_CSGameRules_GoToIntermission, "On_GoToIntermission", true ); } public On_GoToIntermission() {     /* Change level / set short task to change level here / change amx_nextmap */ }
__________________
WaLkMaN 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 18:44.


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