Raised This Month: $ Target: $400
 0% 

[SOLVED] NewRound stopped working O_O


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MadMaurice
Junior Member
Join Date: Apr 2007
Old 04-29-2007 , 12:44   [SOLVED] NewRound stopped working O_O
Reply With Quote #1

i 'm making a "show the player with the most kills at the end of the round, then reset the counter an restart counting"-plugin

first it worked fine. then i thought why not show the result with a hudmessage. this didn't work (i read AMXX has some problems with hudmsgs). so i took the client_print function again. now (i found out after some tests) the endround event isn't fired

my code is attached.

Does any one know why the endround event doesn't work?

if its the wrong forum plz move
Attached Files
File Type: sma Get Plugin or Get Source (most_kills.sma - 827 views - 2.0 KB)

Last edited by MadMaurice; 05-03-2007 at 10:08.
MadMaurice is offline
Aviram1994
Member
Join Date: Jan 2007
Old 04-29-2007 , 14:14   Re: NewRound stopped working O_O
Reply With Quote #2

Hmmm in all Tutorials I saw the new round event is
PHP Code:
register_event("HLTV""event_new_round""a""1=0""2=0"
and not
PHP Code:
register_event("HLTV","endround","b","1=0","2=0"); 
Aviram1994 is offline
MadMaurice
Junior Member
Join Date: Apr 2007
Old 04-29-2007 , 14:24   Re: NewRound stopped working O_O
Reply With Quote #3

i forgot to say i tried with the flag a and b and the "endround" is my function that is called
MadMaurice is offline
Aviram1994
Member
Join Date: Jan 2007
Old 04-30-2007 , 07:44   Re: NewRound stopped working O_O
Reply With Quote #4

Hmm something is wrong with ur server?
hmm and cant u use maybe register_logevent?
Aviram1994 is offline
mateo10
Veteran Member
Join Date: Jan 2006
Old 04-30-2007 , 08:04   Re: NewRound stopped working O_O
Reply With Quote #5

HLTV event is for Counter-strike only.
mateo10 is offline
MadMaurice
Junior Member
Join Date: Apr 2007
Old 05-01-2007 , 13:13   Re: NewRound stopped working O_O
Reply With Quote #6

sry forgot to say that its a cstrike server so it should work

@aviram: maybe because its a listenserver?
MadMaurice is offline
Aviram1994
Member
Join Date: Jan 2007
Old 05-01-2007 , 15:24   Re: NewRound stopped working O_O
Reply With Quote #7

register_event("SendAudio", "eEndRound", "a", "2&%!MRAD_terwin", "2&%!MRAD_ctwin", "2&%!MRAD_rounddraw")
I saw this on miscstats.sma :O
Aviram1994 is offline
MadMaurice
Junior Member
Join Date: Apr 2007
Old 05-02-2007 , 10:04   Re: NewRound stopped working O_O
Reply With Quote #8

i thought i told what i want the wrong way. i want the data to display at the START of a round! thats why i used HLTV as event. Can now ANYONE tell me WHY this DOESN'T work? hm?
MadMaurice is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 05-02-2007 , 11:57   Re: NewRound stopped working O_O
Reply With Quote #9

I'm sure that if you would refer to your amxx logs or server console you will see that you have a runtime error: index out of bounds. That is caused on line #26 and #51 of your code. This runtime error aborts endround() function call at the beginning so this makes you think that "NewRound stopped working".

Change:
Quote:
new player_kills[32];
->
Quote:
new player_kills[33];
33 because first array element index == 0 but first client index == 1 so you need to shift it by single array element, i.e. 32 + 1.

Last edited by VEN; 05-02-2007 at 12:05.
VEN is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-02-2007 , 12:13   Re: NewRound stopped working O_O
Reply With Quote #10

Try this, should work.

Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN  "Most Kills" #define VERSION "1.0" #define AUTHOR  "MadMaurice" #define MAX_PLAYERS 32 new player_kills[MAX_PLAYERS + 1]; new most_kills; public plugin_init() {     register_plugin( PLUGIN, VERSION, AUTHOR );         register_event( "DeathMsg", "count_kill", "a" );     register_event( "HLTV", "eNewRound", "a", "1=0", "2=0" );         most_kills = register_cvar( "sv_most_kills", "1" ); } public resetcounter() {     arrayset( player_kills, 0, MAX_PLAYERS + 1 ) } public count_kill() {     if( !get_pcvar_num( most_kills ) )         return;             new iKiller = read_data( 1 );     new iVictim = read_data( 2 );         if( iKiller == iVictim )     {         client_print( iKiller, print_chat, "[Most Kills] Team Kills are not counted!" );     }     else     {         player_kills[iKiller]++;         client_print( iKiller, print_chat, "[Most Kills] You have %d kills yet!", player_kills[iKiller] );     } } public get_most_kills_id() {     new mkid, lkills = 0, i;         for( i = 0; i < MAX_PLAYERS + 1; i++ )     {         if( player_kills[i] > lkills )         {             mkid = i;             lkills = player_kills[i];         }     }     return mkid; } public client_disconnect( id ) {     player_kills[id] = 0; } public eNewRound() {     if( !get_pcvar_num( most_kills ) )         return;             new mkid = get_most_kills_id();         static name[32];     get_user_name( mkid, name, 31 );         if( mkid > 0 )     {         client_print( 0, print_chat,"[Most Kills] Kill King is %s with %d kills! Congratulations!", name, player_kills[mkid] );         static iPlayers[32], iNum, pid;         get_players( iPlayers, iNum, "c" );                 for( new i = 0; i < iNum; i++ )         {             pid = iPlayers[i];             client_print( pid, print_chat, "[Most Kills] You had %d kills!", player_kills[i] );         }     }     else         client_print( 0, print_chat,"[Most Kills] No kills this round!" );         resetcounter(); }
__________________

Last edited by Arkshine; 05-02-2007 at 12:18.
Arkshine is offline
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 06:37.


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