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: 4280 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: 28
Na forum: 5246 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(stringsizeof(string), "Tw?j level: %d"lvl[playerid]);
SendClientMessage(playerid, -1string);
return 1;
}


Postaw piwo autorowi tego posta
 

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


Zon3







Wiek: 32
Na forum: 4280 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: 4562 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: 28
Na forum: 5246 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: 34
Na forum: 6809 dni
Posty: 1386

Piwa: 1062

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

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

stock setPlayerScoreEx(playeridamount)
{
    SetPlayerScore(playeridamount);
    levelCheck(playeridamount);
    return true;
}

foward levelCheck(playeridamount);
public levelCheck(playeridamount)
{
    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(_formatsizeof(_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: 4487 dni
Posty: 53
Nick w MP: KaNdY

Piwa: 1

Respekt: 56,5

"IgrexolonO" napisał/a:

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

stock setPlayerScoreEx(playeridamount)
{
    SetPlayerScore(playeridamount);
    levelCheck(playeridamount);
    return true;
}

foward levelCheck(playeridamount);
public levelCheck(playeridamount)
{
    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(_formatsizeof(_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: 29
Na forum: 4816 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: 4487 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: 28
Na forum: 5246 dni
Posty: 3792

Piwa: 8590

Respekt: 1143,8
Respekt: 1143,8

Tu go wstaw

Pawn

if(_reminder _lvl[playerid])
    {
        new _format[128];
        format(_formatsizeof(_format), GratulacjeAwansowa?ena %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 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