←  Pytania

AMXX.pl: Support AMX Mod X i SourceMod

»

Najlepszy gracz rundy

  • +
  • -
ExTaza?! - zdjęcie ExTaza?! 11.02.2012

Próbuję przerobić plugin i bez skutku. Ma on pokazywać najlepszego gracza rundy dla poszczegolnego teamu:
CT i TT kod poniżej , nie działa. Brak innych pomysłów wiec zakladam temat


#include <amxmodx>
#include <csx>
#include <ColorChat>
new RoundDmg[32]
public plugin_init() {
	    register_plugin("Best Player (Round)", "1.0", "MarWit")
	    register_logevent("Poczatek_Rundy", 2, "1=Round_Start")
	    register_logevent("Koniec_Rundy_TT", 2, "1=Round_End");
	    register_logevent("Koniec_Rundy_CT", 2, "1=Round_End");
	    register_event("Damage", "Damage", "b", "2!=0")
}
public Poczatek_Rundy()
{
	    new num, players[32]
	    get_players(players, num, "ch")
	    for(new i=0; i<num; i++)
	    {
			    RoundDmg[i] = 0
	    }
}
public Damage(id)
{
	    new kid = get_user_attacker(id)
	    RoundDmg[kid] += read_data(2)
}
public Koniec_Rundy_TT(id)
{
new stats[8], bodyhits[8], players[32], bestscore = 0, bestplayer, besths, num, i, bestdmg, bestdmgplayer

		 if(get_user_team(id) == 1)
  {
  get_players(players, num, "h")
  for(i=0; i<num; i++)
  {
   get_user_rstats(players[i], stats, bodyhits)
   if(stats[0] > bestscore)
   {
    bestscore = stats[0]
    bestplayer = players[i]
    besths = stats[2]
   }
   if(RoundDmg[i] > bestdmg)
   {
    bestdmg = RoundDmg[i]
    bestdmgplayer = players[i]
   }
  }
  new nick[33], dmg_nick[33]
  get_user_name(bestplayer, nick, 32)
  get_user_name(bestdmgplayer, dmg_nick, 32)
  ColorChat(0, TEAM_COLOR, "[ZOMBIE]^x01 Najwiecej: Obrazen: ^x04%s ^x01%d ^x03dmg! Zabic: ^x04%s ^x01%d ^x03HS!", nick, besths, bestdmgplayer, bestdmg)
}
}
public Koniec_Rundy_CT(id)
{
new stats[8], bodyhits[8], players[32], bestscore = 0, bestplayer, besths, num, i, bestdmg, bestdmgplayer
	   
		 if(get_user_team(id) == 2)
  {
  get_players(players, num, "h")
  for(i=0; i<num; i++)
  {
   get_user_rstats(players[i], stats, bodyhits)
   if(stats[0] > bestscore)
   {
    bestscore = stats[0]
    bestplayer = players[i]
    besths = stats[2]
   }
   if(RoundDmg[i] > bestdmg)
   {
    bestdmg = RoundDmg[i]
    bestdmgplayer = players[i]
   }
  }
  new nick[33], dmg_nick[33]
  get_user_name(bestplayer, nick, 32)
  get_user_name(bestdmgplayer, dmg_nick, 32)
  ColorChat(0, TEAM_COLOR, "[HUMAN]^x01 Najwiecej: Obrazen: ^x04%s ^x01%d ^x03dmg! Zabic: ^x04%s ^x01%d ^x03HS!", nick, besths, bestdmgplayer, bestdmg)
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1036\\ f0\\ fs16 \n\\ par }
*/

Prosiłbym o szybką odpowiedź :)
Odpowiedz

  • +
  • -
ExTaza?! - zdjęcie ExTaza?! 18.02.2012

@refresh
Odpowiedz

  • +
  • -
TomekPL - zdjęcie TomekPL 23.02.2012

moze powiedz co nie dziala ?:)
nie pokazuja sie wiadomosci czy co ?
Odpowiedz

  • +
  • -
ExTaza?! - zdjęcie ExTaza?! 23.02.2012

NIe , serwer nie dziala....A tak na prawde to nie pokazuje. Nie wywoluje. Po drugie gdy zobaczylem na drugi dzien ten kod to odechcialo mi sie na nowo go pisac ;P Bo byl pisany okolo 3 w nocy na pol przytomny
Odpowiedz

  • +
  • -
TomekPL - zdjęcie TomekPL 23.02.2012

moze logi jakies ? :) amxmodx>logs (error)
Odpowiedz

  • +
  • -
