AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   only de_,cs_ (https://forums.alliedmods.net/showthread.php?t=143701)

m_pro_m 11-23-2010 14:17

only de_,cs_
 
Hi ...
How i can do so method, whoes will do something only when will be de_ or cs_ map ?
ex. Now is on the server aim_dgl map. Menu -> dont open
ex2. Is map as de_dust2. Menu -> OPEN !

Do you understand ? Thanks

Exolent[jNr] 11-23-2010 14:19

Re: only de_,cs_
 
Either use per-map plugin feature, or use get_mapname() to check map name for allowed maps.

m_pro_m 11-23-2010 14:24

Re: only de_,cs_
 
hm ... but i dont know a name of map :D ... i need some function whoes will know do it

Exolent[jNr] 11-23-2010 14:27

Re: only de_,cs_
 
Use get_mapname() and compare the first part to check for "de_" or "cs_".

m_pro_m 11-23-2010 14:31

Re: only de_,cs_
 
Quote:

Originally Posted by Exolent[jNr] (Post 1355250)
compare the first part to check for "de_" or "cs_".

How ? I am not so good in Pawn :/

Exolent[jNr] 11-23-2010 14:41

Re: only de_,cs_
 
There are several ways:
- equal(string, compare, length_to_check)
- contain(string, find) or strfind(string, find)
- Or check individual chars: string[0] == 'd' && string[1] == 'e' && string[2] == '_'

For methods 1 & 2, use the funcwiki for information about how to use the functions.

wrecked_ 11-23-2010 16:09

Re: only de_,cs_
 
I believe this would work too:

Code:
new mapname[4] get_mapname( mapname, 3 ) if( equali( mapname, "de_" ) )     // ...
OR
Code:
new mapname[20] get_mapname( mapname, 19 ) mapname[3] = 0 // or is it "\0" or something similar? if( equali( mapname, "de_" ) )     // ...

Correct me if I'm wrong. I'm more confident in the first one being true than the second one.

Exolent[jNr] 11-23-2010 16:32

Re: only de_,cs_
 
Those 2 are indeed the same, except the 2nd uses unnecessary memory.

And yes, '\0' = 0, except with Pawn's default escape character it would be '^0'.

There are 2 methods to escape an integer to a char:
1. '\33' where 33 is a decimal integer. This example results in 33 as the decimal integer, which corresponds to the exclamation point character '!'.
2. '\x33' where 33 is a hexadecimal integer. This example results in 51 as the decimal integer, which corresponds to the number 3 character '3'.

See http://www.asciitable.com for more info.

XLN's | [Lo]Phreak^n^c 11-24-2010 06:11

Re: only de_,cs_
 
Quote:

Originally Posted by m_pro_m (Post 1355247)
hm ... but i dont know a name of map :D ...

you can still use per-map plugin feature as Exolent said (with cs_ or de_ prefixes)

from amxx wiki ( http://wiki.amxmodx.org/index.php/Configuring_AMX_Mod_X )

For example, if you wanted the map de_dust to disable the plugin ham.amxx and enable the plugin pickle.amxx you would put this in amxmodx/configs/maps/plugins-de_dust.ini:
Code:

ham.amxx disabled
pickle.amxx

As of AMX Mod X 1.8.0, you are now able to create plugin.ini files for map prefixes. To do this, create a file called plugins-<prefix>.ini, where <prefix> would mean de, cs, awp, surf, ect. All prefix config files go in the same location as per map, the amxmodx/configs/maps/ directory. configs/maps/plugins-de.ini - Would enable/disable any plugins for all de_* maps.
Plugin based configuration files are loaded by map first (plugins-de_nuke.ini) and prefix second (plugins-de.ini).


All times are GMT -4. The time now is 11:23.

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