Raised This Month: $ Target: $400
 0% 

My first plugin [Force Map Change]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Siniak19
Junior Member
Join Date: May 2014
Old 09-16-2014 , 07:47   My first plugin [Force Map Change]
Reply With Quote #1

Hi, today i started my journey with sourcepawn.

What I want to achieve? I want to force change map on every match/map end. My server is only dd2, and csgo its only restarting the match not changing map.

Code:
#include <sourcemod>
#include <sdktools>

new String:Map[64]

public Plugin:myinfo =
{
    name = "Force Map Change",
    author = "vux",
    description = "Force Map Change for AimingHard.com",
    version = "1.0",
    url = "http://aiminghard.com"
};

public OnMapEnd()
{
	GetCurrentMap(Map, sizeof(Map))
	ForceChangeLevel(Map, "Reloading current map.")
};

Last edited by Siniak19; 09-16-2014 at 07:49.
Siniak19 is offline
hamilton5
Veteran Member
Join Date: Oct 2012
Location: USA
Old 09-16-2014 , 08:07   Re: My first plugin [Force Map Change]
Reply With Quote #2

"mp_match_end_changelevel" = "0" min. 0.000000 max. 1.000000 game replicated - At the end of the match, perform a changelevel even if next map is the same
hamilton5 is offline
ESK0
BANNED
Join Date: May 2014
Location: Czech Republic
Old 09-16-2014 , 08:18   Re: My first plugin [Force Map Change]
Reply With Quote #3

Otherwise ) If u want to use your own plugins ) instead of cvar..

Change this

PHP Code:
// Remove new String: Map from top.

// And change your MapEnd to this
public OnMapEnd()
{
    
decl StringMap[32];
    
GetCurrentMap(Mapsizeof(Map))
    
ForceChangeLevel(Map"Reloading current map.")
}; 
ESK0 is offline
Siniak19
Junior Member
Join Date: May 2014
Old 09-16-2014 , 09:58   Re: My first plugin [Force Map Change]
Reply With Quote #4

@hamilton5

Thanks, i used this cvar and it works well. Thanks for help.

@ESK0

It doesn't work, but if there is cvar it's no sense to write plugins. Thanks for help anyway.
Siniak19 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 09-16-2014 , 10:07   Re: My first plugin [Force Map Change]
Reply With Quote #5

Instead of using 64 of 32 for the map variable, use PLATFORM_MAX_PATH. You never know how long workshop paths will be.
__________________
Not currently working on SourceMod plugin development.
Powerlord 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 05:17.


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