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

Wysłany: 2014-10-03, 16:21


Zon3







Wiek: 32
Na forum: 4421 dni
Posty: 66

Piwa: 4

Respekt: 50

Ostrzeżeń: 100%
Witam. Powie mi kto? jak zrobi? sysrem leveli? np. mamy 0 score to mamy level 1 i jak dobijemy do 100 score to mamy lvl 2? Prosze o pomoc :0

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-10-03, 16:45


ToxiC.







Wiek: 29
Na forum: 5387 dni
Posty: 3792

Piwa: 8590

Respekt: 1143,8
Respekt: 1143,8

yyjjjj
G?ra
Pawn

new lvl[MAX_PLAYERS];


OnPlayerConnect/Disconnect:
Pawn

lvl[playerid] = 1; //Ustawiamy Level 1 (domy?lnie)


Pawn

LevelSprawdz(playerid)
{
if(GetPlayerScore(playerid) >= 100) //je?eli ma 100 lub wi?cej score 
{
lvl[playerid] = 2; //ustawiamy level 2
}
//Nastepnie mozna robic tak:
if(GetPlayerScore(playerid) >=500)
{
lvl[playerid] = 3;
}
//i tak dalej
return 1;
}


LevelSprawdz uzywasz w timerze, albo OnPlayerUpdate, aby byl ci?gle aktualny. Wystarczy wklepa? to:
Pawn
 LevelSprawdz(playerid);


Tutaj przyk?adowo jak wy?wietli? jaki kto ma level, komenda:
Pawn

CMD:level(playerid)
{
new string[99];
format(string, sizeof(string), "Tw?j level: %d", lvl[playerid]);
SendClientMessage(playerid, -1, string);
return 1;
}


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-10-03, 16:55


Zon3







Wiek: 32
Na forum: 4421 dni
Posty: 66

Piwa: 4

Respekt: 50

Ostrzeżeń: 100%
Pawn
lvl[playerid] = 1; //Ustawiamy Level 1 (domy?lnie)


LevelSprawdz(playerid)
{
if(GetPlayerScore(playerid) >= 100) //je?eli ma 100 lub wi?cej score 
{
lvl[playerid] = 2; //ustawiamy level 2
}
//Nastepnie mozna robic tak:
if(GetPlayerScore(playerid) >=500)
{
lvl[playerid] = 3;
}
//i tak dalej
return 1;
}

To mam dac do OnPlayerConnect i disconnect?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-10-03, 17:41


Catus







Wiek: 31
Na forum: 4703 dni
Posty: 31

Piwa: 311

Respekt: 50

Beka.

Wiesz w og?le do czego s?u?y OnPlayerConnect? To co wkleisz w OnPlayerConnect wykonuje si? przy po??czeniu z serwerem.

lvl[playerid] = 1;
dajesz w OnPlayerConnect bo wtedy przy po??czeniu ustawia graczowi 1 lvl.

LevelSprawdz dajesz oboj?tnie gdzie tylko nie w callbacku. A LevelSprawdz(playerid); w public OnPlayerUpdate.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-10-03, 19:53


ToxiC.







Wiek: 29
Na forum: 5387 dni
Posty: 3792

Piwa: 8590

Respekt: 1143,8
Respekt: 1143,8

Zon3,
Pisa?em, levelsprawdz dajesz w timerze lub onplayerupdate, jak czytasz. :P

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-10-04, 14:19


IgrexolonO







Wiek: 35
Na forum: 6950 dni
Posty: 1386

Piwa: 1062

Respekt: 651,8
Respekt: 651,8Respekt: 651,8

Pawn
new _lvl[MAX_PLAYERS] = {0, ...};

stock setPlayerScoreEx(playerid, amount)
{
    SetPlayerScore(playerid, amount);
    levelCheck(playerid, amount);
    return true;
}

foward levelCheck(playerid, amount);
public levelCheck(playerid, amount)
{
    new _reminder = _lvl[playerid];
    
    if(GetPlayerScore(playerid) > -1) _lvl[playerid] = 1;
    if(GetPlayerScore(playerid) >= 100) _lvl[playerid] = 2;
    if(GetPlayerScore(playerid) >= 500) _lvl[playerid] = 3;
    
    if(_reminder < _lvl[playerid])
    {
        new _format[128];
        format(_format, sizeof(_format), "Gratulacje. Awansowa?e? na %d poziom!", _lvl[playerid]);
        SendClientMessage(playerid, -1, _format);
    }
    return 1;
}


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-10-08, 16:22


KaNdY







Wiek: 29
Na forum: 4628 dni
Posty: 53
Nick w MP: KaNdY

Piwa: 1

Respekt: 56,5

"IgrexolonO" napisał/a:

Pawn
new _lvl[MAX_PLAYERS] = {0, ...};

stock setPlayerScoreEx(playerid, amount)
{
    SetPlayerScore(playerid, amount);
    levelCheck(playerid, amount);
    return true;
}

foward levelCheck(playerid, amount);
public levelCheck(playerid, amount)
{
    new _reminder = _lvl[playerid];
    
    if(GetPlayerScore(playerid) > -1) _lvl[playerid] = 1;
    if(GetPlayerScore(playerid) >= 100) _lvl[playerid] = 2;
    if(GetPlayerScore(playerid) >= 500) _lvl[playerid] = 3;
    
    if(_reminder < _lvl[playerid])
    {
        new _format[128];
        format(_format, sizeof(_format), "Gratulacje. Awansowa?e? na %d poziom!", _lvl[playerid]);
        SendClientMessage(playerid, -1, _format);
    }
    return 1;
}


Pomo?esz mi zrobi?, aby level by? wy?wietlany w TD?

Postaw piwo autorowi tego posta
 

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


akon823

Czekotubka :D






Wiek: 30
Na forum: 4957 dni
Posty: 399
Nick w MP: Remik14

Piwa: 152

Respekt: 76,8

lul zr?b se tekstdrawa http://wiki.sa-mp.com/wiki/TextDrawShowForPlayer
i do tego formata tego tekstdrawa w kt?rym wy?wietlisz _lvl[playerid]
http://wiki.sa-mp.com/wiki/Format

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-10-08, 20:22


KaNdY







Wiek: 29
Na forum: 4628 dni
Posty: 53
Nick w MP: KaNdY

Piwa: 1

Respekt: 56,5

Hmm... Zrobi?e? co? takiego:
Kod:


new Text:LRespect;

//Wiadomo TD.

//===WY?WITL_RESPECT===
forward WyswietlRespect(playerid);
public WyswietlRespect(playerid)
{
new xstreingx[256];
format(xstreingx, 256, "Respect: %d", _lvl[playerid]);
TextDrawSetString(LRespect, xstreingx);
return 1;
}


Wiem, ?e brakuje Timera, ale nie chc? go dodawa?, aby co 1s si? tam zmienia?o, poniewa? zlaguje serwer. S? na to jakie? inne sposoby?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-10-08, 21:12


ToxiC.







Wiek: 29
Na forum: 5387 dni
Posty: 3792

Piwa: 8590

Respekt: 1143,8
Respekt: 1143,8

Tu go wstaw

Pawn

if(_reminder < _lvl[playerid])
    {
        new _format[128];
        format(_format, sizeof(_format), Gratulacje. Awansowa?e? na %d poziom!, _lvl[playerid]);
        SendClientMessage(playerid, -1, _format);
WyswietlRespect(playerid);
    }


Postaw piwo autorowi tego posta
 

 
Tagi: levele
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] Levele 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