Raised This Month: $ Target: $400
 0% 

[REQ] Last map


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
popeye10
Senior Member
Join Date: May 2014
Location: Navi Mumbai (India)
Old 12-24-2014 , 09:38   Re: [REQ] Last map
Reply With Quote #2

PHP Code:
#include <amxmodx>

#define MAX_MAPS    5

new g_MapNames[MAX_MAPS][34]

public 
plugin_init() {
    
register_plugin("last played maps""0.2""ConnorMcLeod")
    
register_clcmd("amx_lastmaps""lastmapsCmd")
    
register_clcmd("say /lastmaps""lastmapsSayCmd")
}

public 
plugin_cfg() {
    new 
szLastMapsFile[64]
    
    
get_localinfo("amxx_configsdir"szLastMapsFile63)
    
format(szLastMapsFile63"%s/lastmaps.txt"szLastMapsFile)

    new 
File fopen(szLastMapsFile"rt")
    new 
i
    
new Temp[34]
    if(
File)
    {
        for(
i=0i<MAX_MAPSi++)
        {
            if(!
feof(File))
            {
                
fgets(FileTemp33)
                
replace(Temp33"^n""")
                
formatex(g_MapNames[i], 33Temp)
            }
        }
        
fclose(File)
    }

    
delete_file(szLastMapsFile)

    new 
CurrentMap[34]
    
get_mapname(CurrentMap33)

    
File fopen(szLastMapsFile"wt")
    if(
File)
    {
        
formatex(Temp33"%s^n"CurrentMap)
        
fputs(FileTemp)
        for(
i=0i<MAX_MAPS-1i++)
        {
            
CurrentMap g_MapNames[i]
            if(!
CurrentMap[0])
                break
            
formatex(Temp33"%s^n"CurrentMap)
            
fputs(FileTemp)
        }
        
fclose(File)
    }
}

public 
lastmapsCmd(id) {
    new 
LastMaps[256], n
    n 
+= formatex(LastMaps[n], 255-n"Last maps played are :")
    for(new 
ii<MAX_MAPSi++)
    {
        if(!
g_MapNames[i][0])
            break
        
+= formatex(LastMaps[n], 255-n"^n%s"g_MapNames[i])
    }
    
client_print(idprint_consoleLastMaps)
    return 
PLUGIN_HANDLED
}

public 
lastmapsSayCmd(id) {
    new 
LastMaps[192], n
    n 
+= formatex(LastMaps[n], 191-n"Last maps played are :")
    for(new 
ii<MAX_MAPSi++)
    {
        if(!
g_MapNames[i][0])
        {
            
+= formatex(LastMaps[n-1], 191-n+1".")
            break
        }
        
+= formatex(LastMaps[n], 191-n" %s%s"g_MapNames[i], i+== MAX_MAPS "." ",")
    }
    
client_print(idprint_chatLastMaps)
    return 
PLUGIN_CONTINUE

__________________
popeye10 is offline
 



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 23:26.


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