AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   if map name do this else do that (https://forums.alliedmods.net/showthread.php?t=195715)

fees 09-10-2012 17:47

if map name do this else do that
 
hello dear alliedmods forum members.

i need simple script ,

script get currect map name , if curret map dosen't in my special list than do somthing .

thanks.

Artifact 09-10-2012 18:09

Re: if map name do this else do that
 
PHP Code:

#include <amxmodx>
#include <amxmisc>

new const g_maps[]=
{
    
"de_dust2",
    
"de_inferno",
    
"de_nuke"
}

public 
plugin_init() {
    
register_plugin("""""")
    
set_task(5.0"chackMap")
}

public 
chackMap()
{
    new 
map[32]
    
get_mapname(map31)
    for(new 
i=0;i<=g_maps[i];i++)
    {
        if(!
equal(mapg_maps))
        {
            
//do something
        
}
    }


untested

fees 09-10-2012 18:29

Re: if map name do this else do that
 
error 001: expected token: ">" , but found "{"

line 23 after if(contain(map, g_maps)

jimaway 09-10-2012 18:54

Re: if map name do this else do that
 
Code:
#include <amxmodx> #include <amxmisc> new const g_maps[][] = {     "de_dust2",     "de_inferno",     "de_nuke" } public plugin_init() {     register_plugin("", "", "")     set_task(5.0, "chackMap") } public chackMap() {     new map[32]     get_mapname(map, 31)     for(new i=0;i< sizeof(g_maps);i++)     {         if(equal(map, g_maps[i])         {             //do something             break         }     } }

fysiks 09-10-2012 19:35

Re: if map name do this else do that
 
Quote:

Originally Posted by fees (Post 1796228)
hello dear alliedmods forum members.

i need simple script ,

script get currect map name , if curret map dosen't in my special list than do somthing .

thanks.

What is this "something" and how many maps are in your "special list"? There might be a way to do it without a plugin.

Artifact 09-11-2012 01:24

Re: if map name do this else do that
 
Quote:

Originally Posted by fees (Post 1796256)
error 001: expected token: ">" , but found "{"

line 23 after if(contain(map, g_maps)

PHP Code:

if(contain(mapg_maps

:arrow:
PHP Code:

if(!contain(mapg_maps)) 


jimaway 09-11-2012 04:53

Re: if map name do this else do that
 
you shouldnt use contain there since the plugin might get confused if you have like de_dust2_long or something in that list and the map is de_dust2, better to use equal

Artifact 09-11-2012 07:23

Re: if map name do this else do that
 
Fixed

gogicaa 09-11-2012 08:41

Re: if map name do this else do that
 
Quote:

Originally Posted by jimaway (Post 1796484)
better to use equal


Alka 09-11-2012 16:46

Re: if map name do this else do that
 
Actually it's better to use equali() in case you have some maps with names like dE_DuSt2 or w/e.


All times are GMT -4. The time now is 08:22.

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