Wysłany: 2012-07-12, 14:12
Jaroslav
Wiek: 29 Na forum: 5241 dni Posty: 31
Nick w MP: Pedro_Verto
Piwa : 1
Witam mam taki kod.
Kod:
new Kills[MAX_PLAYERS];
new Deaths[MAX_PLAYERS];
//onplayerdisconnect
dini_IntSet(PlayerName(playerid), "Kills", Kills[playerid]);
dini_IntSet(PlayerName(playerid), "Deaths", Deaths[playerid]);
OnPlayerDeath
Kills[killerid] ++; //increases the killers "kills" stats by 1
Deaths[playerid] ++; //increases the player who died "deaths" stats by 1.
to do logowania
Kills[playerid] = dini_Int(PlayerName(playerid), "Kills");
Deaths[playerid] = dini_Int(PlayerName(playerid), "Deaths");
A to do rejestracji
dini_IntSet(PlayerName(playerid), "Deaths", 0);
dini_IntSet(PlayerName(playerid), "Kills", 0);
//komenda
COMMAND:stats2(playerid, params[])
{
new string1[126];
new plname[25];
GetPlayerName(playerid, plname, 25);
new Float:ratio=floatdiv(Kills[playerid], Deaths[playerid]); //also added in a K/D Ratio for you you can just delete it if you don't want it.
format(string1, sizeof(string1), "%s's Stats: Kills: %d, Deaths %d, K/D Ratio: %.2f", plname,Kills[playerid],Deaths[playerid],ratio);
SendClientMessage(playerid,ORANGE, string1);
return 1;
}
Wszystko si? komplikuje. I jak si? zabije to i tak wynosi "0" pomo?ecie?
Wysłany: 2012-07-12, 17:09
Marihuana
Żyć by umierać :)
Wiek: 31 Na forum: 6047 dni Posty: 101
Nick w MP: KoZaKo
Piwa : 547
Po pierwsze pewnie dlatego ?e gdy Kill wynosi 1 a Deaths 0 a funkcja dzia?a dziel?c pierwszy argument przez drugi to wyjdzie 0. Tak przypuszczam. A drugie to , ?e to funkcja dziel?ca floaty a Ty podzieli?e? liczby typu integer ; d
Dodaj sobie pare kills i deaths. Spr?buj
Kod: COMMAND:stats2(playerid, params[])
{
new string1[126];
new plname[25];
GetPlayerName(playerid, plname, 25);
new Float:kills = float(Kills[playerid]);
new Float:deaths = float(Deaths[playerid]);
new Float:ratio = floatdiv(kills, deaths); //also added in a K/D Ratio for you you can just delete it if you don't want it.
format(string1, sizeof(string1), "%s's Stats: Kills: %d, Deaths %d, K/D Ratio: %.2f", plname,Kills[playerid],Deaths[playerid],ratio);
SendClientMessage(playerid,ORANGE, string1);
return 1;
}
Tagi: zapisanie :: śmierci :: oraz :: ilość :: zabitych
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: