Wysłany: 2012-02-05, 14:05
DUDEKRPK
Wiek: 37 Na forum: 5242 dni Posty: 10
Nick w MP: fdasf
Witam mam problem z licznikiem frag?w.
M?cz? si? ju? od paru dni i nie widz? ?adnego b??du...
Kod:
public OnPlayerDeath(playerid, killerid, reason)
{
if(SetPlayerTeam(TEAM_1(killerid))//tutaj zmie? na swoje teamy (da?em TEAM_1 bo tak mam na g?rze)...
{
frag1[killerid]++;
SetPlayerScore(killerid, frag1[killerid]);
}
if(SetPlayerTeam(killerid)==TEAM_2)//tutaj zmie? na swoje teamy (da?em TEAM_1 bo tak mam na g?rze)...
{
frag2[killerid]++;
SetPlayerScore(killerid, frag2[killerid]);
}
return 1;
}
B??d jest w OnPlayerDeath, wcale nie liczy ca?y czas jest 0:0
Ostatnio zmieniony przez MG303 2012-02-05, 15:53, w całości zmieniany 1 raz
Wysłany: 2012-02-05, 15:51
MG303
Wiek: 30 Na forum: 6418 dni Posty: 654
Piwa : 2990
Kod: public OnPlayerDeath(playerid, killerid, reason)
{
if(GetPlayerTeam(killerid) == TEAM_1){
frag1[killerid]++;
SetPlayerScore(killerid, frag1[killerid]);
}else if(GetPlayerTeam(killerid) == TEAM_2){
frag2[killerid]++;
SetPlayerScore(killerid, frag2[killerid]);
}
return 1;
}
zr?b tak
Wysłany: 2012-02-05, 18:10
DUDEKRPK
Wiek: 37 Na forum: 5242 dni Posty: 10
Nick w MP: fdasf
i nic, mam to w td:
Kod: forward TextDrawLicznikUpdate();
public TextDrawLicznikUpdate()
{
new xstreingx[256];
for(new g=0; g<MAX_PLAYERS; g++){
if(IsPlayerConnected(g)){
format(xstreingx, 256, "Team1 ~w~%d ~r~: ~w~%d ~b~Team2", frag1,frag2);
TextDrawSetString(LicznikDraw[g], xstreingx);
}
}
return 1;
}
juz sam nie wiem gdzie jest b??d,
a b??d jest w tym ?e licznik dzia?a tylko wtedy gdy gracz id 0 zabije ....
a jak zabije np. id 2 innego gracza to nie doda, nie rozumiem tego... HELP
Wysłany: 2012-02-05, 18:59
MG303
Wiek: 30 Na forum: 6418 dni Posty: 654
Piwa : 2990
jak masz new frag1[MAX_PLAYERS]; to zamie? to na new frag1;
i potem zr?b tak:
Kod: public OnPlayerDeath(playerid, killerid, reason)
{
if(GetPlayerTeam(killerid) == TEAM_1){
frag1++;
}else if(GetPlayerTeam(killerid) == TEAM_2){
frag2++;
}
return 1;
}
Kod: forward TextDrawLicznikUpdate();
public TextDrawLicznikUpdate()
{
new xstreingx[20];
for(new g=0; g<GetMaxPlayers(); g++){
if(IsPlayerConnected(g)){
format(xstreingx, 20, "Team1 ~w~%d ~r~: ~w~%d ~b~Team2", frag1,frag2);
TextDrawSetString(LicznikDraw, xstreingx);
}
}
return 1;
}
i jak masz LicznikDraw[g] to usu? wsz?dzie to [g]
Wysłany: 2012-02-07, 11:19
DUDEKRPK
Wiek: 37 Na forum: 5242 dni Posty: 10
Nick w MP: fdasf
Wysłany: 2012-02-07, 14:43
MG303
Wiek: 30 Na forum: 6418 dni Posty: 654
Piwa : 2990
Kod: forward TextDrawLicznikUpdate();
public TextDrawLicznikUpdate()
{
new xstreingx[20];
format(xstreingx, 20, "Team1 ~w~%d ~r~: ~w~%d ~b~Team2", frag1,frag2);
TextDrawSetString(LicznikDraw, xstreingx);
return 1;
}
i nie r?b textdraw?w dla wszystkich graczy, wystarczy tylko jeden dla ca?o?ci.
jak definiujesz frag1 i frag2?
Wysłany: 2012-02-08, 10:30
DUDEKRPK
Wiek: 37 Na forum: 5242 dni Posty: 10
Nick w MP: fdasf
Kod:
Kod: public OnPlayerDeath(playerid, killerid, reason)
{
if(GetPlayerTeam(killerid) == TEAM_1)
{
frag1++;
GetPlayerScore(frag1 + 1);
}
else if(GetPlayerTeam(killerid) == TEAM_2)
{
frag2++;
//SetPlayerScore(killerid, frag2);
GetPlayerScore(killerid + frag2);
}
}
return 1;
}
Kod: forward TextDrawLicznikUpdate();
public TextDrawLicznikUpdate()
{
new xstreingx[100];
format(xstreingx, 100, "Team1 ~w~%d ~r~: ~w~%d ~b~Team2", frag1,frag2);
TextDrawSetString(LicznikDraw, xstreingx);
return 1;
}
i tyle. Zrobi?em komend?
Kod: if(strcmp(cmdtext, "/a", true) == 0)
{
frag1++;
return 1;
}
i jak wpisze /a to normalnie dodaje punkt dla team1
Wysłany: 2012-02-08, 13:34
BraYaN_
Wiek: 34 Na forum: 6602 dni Posty: 276
Nick w MP: BraYaN_
Piwa : 1614
DUDEKRPK , Pawn public OnPlayerDeath ( playerid , killerid , reason )
{
switch( GetPlayerTeam ( killerid ))
{
case TEAM_1 :
{
frag1 ++;
}
case TEAM_2
{
frag2 ++;
}
}
SetPlayerScore ( killerid , GetPlayerScore ( playerid )+ 1 );
return 1 ;
}
czy team ustawiasz funkcj? http://wiki.sa-mp.com/wiki/SetPlayerTeam ?
Wysłany: 2012-02-08, 18:04
MG303
Wiek: 30 Na forum: 6418 dni Posty: 654
Piwa : 2990
Zapomnieli?my o wa?nej rzeczy - tworzysz timer dla callbacka TextDrawLicznikUpdate ?
Tagi: licznik :: fragów
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: