Raised This Month: $ Target: $400
 0% 

Whats wrong with my code?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 08-08-2010 , 09:20   Whats wrong with my code?
Reply With Quote #1

Look,Im not to good at all in this,but I made what I can,when I use say /maps on chat my server crash without errors.So I need some help on this,(I Made this code based on bot apology for tk by fysiks)

Code...
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "#8 SickneSS"

#define MAXMAPS        20

new Maps[MAXMAPS][32]

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /maps","MapsMenu",ADMIN_MAP)
}

public 
MapsMenu(id,level,cid
{
    if(!
cmd_access(id,level,cid,1))
        return 
PLUGIN_HANDLED
        
    
new Menu menu_create("\r[Mix Maker]\y Maps Menu :","MapsMenu_Handler")
    
    new 
Mapname[32]
    new 
Item[MAXMAPS]
    
    new 
MapFile[64]
    
get_configsdir(MapFile,63)
    
add(MapFile,63,"/mapsmenu.ini")
    
    new 
Num
    
if(!file_exists(MapFile))
        
client_cmd(id,"amx_mapmenu")
    else
    {
        new 
fopen(MapFile,"rt")
    
        for(new 
0;MAXMAPS;i++)
        {
            while(!
feof(f))
            {
                
fgets(f,Mapname,31)
                
                if(!
Mapname[0] || Mapname[0] == ';'
                
|| Mapname[0] == '/' && Mapname[1] == '/') continue;
                         
                
trim(Mapname)
                
strtolower(Mapname)
            
                
Num++
                
num_to_str(Num,Item,MAXMAPS)
            
                
copy(Maps[i][MAXMAPS],31,Item)
                
menu_additem(Menu,Mapname,Item)    
            }
            
fclose(f)
        }

    }

    
menu_display(id,Menu)
    return 
PLUGIN_HANDLED
}

public 
MapsMenu_Handler(id,Menu,item)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(Menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
iData[6]
    new 
iName[64]
    new 
Access
    
new Callback
    menu_item_getinfo
(Menu,item,Access,iData,5,iName,63,Callback)
    
    new 
Map str_to_num(iData)
    
    if(
Map)
        
client_cmd(id,"amx_on;amx_map %s",iName)
        
    return 
PLUGIN_HANDLED

#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
 



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 00:11.


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