BANNED
Join Date: Jul 2009
Location: Los Teques
|
04-29-2010
, 19:12
Re: problem code, crash...
|
#27
|
I have added the way debug the two plugins..
And this is what has happened:
Code:
L 04/29/2010 - 12:07:50: Start of error session.
L 04/29/2010 - 12:07:50: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20100429.log")
L 04/29/2010 - 12:07:50: Invalid menu id 0(5)
L 04/29/2010 - 12:07:50: [AMXX] Displaying debug trace (plugin "yap_menu.amxx")
L 04/29/2010 - 12:07:50: [AMXX] Run time error 10: native error (native "menu_destroy")
L 04/29/2010 - 12:07:50: [AMXX] [0] yap_menu.sma::votemap_count (line 252)
L 04/29/2010 - 12:07:50: [AMXX] [1] yap_menu.sma::UpdateHUD (line 214)
L 04/29/2010 - 12:51:58: Start of error session.
L 04/29/2010 - 12:51:58: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20100429.log")
L 04/29/2010 - 12:51:58: Invalid menu id 0(5)
L 04/29/2010 - 12:51:58: [AMXX] Displaying debug trace (plugin "yap_menu.amxx")
L 04/29/2010 - 12:51:58: [AMXX] Run time error 10: native error (native "menu_destroy")
L 04/29/2010 - 12:51:58: [AMXX] [0] yap_menu.sma::votemap_count (line 252)
L 04/29/2010 - 12:51:58: [AMXX] [1] yap_menu.sma::UpdateHUD (line 214)
L 04/29/2010 - 12:53:44: Start of error session.
L 04/29/2010 - 12:53:44: Info (map "de_inferno") (file "addons/amxmodx/logs/error_20100429.log")
L 04/29/2010 - 12:53:44: [FUN] Invalid player 11
L 04/29/2010 - 12:53:44: [AMXX] Displaying debug trace (plugin "deathmatch.amxx")
L 04/29/2010 - 12:53:44: [AMXX] Run time error 10: native error (native "set_user_godmode")
L 04/29/2010 - 12:53:44: [AMXX] [0] deathmatch.sma::stopprotect (line 129)
This is the code deathmatch:
PHP Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun>
public plugin_init() { register_plugin("DeathMatch","1.0","flamin") register_event("DeathMsg","death","a") register_cvar("dm_enabled","0") register_cvar("dm_protection","1") register_cvar("dm_protection_time","3") register_cvar("dm_killbonus","1") register_cvar("dm_killbonus_amount","500") }
public death() { if (get_cvar_num("dm_enabled")==1) { new dead = read_data(2) set_task(0.1,"live",dead) new murderer = read_data(1) if (get_cvar_num("dm_killbonus")==1 && murderer!=dead) { new money = cs_get_user_money(murderer) new money2 = money + get_cvar_num("dm_killbonus_amount") cs_set_user_money(murderer,money2,1) if (money2 >= 300) { money2 = money2 - 300 cs_set_user_money(murderer,money2,0) } else { cs_set_user_money(murderer,0,0) } } } }
public live(dead) { spawn(dead) if (get_cvar_num("dm_protection")==1) { set_user_godmode(dead,1) new Float:protect = get_cvar_float("dm_protection_time") set_task(protect,"stopprotect",dead) } if (get_user_team(dead)==1) { give_item(dead,"weapon_knife") give_item(dead,"weapon_glock18") give_item(dead,"ammo_9mm") give_item(dead,"ammo_9mm") } else { give_item(dead,"weapon_knife") give_item(dead,"weapon_usp") give_item(dead,"ammo_45acp") give_item(dead,"ammo_45acp") } }
public stopprotect(dead) { set_user_godmode(dead) }
And this code yap_menu:
PHP Code:
public try_load_votemap_menu() { // Rukia: Get our maps.ini static filename[64] get_configsdir( filename, 63 ) format( filename, 63, "%s/maps.ini", filename )
// Rukia: Otherwise, just use mapcycle if(file_exists(filename)) { load_votemap_menu(filename) if(pug_votemap_count != 0) return; }
copy(filename,63,"mapcycle.txt") load_votemap_menu(filename) }
public load_votemap_menu(filename[]) { new szText[ 256 ] , iFile; iFile = fopen( filename , "rb" ); pug_votemap_count = 0; while( ( pug_votemap_count < VoteMaps ) && !feof( iFile ) && fgets( iFile , szText , charsmax( szText ) ) ) { trim( szText ); if( ( ( szText[ 0 ] == '^0' ) || ( szText[ 0 ] == '/' ) || ( szText[ 0 ] == ';' ) ) || !is_map_valid( szText ) ) continue;
copy( pug_votemap_name[ pug_votemap_count ] , charsmax( pug_votemap_name[] ) , szText );
g_iMapVotes[ pug_votemap_count ][ MapIndex ] = pug_votemap_count++;
menu_additem( pug_votemap_menu , szText ) } fclose( iFile ); }
public cmd_votemap(id,level,cid) { if (!cmd_access(id, level, cid, 1) ) return PLUGIN_HANDLED; votemap_start() return PLUGIN_HANDLED; }
public votemap_start() { if(pug_voting) { set_task(get_pcvar_float(pug_cvar_vote_time),"votemap_start",100 + pug_votemap_menu); return; }
pug_voting = 1; arrayset(pug_voted,0,33)
arrayset(pug_votemap_votes,0,pug_votemap_count) pug_display_menu_all(pug_votemap_menu)
client_print(0,print_chat,"",pug_header, LANG_PLAYER, "PUG_VOTE_START", "PUG map"); console_print(0,"%s %L",pug_header, LANG_PLAYER, "PUG_VOTE_START", "PUG map"); set_task(get_pcvar_float(pug_cvar_vote_time),"votemap_end",100 + pug_votemap_menu)
UpdateHUD(); set_task( 1.0 , "UpdateHUD" , TaskMapHUD , _ , _ , "a" , VoteTime + 1 ); }
public votemap_end() { pug_cancel_menu()
pug_voting = 0; remove_task ( 100 + pug_votemap_menu )
if(votemap_count()) voteteam_start(); }
public votemap_handle( id , menu , item ) { if ( item < 0 ) return PLUGIN_CONTINUE; static szName[ 33 ]; get_user_name( id , szName , charsmax( szName ) ); g_iMapVotes[ item ][ MapVotes ]++; g_iVoteCount++; client_print( 0 , print_chat , "" , szName , pug_votemap_name[ item ] );
pug_voted[id] = 1; if(pug_should_stopvote() ) votemap_end() return PLUGIN_HANDLED; }
public UpdateHUD() { static iDisplayCount = -1; if ( ++iDisplayCount == VoteTime ) { votemap_count(); } else { static szHUD[ VoteMaps * 40 ] , iPos , iPos2; static g_iMapVotesTemp[ VoteMaps ][ MapInfo ]; iPos = copy( szHUD , charsmax( szHUD ) , "Map votes:" ); szHUD[ iPos++ ] = EOS; iPos2 = iPos; if ( g_iVoteCount ) { g_iMapVotesTemp = g_iMapVotes; SortCustom2D( g_iMapVotesTemp , VoteMaps , "SortMaps" ); for ( new i = 0 ; i < pug_votemap_count ; i++ ) if ( g_iMapVotesTemp[ i ][ MapVotes ] ) iPos += formatex( szHUD[ iPos ] , charsmax( szHUD ) - iPos , "%s - %d vote%s^n" , pug_votemap_name[ g_iMapVotesTemp[ i ][ MapIndex ] ] , g_iMapVotesTemp[ i ][ MapVotes ] , ( g_iMapVotesTemp[ i ][ MapVotes ] != 1 ) ? "s" : "" ); } else { iPos += copy( szHUD[ iPos ] , charsmax( szHUD ) - iPos , "<no votes>^n" ); } set_hudmessage( 0 , 255 , 0 ,0.76 , 0.10 , 0 , 6.0 , 1.1 ); ShowSyncHudMsg( 0 , g_iSyncHUDObj[ 0 ] , szHUD ); set_hudmessage( 255 , 255 , 255 , 0.76 , 0.13 , 0 , 6.0 , 1.1 ); ShowSyncHudMsg( 0 , g_iSyncHUDObj[ 1 ] , szHUD[ iPos2 ] ); } }
public votemap_count() { new iMostVotes , iWinner = -1;
menu_destroy ( pug_votemap_menu );
message_begin( MSG_ALL , SVC_INTERMISSION ) message_end() for ( new i = 0 ; i < pug_votemap_count ; i++ ) { if ( g_iMapVotes[ i ][ MapVotes ] > iMostVotes ) { iMostVotes = g_iMapVotes[ i ][ MapVotes ]; iWinner = i; } } if ( iWinner == -1 ) { iWinner = random( pug_votemap_count ); client_print( 0 , print_chat , "[ESVE Pug] %s has been choosen randomly." , pug_votemap_name[ iWinner ] ); } else { client_print( 0 , print_chat , "[ESVE Pug] Cambiando map a %s..." , pug_votemap_name[ iWinner ] , iMostVotes , ( iMostVotes != 1 ) ? "s" : "" ); }
pug_voting = 0; votemap_noswitch = 1; set_pcvar_num(pug_cvar_votemap_e,0)
set_task(3.0,"pug_votemap_change",iWinner) return PLUGIN_CONTINUE }
public pug_votemap_change(iWinner) { server_cmd("changelevel %s",pug_votemap_name[iWinner]); }
How could solve the problems?
|
|