Raised This Month: $ Target: $400
 0% 

Function is crashing the server


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Infra
Senior Member
Join Date: Aug 2004
Location: California
Old 10-12-2006 , 17:24   Function is crashing the server
Reply With Quote #1

This function seems to be crashing the server when I execute it. Any ideas?

Server OS and type: Windows XP - Listen

Function:
Code:
public kniferound_start() {     // HL     log_message("kniferound_start: before for")             // Server console     server_print("kniferound_start: before for")         new player     new players[32]     new players_num         // We are now in a knife round     main_inkniferound = 1         // Strip everybody's weapons     get_players(players, players_num, "a")         for(new i = 0; i < players_num; i++)     {         player = players[i]                 // Strip user's weapons         strip_user_weapons(player)                 // Give back the knife         give_item(player,"weapon_knife")     }         // HL     log_message("kniferound_start: after for")             // Server console     server_print("kniferound_start: after for")             // Restart the round     misc_restart_round("1")                 return PLUGIN_CONTINUE }

Modules.ini:
Code:
; AMX Mod X Modules
; You can specify both linux & win32 modules here
; To enable a module, remove the semi-colon from the line

; ------------------------------
; Fun - provides extra functions
; ------------------------------
fun_amxx_i386.so
fun_amxx.dll
fun_amxx_amd64.so

; ----------------------------------------------------
; Engine - provides engine functions core to Half-Life
; ----------------------------------------------------
;engine_amxx_i386.so
;engine_amxx.dll
;engine_amxx_amd64.so

; ----------------------------------------------------------
; Fakemeta - provides a massive interface into the HL engine
; ----------------------------------------------------------
;fakemeta_amxx_i386.so
;fakemeta_amxx.dll
;fakemeta_amxx_amd64.so

; -------------------------------------------
; Database Access - only enable one of these
; -------------------------------------------
; MySQL
;mysql_amxx_i386.so
;mysql_amxx.dll
;mysql_amxx_amd64.so
; PostgreSQL
;pgsql_amxx_i386.so
;pgsql_amxx.dll
; Microsoft SQL
;mssql_amxx.dll
; SQLite
;sqlite_amxx.dll
;sqlite_amxx_i386.so
;sqlite_amxx_amd64.so

; ---------------------------------------------
; GeoIP - determines the country of ip adresses
; ---------------------------------------------
;geoip_amxx_i386.so
;geoip_amxx.dll
;geoip_amxx_amd64.so

; --------------------------------
; Sockets - network socket support
; --------------------------------
sockets_amxx_i386.so
sockets_amxx.dll
sockets_amxx_amd64.so

; --------------------------
; Regular Expression support
; --------------------------
regex_amxx_i386.so
regex_amxx.dll
regex_amxx_amd64.so

; --------------------
; Binary Vault support
; --------------------
;nvault_amxx_i386.so
;nvault_amxx.dll
;nvault_amxx_amd64.so

; ----------------------------------------------------------
; Counter-Strike - adds functions specific to Counter-Strike
; ----------------------------------------------------------
cstrike_amxx_i386.so
cstrike_amxx.dll
cstrike_amxx_amd64.so

; -----------------------------------------------------
; CSX - adds functionality for CS statistics and events
; -----------------------------------------------------
csx_amxx_i386.so
csx_amxx.dll
csx_amxx_amd64.so
Plugins:
Code:
; AMX Mod X plugins

; Admin Base - Always one has to be activated
admin.amxx        ; admin base (required for any admin-related)
;admin_sql.amxx        ; admin base - SQL version (comment admin.amxx)

; Basic
admincmd.amxx        ; basic admin console commands
adminhelp.amxx        ; help command for admin console commands
adminslots.amxx        ; slot reservation
multilingual.amxx    ; Multi-Lingual management

; Menus
menufront.amxx        ; front-end for admin menus
cmdmenu.amxx        ; command menu (speech, settings)
plmenu.amxx        ; players menu (kick, ban, client cmds.)
;telemenu.amxx        ; teleport menu (Fun Module required!)
mapsmenu.amxx        ; maps menu (vote, changelevel)

; Chat / Messages
adminchat.amxx        ; console chat commands
antiflood.amxx        ; prevent clients from chat-flooding the server
scrollmsg.amxx        ; displays a scrolling message
imessage.amxx        ; displays information messages
adminvote.amxx        ; vote commands

; Map related
nextmap.amxx        ; displays next map in mapcycle
mapchooser.amxx        ; allows to vote for next map
timeleft.amxx        ; displays time left on map

; Configuration
pausecfg.amxx        ; allows to pause and unpause some plugins
statscfg.amxx        ; allows to manage stats plugins via menu and commands

; Counter-Strike
restmenu.amxx        ; restrict weapons menu
statsx.amxx        ; stats on death or round end (CSX Module required!)
;miscstats.amxx        ; bunch of events announcement for Counter-Strike
;stats_logging.amxx    ; weapons stats logging (CSX Module required!)


; Custom - Add 3rd party plugins here

amx_match_deluxe.amxx debug        ; Match plugin
amxx_podbotmenu.amxx            ; PODBot Menu
;amx_autostarter.amxx            ; Autostarter
__________________
--Infra

Last edited by Infra; 10-12-2006 at 17:28.
Infra is offline
Send a message via AIM to Infra
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 10-12-2006 , 17:57   Re: Function is crashing the server
Reply With Quote #2

you might want to delay them from getting a knife right after stripping. try that.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-12-2006 , 18:45   Re: Function is crashing the server
Reply With Quote #3

new i = 1

Might wanna change it to that - strip_user_weapons and give_item on index 0 may cause bad things to happen.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 10-12-2006 , 19:41   Re: Function is crashing the server
Reply With Quote #4

Quote:
Originally Posted by Hawk552 View Post
new i = 1

Might wanna change it to that - strip_user_weapons and give_item on index 0 may cause bad things to happen.
hes using get_players so its fine
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Infra
Senior Member
Join Date: Aug 2004
Location: California
Old 10-12-2006 , 19:42   Re: Function is crashing the server
Reply With Quote #5

I was about to say...

How long do you think I should wait? .1? .5?
__________________
--Infra
Infra is offline
Send a message via AIM to Infra
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-12-2006 , 19:47   Re: Function is crashing the server
Reply With Quote #6

Quote:
Originally Posted by Emp` View Post
hes using get_players so its fine
Ah I missed that somehow, nevermind.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 10-12-2006 , 19:48   Re: Function is crashing the server
Reply With Quote #7

i would try .1, if still not, try .5

also, which messages are being logged?
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Infra
Senior Member
Join Date: Aug 2004
Location: California
Old 10-13-2006 , 03:04   Re: Function is crashing the server
Reply With Quote #8

It is only logging the messages before the for loop, not after... I'm going to add a log message inside the look just to see where it crashes...I'm assuming it's because of what you said...not enough time between the two...
__________________
--Infra
Infra is offline
Send a message via AIM to Infra
Infra
Senior Member
Join Date: Aug 2004
Location: California
Old 10-13-2006 , 03:59   Re: Function is crashing the server
Reply With Quote #9

It seems the problem is in strip_user_weapons:

Log:

Code:
L 10/13/2006 - 01:01:24: Server cvar "sv_password" = "***PROTECTED***"
L 10/13/2006 - 01:01:24: "[CI]Infra<5><><>" started a match "mr10 cal.cfg "
L 10/13/2006 - 01:01:24: kniferound_start: before for
L 10/13/2006 - 01:01:24: kniferound_start: inside for #1, playerid = 2
L 10/13/2006 - 01:01:24: FATAL ERROR (shutting down): ED_Alloc: no free edicts
Code:
public kniferound_start() {     // HL     log_message("kniferound_start: before for")             // Server console     server_print("kniferound_start: before for")         new player     new players[32]     new players_num         new param[8]         // We are now in a knife round     main_inkniferound = 1         // Strip everybody's weapons     get_players(players, players_num, "a")             for(new i = 0; i < players_num; i++)     {         player = players[i]                 // HL         log_message("kniferound_start: inside for #1, playid = %d", player)                     // Server console         server_print("kniferound_start: inside for #1, playid = %d", player)                 // Strip user's weapons         strip_user_weapons(player)                 // HL         log_message("kniferound_start: inside for #2")                     // Server console         server_print("kniferound_start: inside for #2")                 // Give back the knife         param[0] = player         set_task(0.5, "kniferound_giveknife", 0, param, 8)                 // HL         log_message("kniferound_start: inside for #3")                     // Server console         server_print("kniferound_start: inside for #3")     }         // HL     log_message("kniferound_start: after for")             // Server console     server_print("kniferound_start: after for")             // Restart the round     misc_restart_round("1")                 return PLUGIN_CONTINUE } public kniferound_giveknife ( param[] ) {     // Give user a knife     give_item(param[0],"weapon_knife")         return PLUGIN_CONTINUE }

Just a note, this function isn't getting called in a ResetHud event...

Hmm...anyway....any ideas?
__________________
--Infra
Infra is offline
Send a message via AIM to Infra
Infra
Senior Member
Join Date: Aug 2004
Location: California
Old 10-13-2006 , 04:13   Re: Function is crashing the server
Reply With Quote #10

Just tried it with setting a task on the strip weapons and it gets all the way through the for loop, but then crashes after the restart round line:

Code:
L 10/13/2006 - 01:14:25: "CAL CS Match In Progress<0><><>" started a match "mr10 cal.cfg "
L 10/13/2006 - 01:14:25: kniferound_start: before for
L 10/13/2006 - 01:14:25: kniferound_start: inside for #1, playerid = 2
L 10/13/2006 - 01:14:25: kniferound_start: inside for #2
L 10/13/2006 - 01:14:25: kniferound_start: inside for #3
L 10/13/2006 - 01:14:25: kniferound_start: inside for #1, playerid = 3
L 10/13/2006 - 01:14:25: kniferound_start: inside for #2
L 10/13/2006 - 01:14:25: kniferound_start: inside for #3
L 10/13/2006 - 01:14:25: kniferound_start: inside for #1, playerid = 4
L 10/13/2006 - 01:14:25: kniferound_start: inside for #2
L 10/13/2006 - 01:14:25: kniferound_start: inside for #3
L 10/13/2006 - 01:14:25: kniferound_start: inside for #1, playerid = 5
L 10/13/2006 - 01:14:25: kniferound_start: inside for #2
L 10/13/2006 - 01:14:25: kniferound_start: inside for #3
L 10/13/2006 - 01:14:25: kniferound_start: inside for #1, playerid = 6
L 10/13/2006 - 01:14:25: kniferound_start: inside for #2
L 10/13/2006 - 01:14:25: kniferound_start: inside for #3
L 10/13/2006 - 01:14:25: kniferound_start: inside for #1, playerid = 7
L 10/13/2006 - 01:14:25: kniferound_start: inside for #2
L 10/13/2006 - 01:14:25: kniferound_start: inside for #3
L 10/13/2006 - 01:14:25: kniferound_start: inside for #1, playerid = 8
L 10/13/2006 - 01:14:25: kniferound_start: inside for #2
L 10/13/2006 - 01:14:25: kniferound_start: inside for #3
L 10/13/2006 - 01:14:25: kniferound_start: inside for #1, playerid = 9
L 10/13/2006 - 01:14:25: kniferound_start: inside for #2
L 10/13/2006 - 01:14:25: kniferound_start: inside for #3
L 10/13/2006 - 01:14:25: kniferound_start: inside for #1, playerid = 10
L 10/13/2006 - 01:14:25: kniferound_start: inside for #2
L 10/13/2006 - 01:14:25: kniferound_start: inside for #3
L 10/13/2006 - 01:14:25: kniferound_start: after for
L 10/13/2006 - 01:14:25: Server cvar "sv_restart" = "1"
L 10/13/2006 - 01:14:25: FATAL ERROR (shutting down): ED_Alloc: no free edicts
Code:
...         // Strip user's weapons         set_task(0.1, "kniferound_stripweapons", 0, param, 8) ... public kniferound_stripweapons ( param[] ) {     // Take user's weapons     strip_user_weapons(param[0])         return PLUGIN_CONTINUE }
__________________
--Infra
Infra is offline
Send a message via AIM to Infra
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 04:50.


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