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

Wysłany: 2014-06-08, 19:03


act_1







Wiek: 28
Na forum: 5271 dni
Posty: 26
Nick w MP: AcT

Piwa: 1

Respekt: 50

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);
}


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-06-09, 01:32


Pr0f3ssi0n4LisT







Wiek: 25
Na forum: 6845 dni
Posty: 120

Piwa: 3653

Respekt: 117,8
Respekt: 117,8

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

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-06-09, 21:39


act_1







Wiek: 28
Na forum: 5271 dni
Posty: 26
Nick w MP: AcT

Piwa: 1

Respekt: 50

Okej, wszystko dzia?a... tylko teraz kolejny problem gdy? score zostaje dodane tylko graczowi z przydzielonym id: 0 ;(

Daje browca za pomoc!

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-06-09, 23:02


xqz

otaku desu!






Wiek: 32
Na forum: 6406 dni
Posty: 723
Nick w MP: xqz

Piwa: 5465

Respekt: 418,6
Respekt: 418,6

"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?


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-06-10, 15:50


act_1







Wiek: 28
Na forum: 5271 dni
Posty: 26
Nick w MP: AcT

Piwa: 1

Respekt: 50

A wstawi? by kto? te p?tle do tego kodu co poda?em?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-06-10, 18:08


xqz

otaku desu!






Wiek: 32
Na forum: 6406 dni
Posty: 723
Nick w MP: xqz

Piwa: 5465

Respekt: 418,6
Respekt: 418,6

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);


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-06-10, 19:43


act_1







Wiek: 28
Na forum: 5271 dni
Posty: 26
Nick w MP: AcT

Piwa: 1

Respekt: 50

Dzi?ki, wszystko pi?knie chodzi :)
Stawiam piwko za pomoc i ch?ci... dzi?ki jeszcze raz!

Pozdrawiam AcT!

Postaw piwo autorowi tego posta
 

 
Tagi: podwajające :: się :: score.
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] Podwajające się score. 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