ExTaza?! - zdjęcie ExTaza?! 28.02.2012

Nie ma logow .. Jakby byly dalbym od razu.
Odpowiedz

Nenczoks - zdjęcie Nenczoks 28.02.2012

            register_logevent("Koniec_Rundy_TT", 2, "1=Round_End");
            register_logevent("Koniec_Rundy_CT", 2, "1=Round_End");


Nie mogą być takie same dwa eventy, użyj to w jednym.
Odpowiedz

  • +
  • -
Misiaczek ;c - zdjęcie Misiaczek ;c 28.02.2012

			register_logevent("Koniec_Rundy_TT", 2, "1=Round_End");
			register_logevent("Koniec_Rundy_CT", 2, "1=Round_End");


Nie mogą być takie same dwa eventy, użyj to w jednym.


co ty gadasz? O.o

w zombie sa calkiem ine eventy konca rund, wiec mozliwe ze dlatego to nie działa
Odpowiedz

Nenczoks - zdjęcie Nenczoks 28.02.2012

Tzn. może źle to napisałem.
Lepiej jest użyć to w 1, bo jeżeli rozbijemy na dwie to błędy mogą się pojawić i niepoprawności.

I jeszcze coś. Jeżeli mówisz o plague to być może, ale biohazard na pewno nie ma innych :-)
Użytkownik Nenczoks edytował ten post 28.02.2012 17:25
Odpowiedz

  • +
  • -
Nakupenda. - zdjęcie Nakupenda. 28.02.2012

miałeś sporo błędów merytorycznych, na przykład złe argumenty w colorchacie (ostatnie linijki w kodzie)

powinno działać:

#include <amxmodx>
#include <csx>
#include <ColorChat>
new RoundDmg[32]
public plugin_init() {
register_plugin("Best Player (Round)", "1.0", "MarWit")
register_logevent("Poczatek_Rundy", 2, "1=Round_Start")
register_logevent("Koniec_Rundy", 2, "1=Round_End");
register_event("Damage", "Damage", "b", "2!=0")
}
public Poczatek_Rundy()
{
new num, players[32]
get_players(players, num, "ch")
for(new i=0; i<num; i++)
{
RoundDmg[i] = 0
}
}
public Damage(id)
{
new kid = get_user_attacker(id)
RoundDmg[kid] += read_data(2)
}
public Koniec_Rundy(id)
{
new stats[8], bodyhits[8], bestscore[2], players[32], bestplayer[2], besths[2], num, i, bestdmg[2], bestdmgplayer[2]

get_players(players, num, "h")

for( new i=0; i<num; i++)
{
new id2=players[i]
get_user_rstats(id2, stats, bodyhits)
if(get_user_team(id2) == 1)
{
if(stats[0] > bestscore[0])
{
bestscore[0] = stats[0]
bestplayer[0] = players[id2]
besths[0] = stats[2]
}
if(RoundDmg[id2] > bestdmg[0])
{
bestdmg[0] = RoundDmg[id2]
bestdmgplayer[0] = players[id2]
}
}
else if(get_user_team(id2) == 2)
{
if(stats[0] > bestscore[1])
{
bestscore[1] = stats[0]
bestplayer[1] = players[id2]
besths[1] = stats[2]
}
if(RoundDmg[id2] > bestdmg[1])
{
bestdmg[1] = RoundDmg[id2]
bestdmgplayer[1] = players[id2]
}
}
}
new nick[33], dmg_nick[33], nick2[33], dmg_nick2[33]
get_user_name(bestplayer[0], nick, 32)
get_user_name(bestdmgplayer[0], dmg_nick, 32)
get_user_name(bestplayer[1], nick2, 32)
get_user_name(bestdmgplayer[1], dmg_nick2, 32)

if(get_user_team(id) == 1)
ColorChat(0, TEAM_COLOR, "[ZOMBIE]^x01 Najwiecej w^x03 TT^x01: Obrazen: ^x04%s ^x01%d ^x03dmg! Zabic: ^x04%s ^x01%d ^x03HS!", nick, besths[0], dmg_nick, bestdmg[0])
else if(get_user_team(id) == 2)
ColorChat(0, TEAM_COLOR, "[ZOMBIE]^x01 Najwiecej w^x03 CT^x01: Obrazen: ^x04%s ^x01%d ^x03dmg! Zabic: ^x04%s ^x01%d ^x03HS!", nick2, besths[1], dmg_nick2, bestdmg[1])
}


@edit: jbc poprawiłem troche ;)
Użytkownik Nakupenda. edytował ten post 28.02.2012 19:02
Odpowiedz