Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2012-05-31, 12:40


Bartek23071993

WiceWersa






Wiek: 29
Na forum: 5223 dni
Posty: 250
Nick w MP: WiceWersa

Piwa: 2429

Respekt: 70

Ostrzeżeń: 20%
Mam taki kod:

Kod:

new KillStreak[MAX_PLAYERS];


Kod:

public OnPlayerConnect(playerid)
{
KillStreak[playerid] = 0;
return 1;
}


Kod:

public OnPlayerDisconnect(playerid, reason)
{
KillStreak[playerid] = 0;
return 1;
}


Kod:

public OnPlayerDeath(playerid, killerid, reason)
{
if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
{
KillStreak[killerid]++;
GivePlayerMoney(killerid, 1000);
}

KillStreak[playerid] = 0;


new str[256], PlayerName[MAX_PLAYER_NAME];
GetPlayerName(killerid, PlayerName, sizeof(PlayerName));

switch( KillStreak[ killerid ] )
{
case 1: //You wouldn't really count 1 kill as a streak but it gives you an idea
{
format(str, sizeof(str), "~r~ %s is on a kill!", PlayerName);
GameTextForAll(str,4000,4);
}
case 2:
{
format(str, sizeof(str), "~r~ %s is on a ~b~double kill!", PlayerName);
GameTextForAll(str,4000,4);
}
case 3:
{
format(str, sizeof(str), "~y~%s is on a ~r~killing spree!", PlayerName);
GameTextForAll(str,4000,4);
}
case 4:
{
format(str, sizeof(str), "~g~%s is on a ~b~mmmmmonster kill!", PlayerName);
GameTextForAll(str,4000,4);
}
case 5:
{
format(str, sizeof(str), "~r~%s is ~p~dominating!", PlayerName);
GameTextForAll(str,4000,4);
}
case 6:
{
format(str, sizeof(str), "~p~%s is ~y~unstopable!", PlayerName);
GameTextForAll(str,4000,4);
}
case 7: //You can do this as many times as you like
{
format(str,sizeof(str),"%s is annihilating!",PlayerName);
GameTextForAll(str,4000,4);
}
case 10:
{
format(str,sizeof(str),"%s is GodLike!",PlayerName);
GameTextForAll(str,4000,4);
}
}

return 1;
}


I teraz tak, serie zab?jstw gracza pokazuje w TextDrawie w taki spos?b:

Kod:

format(String, sizeof(String), "~b~~h~KillStreak ~n~~w~%d", KillStreak[killerid]);
TextDrawSetString(KillStreak[PlayerId], String);


Problem w tym ?e jak zabije gracza to nie nalicza mi punkt?w tylko jemu. Co dziwne czasem dzia?a prawid?owo i nalicza normalnie. Mo?e buguje si? z ca?? reszt? w public OnPlayerDeath ??
Je?eli wie kto? w czym b??d, prosz? o pomoc (( postawie piwko ))

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-06-01, 07:09


Quis

Wszechwiedzący






Wiek: 31
Na forum: 5146 dni
Posty: 464
Nick w MP: Quis

Piwa: 1110

Respekt: 325
Respekt: 325Respekt: 325Respekt: 325

Gdzie masz ten kod?
Kod:

format(String, sizeof(String), "~b~~h~KillStreak ~n~~w~%d", KillStreak[killerid]);
TextDrawSetString(KillStreak[PlayerId], String);

W OnPlayerDeath go nie widz?, a tylko tutaj masz zmienn? "killerid".

No i zauwa?y?em ?e w tej linijce:
Kod:

TextDrawSetString(KillStreak[PlayerId], String);

Masz "PlayerId", zamiast "killerid" jak w linijce wy?ej.

Pozdrawiam ;)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-06-01, 08:53


Bartek23071993

WiceWersa






Wiek: 29
Na forum: 5223 dni
Posty: 250
Nick w MP: WiceWersa

Piwa: 2429

Respekt: 70

Ostrzeżeń: 20%
Dlatego ?e KillStreak[PlayerId] to jest nazwa TextDrawu kt?ry mam w p?tli i dlatego jest PlayerId. Ten kod jest w publicu UpdateStat gdzie mam na pasek kt?ry pokazuje statystyki gracza/serwera.

Zauwa?y?em ?e wszystko dzia?a do puki na serwerze nie pojawi si? wi?cej os?b. :/


Wi?c czekam na kolejne propozycje.

[ Dodano: 2012-06-01, 15:11 ]
Pomo?e kto? ?? ?? Chodzi mi tylko o to jak mam pokaza? ten TextDraw ?eby nalicza?o punkt temu co trzeba.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-06-01, 19:05


Quis

Wszechwiedzący






Wiek: 31
Na forum: 5146 dni
Posty: 464
Nick w MP: Quis

Piwa: 1110

Respekt: 325
Respekt: 325Respekt: 325Respekt: 325

A jak masz w tym "UpdateStat" zdefiniowan? zmienn? "killerid"? Poka? najlepiej ca?y ten public.

@EDIT
Wybacz, nie zauwa?y?em jeden rzeczy: jak to mo?liwe ?e u?ywasz jednej tablicy KillStreak do okre?lania jednocze?nie ID TextDrawu i ilo?ci zab?jstw?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-06-01, 19:54


Bartek23071993

WiceWersa






Wiek: 29
Na forum: 5223 dni
Posty: 250
Nick w MP: WiceWersa

Piwa: 2429

Respekt: 70

Ostrzeżeń: 20%
Dzi?ki za ch?? (( piwko dla ciebie )) ale ju? sobie poradzi?em ;)

JESZCZE JEDNO PYTANIE


Jak zrobi? ?eby TextDraw pokazywa? osob? z najwi?ksz? liczb? Seri Ofiar ??

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-06-01, 20:37


Combacior







Wiek: 29
Na forum: 5796 dni
Posty: 1516

Piwa: 2161

Respekt: 1060
Respekt: 1060

Ostrzeżeń: 20%
G?ra mapy

Kod:

SeriaOfiar = 0;


Gdzie? w kodzie, nie wiem gdzie chcesz ?eby to pokazywa?o

Kod:

SeriaOfiar = -1;
for(new i1 = 0, ff = MAX_PLAYERS; i < ff; i++)
{
if(SmierciGracza[i] > SeriaOfiar)
{
GetPlayerName(i, pname, 24);
}
}
format(string, sizeof(string), "Najwi?cej serii ofiar ma gracz %d",pname);


Oczywi?cie do publicu OnPlayerDeath musisz dodawa? ?mierci gracza, to samo co z zab?stwami.

Postaw piwo autorowi tego posta
 

 
Tagi: seria :: zabójstw
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » PAWN » [INNE] Seria Zabójstw Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku