Raised This Month: $ Target: $400
 0% 

if map name do this else do that


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fees
Junior Member
Join Date: Sep 2012
Old 09-10-2012 , 17:47   if map name do this else do that
Reply With Quote #1

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.
fees is offline
Artifact
Veteran Member
Join Date: Jul 2010
Old 09-10-2012 , 18:09   Re: if map name do this else do that
Reply With Quote #2

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
__________________

Last edited by Artifact; 09-11-2012 at 07:23.
Artifact is offline
fees
Junior Member
Join Date: Sep 2012
Old 09-10-2012 , 18:29   Re: if map name do this else do that
Reply With Quote #3

error 001: expected token: ">" , but found "{"

line 23 after if(contain(map, g_maps)
fees is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 09-10-2012 , 18:54   Re: if map name do this else do that
Reply With Quote #4

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         }     } }

Last edited by jimaway; 09-10-2012 at 18:56.
jimaway is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-10-2012 , 19:35   Re: if map name do this else do that
Reply With Quote #5

Quote:
Originally Posted by fees View Post
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.
__________________
fysiks is offline
Artifact
Veteran Member
Join Date: Jul 2010
Old 09-11-2012 , 01:24   Re: if map name do this else do that
Reply With Quote #6

Quote:
Originally Posted by fees View Post
error 001: expected token: ">" , but found "{"

line 23 after if(contain(map, g_maps)
PHP Code:
if(contain(mapg_maps

PHP Code:
if(!contain(mapg_maps)) 
__________________

Last edited by Artifact; 09-11-2012 at 01:25.
Artifact is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 09-11-2012 , 04:53   Re: if map name do this else do that
Reply With Quote #7

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

Last edited by jimaway; 09-11-2012 at 04:54.
jimaway is offline
Artifact
Veteran Member
Join Date: Jul 2010
Old 09-11-2012 , 07:23   Re: if map name do this else do that
Reply With Quote #8

Fixed
__________________
Artifact is offline
gogicaa
Veteran Member
Join Date: Aug 2011
Location: //
Old 09-11-2012 , 08:41   Re: if map name do this else do that
Reply With Quote #9

Quote:
Originally Posted by jimaway View Post
better to use equal
gogicaa is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 09-11-2012 , 16:46   Re: if map name do this else do that
Reply With Quote #10

Actually it's better to use equali() in case you have some maps with names like dE_DuSt2 or w/e.
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 09-11-2012 at 16:47.
Alka 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 08:22.


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