Raised This Month: $ Target: $400
 0% 

How do I check if a map is running?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
StrikerMan780
AlliedModders Donor
Join Date: Jul 2009
Location: Canada
Old 12-29-2013 , 23:39   Re: How do I check if a map is running?
Reply With Quote #1

Thankfully Asherkin on the IRC demonstrated how I could fix this.

I made a variable called bool:HasMapLoaded;

Then set it to true during OnMapStart. If I want to check if the map had loaded before spawning my entity, I just use if(!HasMapLoaded) { return; }. That stops the script if the map hasn't loaded yet.

OnMapEnd sets the variable back to false.

Quote:
Originally Posted by NIGathan View Post
Not sure if you're asking how to get the current map or how to run something once the map has loaded. Anyway, here's both:

http://docs.sourcemod.net/api/index....d=show&id=103&

http://docs.sourcemod.net/api/index....d=show&id=580&
Neither. I am also aware of those functions already. I wanted to find if there was a function to return true/false if the map was running, so I could run a block of code based on that condition. Ie. if(IsMapRunning == true) { // Do something }. Turns out there wasn't, so I had to do what Asherkin advised me to do above.

Quote:
Edit: I m guessing that you did not preached your entity onmapstart ().
Had nothing to do with that, plus, it wouldn't have made a difference in the context / situation the entity is used in. As far as I'm aware, entities cannot be "precached" in the same sense of models, textures, and sounds to begin with.

Last edited by StrikerMan780; 01-04-2014 at 07:26.
StrikerMan780 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 20:57.


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