AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] NewRound stopped working O_O (https://forums.alliedmods.net/showthread.php?t=54583)

MadMaurice 04-29-2007 12:44

[SOLVED] NewRound stopped working O_O
 
1 Attachment(s)
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

Aviram1994 04-29-2007 14:14

Re: NewRound stopped working O_O
 
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"); 


MadMaurice 04-29-2007 14:24

Re: NewRound stopped working O_O
 
i forgot to say i tried with the flag a and b and the "endround" is my function that is called :wink:

Aviram1994 04-30-2007 07:44

Re: NewRound stopped working O_O
 
Hmm something is wrong with ur server?
hmm and cant u use maybe register_logevent?

mateo10 04-30-2007 08:04

Re: NewRound stopped working O_O
 
HLTV event is for Counter-strike only.

MadMaurice 05-01-2007 13:13

Re: NewRound stopped working O_O
 
sry forgot to say that its a cstrike server :wink: so it should work

@aviram: maybe because its a listenserver?

Aviram1994 05-01-2007 15:24

Re: NewRound stopped working O_O
 
register_event("SendAudio", "eEndRound", "a", "2&%!MRAD_terwin", "2&%!MRAD_ctwin", "2&%!MRAD_rounddraw")
I saw this on miscstats.sma :O

MadMaurice 05-02-2007 10:04

Re: NewRound stopped working O_O
 
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?:|

VEN 05-02-2007 11:57

Re: NewRound stopped working O_O
 
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.

Arkshine 05-02-2007 12:13

Re: NewRound stopped working O_O
 
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(); }


All times are GMT -4. The time now is 06:37.

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