Raised This Month: $ Target: $400
 0% 

[SOLVED]check map name/version


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 06-17-2009 , 03:18   [SOLVED]check map name/version
Reply With Quote #1

How can i check the map name or the map version?

if mapname == de_xxx
if mapname == cs_xxx

the what im working on it, can run on all maps. but in any maps i have to do anything more. so i want to check the map & do it.
__________________

Last edited by One; 06-17-2009 at 05:38.
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 06-17-2009 , 03:32   Re: check map name/version
Reply With Quote #2

get_mapname();
__________________
xPaw is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 06-17-2009 , 03:40   Re: check map name/version
Reply With Quote #3

lol yea get_mapname but how to check the the charchters before _ ?

if mapname == chatch_xxx
if mapname == de_xxx
if mapname == kz-bhop_

i mean it so. u can add more maps there. bullshit which. i need just the charachters befor underline
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-17-2009 , 04:02   Re: check map name/version
Reply With Quote #4

Use contain() after get_mapname().
__________________
Arkshine is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 06-17-2009 , 04:27   Re: check map name/version
Reply With Quote #5

heh?
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-17-2009 , 05:08   Re: check map name/version
Reply With Quote #6

Since you're Infinitely Awesome, you should understand that get_mapname() returns the map name and contain() will search a provided string.
__________________
Arkshine is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 06-17-2009 , 05:14   Re: check map name/version
Reply With Quote #7

sure i know how to use :

get_mapname(mapname, 32)

for example.

but i dont know how to contain ( const source[], const string[] )

need a mini example for contain

anything like contain ( de, _) ?
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
ehha
SourceMod Donor
Join Date: Apr 2006
Location: Sibiu
Old 06-17-2009 , 05:18   Re: check map name/version
Reply With Quote #8

Quote:
Originally Posted by arkshine View Post
Use contain() after get_mapname().
Get the map name in a vector with get_mapname() & then search a string in that vector with contain().
Code:
new map_name[32]; get_mapname(map_name, 31); if(contain(map_name, "fy_")){ //do this }

Last edited by ehha; 06-17-2009 at 15:32.
ehha is offline
Old 06-17-2009, 05:38
One
This message has been deleted by One.
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 06-17-2009 , 06:25   Re: [SOLVED]check map name/version
Reply With Quote #9

for the first time, this worked. after mapchange....
PHP Code:
#define GIVING_AN_SCOUT 3.0
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1);

public 
fwHamPlayerSpawnPostid 
{
    new 
map_version[32]
    
get_mapname(map_version,31)
    if(
contain(map_version,"def_"))
    {
        
set_task(GIVING_AN_SCOUT"giving_scout"id);
    }
    else if(
contain(map_version"dbhop_"))
    {
    }
}

public 
giving_scout(id)
{
    
give_item(id,"weapon_scout")

__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 06-17-2009 , 07:11   Re: [SOLVED]check map name/version
Reply With Quote #10

You must check if contain() doesn't return -1. You could do this (a bit faster IMO):
Code:
public fwHamPlayerSpawnPost( id ) {     new map_version[7]     get_mapname(map_version,6)     if(equali(map_version,"def_", 4))     {         set_task(GIVING_AN_SCOUT, "giving_scout", id);     }     else if(equali(map_version, "dbhop_", 6))     {     } }
__________________
hleV 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 15:34.


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