Raised This Month: $ Target: $400
 0% 

[Help] map info


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ujjl
Senior Member
Join Date: Jul 2009
Location: Hungary
Old 11-27-2009 , 18:01   [Help] map info
Reply With Quote #1

How can i get the mapname played?
ujjl is offline
master4life
Senior Member
Join Date: Mar 2006
Location: Germany
Old 11-27-2009 , 18:09   Re: [Help] map info
Reply With Quote #2

lol
PHP Code:
#include < amxmodx >

public plugin_init( ) {
    
register_plugin"Mapname""beta""wtf" );
    
    
register_clcmd"say /mapname""CmdMap" );    
}

public 
CmdMapid ) {
    new 
szMapname32 ];
    
get_mapnameszMapname31 );
    
    
client_printidprint_chat"%s"szMapname );

__________________


[img]http://img714.**************/img714/8612/33726.png[/img]
master4life is offline
Send a message via ICQ to master4life Send a message via MSN to master4life Send a message via Skype™ to master4life
ujjl
Senior Member
Join Date: Jul 2009
Location: Hungary
Old 11-27-2009 , 18:31   Re: [Help] map info
Reply With Quote #3

ujjl is offline
matsi
Thinkosaur
Join Date: Sep 2006
Old 11-27-2009 , 19:02   Re: [Help] map info
Reply With Quote #4

Type /currentmap or currentmap don't know which one but it should be default amx commnd iirc. But you can also see current map from status.
matsi is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 11-27-2009 , 21:03   Re: [Help] map info
Reply With Quote #5

Quote:
Originally Posted by matsi View Post
Type /currentmap or currentmap don't know which one but it should be default amx commnd iirc. But you can also see current map from status.
Yes but he is in scripting help, so... i think he don't want to know what mapname played, he want to know HOW TO DETECT that =p.
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-27-2009 , 22:37   Re: [Help] map info
Reply With Quote #6

You can save it as global if you know you gonna need it lot of times.

PHP Code:
#include < amxmodx >

new g_szMapName[32]

public 
plugin_init( )
{
    
register_plugin"Mapname""beta""wtf" )

    
register_clcmd"say /mapname""CmdMap" )

    
get_mapnameg_szMapNamecharsmax(g_szMapName) )
}

public 
CmdMapid )
{    
    
client_printidprint_chat"%s"g_szMapName )

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
ujjl
Senior Member
Join Date: Jul 2009
Location: Hungary
Old 11-28-2009 , 16:35   Re: [Help] map info
Reply With Quote #7

I want to apply map specific settings so i need to know if there is a map-named config file present in my mod directory.

eg if the played map is sev_leggo, and a sev_leggo.cfg file present in /valve/addons/sev09/maps folder, then i want to open it read data from there and close it. if there is no config file, then we dont have to do anything.
ujjl is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-28-2009 , 17:13   Re: [Help] map info
Reply With Quote #8

Quote:
Originally Posted by ujjl View Post
I want to apply map specific settings so i need to know if there is a map-named config file present in my mod directory.
Just use the map specific configs that are built into AMX Mod X.
__________________

Last edited by fysiks; 11-28-2009 at 17:15.
fysiks is offline
ujjl
Senior Member
Join Date: Jul 2009
Location: Hungary
Old 11-28-2009 , 17:17   Re: [Help] map info
Reply With Quote #9

i have to read data, not setting cvars ...

like:
item_healthkit 324.0 234.0 123.0
item_battery 1231.0 123.0 310.0

Last edited by ujjl; 11-28-2009 at 17:20.
ujjl is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-28-2009 , 17:25   Re: [Help] map info
Reply With Quote #10

PHP Code:
new szMapName[32], szFilePath[128]
get_mapname(szMapNamecharsmax(szMapName))

formatex(szFilePathcharsmax(szFilePath), "addons/sev09/maps/%s.cfg"szMapName)

new 
fopen(szFilePath"rt")

if(
f)
{
    
// File exists and is open to start reading.
    
new szData[64]
    
    while( !
feof(f) )
    {
        
fgets(szDatacharsmax(szData))
        
trim(szData)
        
        
// szData contains a line from the file.
        // Do something with it :).
    
}
    
fclose(f)

Here ya go .
__________________
fysiks 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 13:40.


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