Wysłany: 2014-06-08, 19:03
act_1
Wiek: 28 Na forum: 5271 dni Posty: 26
Nick w MP: AcT
Piwa : 1
Cze??, mam problem gdy? zrobi?em by level ustawia? si? jako score.
Przy zalogowaniu na serwer ma si? np. 25lv a gdy gracz wbije kolejny level (26) to score przeskakuje zamiast na 26 to na 51 W czym jest problem?
Kod:
new lvl = dini_Int(lname, "level");
if(lvl < 1) lvl = 1;
level[playerid] = lvl;
nextexp[playerid] = floatround(((level[playerid]+1)*(level[playerid]+1)*7));
exp[playerid] = dini_Int(lname, "exp");
SetPlayerScore(playerid, GetPlayerScore(playerid)+ level[playerid]);
GetPlayerScore(playerid);
LotSamolotemTime[playerid] = dini_Int(lname, "lotsamolotem");
Zalogowany[playerid] = true;
if(dini_Isset(lname, "privcar") && dini_Int(lname, "privcar") >= 400)
{
[ Dodano : 2014-06-08, 19:55 ]
Kod: if(nextexp[i] == 0)
nextexp[i] = floatround(((level[i]+1)*(level[i]+1)*7));
if(exp[i] < 0) exp[i] = 0;
if(exp[i] >= nextexp[i])
{
level[i] = floatround(floatsqroot((exp[i]/7)), floatround_floor);
nextexp[i] = floatround(((level[i]+1)*(level[i]+1)*7));
PlayerPlaySound(i, 1185, 0.0, 0.0, 0.0);
SetPlayerScore(playerid, GetPlayerScore(playerid)+ level[i]);
GetPlayerScore(playerid);
TextDrawShowForPlayer(i, LevelUP);
format(pstr, sizeof(pstr), "Awans na poziom %d", level[i]);
TextDrawSetString(LevelUP2[i], pstr);
TextDrawShowForPlayer(i, LevelUP2[i]);
SetTimerEx("HideLevelUP", 5200, 0, "d", i);
format(string2, sizeof(string2), "Gratulacje! Gracz {FFFFFF}%s {F5DC0B}awansowa? na {FFFFFF}%d {F5DC0B}poziom!", PlayerName(i), level[i]);
SendClientMessageToAll(COLOR_YELLOW2, string2);
}
Wysłany: 2014-06-09, 01:32
Pr0f3ssi0n4LisT
Wiek: 25 Na forum: 6845 dni Posty: 120
Piwa : 3653
1. A tam zamiast tych kilku 'playerid' nie powinno byc 'i' z petli?
2. Problem w tym ze przy logowaniu ustawiasz graczowi level[playerid] na 25 pozniej gracz dobija do nastepnego levela i robisz blad przy ustawianiu score
SetPlayerScore(playerid, GetPlayerScore(playerid)+ level[i]);
GetPlayerScore zwroci 25 bo tyle aktualnie masz i doda 26 bo level[i] tyle wynosi
po wyliczeniu stad level[i] = floatround(floatsqroot((exp[i]/7)), floatround_floor);
wiec suma sumarum score rowna sie 51
Wysłany: 2014-06-09, 21:39
act_1
Wiek: 28 Na forum: 5271 dni Posty: 26
Nick w MP: AcT
Piwa : 1
Okej, wszystko dzia?a... tylko teraz kolejny problem gdy? score zostaje dodane tylko graczowi z przydzielonym id: 0
Daje browca za pomoc!
Wysłany: 2014-06-09, 23:02
xqz
otaku desu!
Wiek: 32 Na forum: 6406 dni Posty: 723
Nick w MP: xqz
Piwa : 5465
"act_1" napisał/a :kolejny problem gdy? score zostaje dodane tylko graczowi z przydzielonym id: 0
"Pr0f3ssi0n4LisT" napisał/a :1. A tam zamiast tych kilku 'playerid' nie powinno byc 'i' z petli?
Wysłany: 2014-06-10, 15:50
act_1
Wiek: 28 Na forum: 5271 dni Posty: 26
Nick w MP: AcT
Piwa : 1
A wstawi? by kto? te p?tle do tego kodu co poda?em?
Wysłany: 2014-06-10, 18:08
xqz
otaku desu!
Wiek: 32 Na forum: 6406 dni Posty: 723
Nick w MP: xqz
Piwa : 5465
Kod:
if(nextexp[i] == 0)
nextexp[i] = floatround(((level[i]+1)*(level[i]+1)*7));
if(exp[i] < 0) exp[i] = 0;
if(exp[i] >= nextexp[i])
{
level[i] = floatround(floatsqroot((exp[i]/7)), floatround_floor);
nextexp[i] = floatround(((level[i]+1)*(level[i]+1)*7));
PlayerPlaySound(i, 1185, 0.0, 0.0, 0.0);
SetPlayerScore(i, GetPlayerScore(i)+ level[i]);
GetPlayerScore(i);
TextDrawShowForPlayer(i, LevelUP);
Wysłany: 2014-06-10, 19:43
act_1
Wiek: 28 Na forum: 5271 dni Posty: 26
Nick w MP: AcT
Piwa : 1
Dzi?ki, wszystko pi?knie chodzi
Stawiam piwko za pomoc i ch?ci... dzi?ki jeszcze raz!
Pozdrawiam AcT!
Tagi: podwajające :: się :: score.
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: