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

Force map change


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Tentacle Master
Member
Join Date: Jan 2012
Old 06-30-2012 , 19:02   Force map change
Reply With Quote #1

I am having difficulty forcing a map change in L4D2

neither of the following commands are working for me. Everything else works, I see the printtochatall output just fine. below is a snip of my code.

ServerCommand("changelevel %s", mapname);
ForceChangeLevel(mapname, "Just Because");

Code:
public OnPluginStart()
{
    hMap = CreateConVar("FFF_Map", "c5m1_highway", "Force Map Change to this map",FCVAR_PLUGIN|FCVAR_NOTIFY);
}
    

public OnEntityCreated(entity, const String:classname[])
{
    new CurrentEnts = entity;
    if (CurrentEnts == 2000) {
        decl String:mapname[64];
        GetConVarString(hMap, mapname, sizeof(mapname));
        PrintToChatAll("Force changing map now...", mapname);
        //ServerCommand("changelevel %s", mapname);
        ForceChangeLevel(mapname, "Just because");
    }
}
__________________
Maximum Online Gaming: Multi Tanks Maximum Spawn Servers (MTMS) Head Admin / Programmer

Plugins:
Automatic Main Menu Opener -public ||| My Little Pony Models Pack -public ||| No One Left4Dead -private ||| Fortspawn 2 -private
Tentacle Master is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 06-30-2012 , 20:58   Re: Force map change
Reply With Quote #2

"Just because" is the name of a map ?
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
minimoney1
SourceMod Donor
Join Date: Dec 2010
Old 06-30-2012 , 21:34   Re: Force map change
Reply With Quote #3

Quote:
Originally Posted by berni View Post
"Just because" is the name of a map ?
"Just because" is the reason.

EDIT: What does it say when you use PrintToChatAll("Force changing map now... to %s", mapname);
(What map does it show? Your syntax was wrong)

Last edited by minimoney1; 06-30-2012 at 21:36.
minimoney1 is offline
Tentacle Master
Member
Join Date: Jan 2012
Old 07-01-2012 , 02:21   Re: Force map change
Reply With Quote #4

The reason is this

c5m1_highway
yeah, that's not a map. It's c2m1_highway.....

So yeah time to beat my head into a wall.
__________________
Maximum Online Gaming: Multi Tanks Maximum Spawn Servers (MTMS) Head Admin / Programmer

Plugins:
Automatic Main Menu Opener -public ||| My Little Pony Models Pack -public ||| No One Left4Dead -private ||| Fortspawn 2 -private
Tentacle Master 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 12:17.


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