AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED]check map name/version (https://forums.alliedmods.net/showthread.php?t=94910)

One 06-17-2009 03:18

[SOLVED]check map name/version
 
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.

xPaw 06-17-2009 03:32

Re: check map name/version
 
get_mapname();

One 06-17-2009 03:40

Re: check map name/version
 
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 :(

Arkshine 06-17-2009 04:02

Re: check map name/version
 
Use contain() after get_mapname().

One 06-17-2009 04:27

Re: check map name/version
 
heh? :shock:

Arkshine 06-17-2009 05:08

Re: check map name/version
 
Since you're Infinitely Awesome, you should understand that get_mapname() returns the map name and contain() will search a provided string.

One 06-17-2009 05:14

Re: check map name/version
 
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, _) ?

ehha 06-17-2009 05:18

Re: check map name/version
 
Quote:

Originally Posted by arkshine (Post 850681)
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 }

One 06-17-2009 06:25

Re: [SOLVED]check map name/version
 
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")



hleV 06-17-2009 07:11

Re: [SOLVED]check map name/version
 
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))     {     } }


All times are GMT -4. The time now is 15:33.

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