AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Server crash on command (https://forums.alliedmods.net/showthread.php?t=126473)

reinert 05-09-2010 16:08

Server crash on command
 
Hey, why the hell my server is always crashing after i type: /shop

/shop opens up ShopMenu

here is my whole plugin:

http://pastebin.com/8rSCryFv

and if you are lazy to look up it all, just look here:

PHP Code:

public ShopMenu(id) {
    if (
PlayerCon[id]) {
        new 
title[100], m1[100], m2[100], m3[100], m4[100], m5[100]
        
format(title,99,"\wJusu taskai: \w%i"PlayerXP[id])
        if (!
PlayerDamage[id]){
        
format(m1,99,"\wZalos rodymas (Kaina: \w%i\w)"get_pcvar_num(ShopDamage))
        }else{
        
format(m1,99,"\dZalos rodymas\w *"get_pcvar_num(ShopDamage))
        } if(!
PlayerAwp[id]){
        
format(m2,99,"\wAwp naudojimas (Kaina: %i)"get_pcvar_num(ShopAwp))
        }else{
        
format(m2,99,"\wAwp naudojimas\w *"get_pcvar_num(ShopAwp))
        } if(!
PlayerPap[id]){
        
format(m3,99,"\wPapildomi bonusai (Kaina: \w%i\w)"get_pcvar_num(ShopPap))
        }else{
        
format(m3,99,"\wPapildomi bonusai\w *"get_pcvar_num(ShopPap))
        } if(!
PlayerKar[id]){
        
format(m4,99,"\wKario komplektas (Kaina: \w%i\w)"get_pcvar_num(ShopKar))
        }else{
        
format(m4,99,"\wKario komplektas\w *"get_pcvar_num(ShopKar))
        } if (!
PlayerSlot[id]){
        
format(m5,99,"\wSlotas serveryje (Kaina: \w%i\w)"get_pcvar_num(ShopSlot))
        }else{
        
format(m5,99,"\wSlotas serveryje\w *"get_pcvar_num(ShopSlot))
        }
        new 
menu menu_create(title"ShopMenuHandler")
        
menu_additem(menum1"2"0)
        
menu_additem(menum2"3",0)
        
menu_additem(menum3"4",0)
        
menu_additem(menum4"5",0)
        
menu_additem(menum5"6",0)
        
menu_setprop(menuMPROP_EXITMEXIT_ALL)
        
menu_display(idmenu0)
        }else{
        
client_print(idprint_chat,"!g[User Shop]!y Tik registruoti zaidejai gali naudotis menu.")
    }
    return 
PLUGIN_HANDLED
}

public 
ShopMenuHandler(idmenuitem) {
    if( 
item == MENU_EXIT ) {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], iName[64]
    new 
accesscallback
    
    menu_item_getinfo
(menuitemaccessdata,5iName63callback)
    
    new 
key str_to_num(data)
    
    switch(
key) {
        case 
1: {
            
ShopMenu(id)
        }
        case 
2: {
            if (!
PlayerDamage[id]){
            
BuyDamage(id)
            }else{
            
ShopMenu(id)
        }
        }
        case 
3:  {
            if (!
PlayerAwp[id]){
            
BuyAwp(id)
            }else{
            
ShopMenu(id)
        }
        }
        case 
4:  {
            if (!
PlayerPap[id]){
            
BuyPap(id)
            }else{
            
ShopMenu(id)
        }
        }
        case 
5: {
            if (!
PlayerKar[id]){
            
BuyKar(id)
            }else{
            
ShopMenu(id)
        }
        }
        case 
6: {
            if (!
PlayerSlot[id]){
            
BuySlot(id)
            }else{
            
ShopMenu(id)
        }
        }
    }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED


Help please, someone ?

EDIT: here is message after crash in my server console:


Quote:

./hlds_run: line 321: 18326 Segmentation fault $HL_CMD
what it means ?

HLM 05-09-2010 16:55

Re: Server crash on command
 
any errors? what does it say in the logs when it crashes? check amxmodx error log and see what its saying.

reinert 05-10-2010 07:11

Re: Server crash on command
 
nothing in there.

reinert 05-11-2010 08:56

Re: Server crash on command
 
help.

SaM.ThE.MaN 05-11-2010 11:48

Re: Server crash on command
 
if your server crashes there should be a log , ok if there is no log , try adding the plugin to your counter strike , not server. Check if it crashes ur Cs too

reinert 05-11-2010 12:01

Re: Server crash on command
 
how can i add it to CS ? Before I added ShopMenu and ShopMenuHandler and all shop buying methods, it worked fine for me.

I changed something:

PHP Code:

public ShopMenu(id) {
    if (
PlayerCon[id]) {
        new 
menu menu_create("0""ShopMenuHandler")
        
menu_additem(menu"1""2"0)
        
menu_additem(menu"2""3",0)
        
menu_additem(menu"3""4",0)
        
menu_additem(menu"4""5",0)
        
menu_additem(menu"5""6",0)

        
menu_setprop(menuMPROP_EXITMEXIT_ALL)
        
menu_display(idmenu0)
        }else{
        
client_print(idprint_chat,"!g[User Shop]!y Tik registruoti zaidejai gali naudotis menu.")
    }
    return 
PLUGIN_HANDLED
}

public 
ShopMenuHandler(idmenuitem) {
    if( 
item == MENU_EXIT ) {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], iName[64]
    new 
accesscallback
    
    menu_item_getinfo
(menuitemaccessdata,5iName63callback)
    
    new 
key str_to_num(data)
    
    switch(
key) {
        case 
1: {
        }
        case 
2: {
            if (!
PlayerDamage[id]){
            }else{
        }
        }
        case 
3:  {
            if (!
PlayerAwp[id]){
            }else{
        }
        }
        case 
4:  {
            if (!
PlayerPap[id]){
            }else{
        }
        }
        case 
5: {
            if (!
PlayerKar[id]){
            }else{
        }
        }
        case 
6: {
            if (!
PlayerSlot[id]){
            }else{
        }
        }
    }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED


and now server doesn't crash, so where is the problem ?

Exolent[jNr] 05-11-2010 13:04

Re: Server crash on command
 
Quote:

Originally Posted by reinert (Post 1177232)
help.

Don't bump until 2 weeks have passed since last post.

SaM.ThE.MaN 05-11-2010 15:34

Re: Server crash on command
 
whats the problem now?

reinert 05-11-2010 15:39

Re: Server crash on command
 
Problem is, that someone could lock this topic, problem is solved


All times are GMT -4. The time now is 03:42.

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