Introducere:
Salutare tuturor, astazi o sa va arat cum se creeaza un sistem de pin.Acesta este ultimul meu tutorial si totodata si ultimul script creat de mine(DaEdRiC-FoX), dupa aceea ma voi retrage din lumea SA:MP-ului.
Pasul I: Structura
-Prima data va trebuie sa punem variabila pinului:
pPin//Aceasta este o variabila la fel ca celelalte : pAdmin,pHelper etc.
Apasam tasta CTRL+F si cautam pAdmin sau orice altceva care face parte din PlayerData/PlayerInfo sau cum aveti voi.
Unii folosesc direct metoda de update in baza de date:
mysql_format(handle, string, sizeof(string), "UPDATE `users` SET `Cash`='%d' WHERE `Nume`='%s'", PlayerData[playerid][pCash], playerName);
mysql_query(handle, string);
dar eu prefer sa fac astefel:
//Pun sub enum-ul de la PlayerInfo:
enum
{
pPinu//ATENTIE!!Nu este pPin ci este pPinu, trebuie sa difere de variabila de la PlayerInfo.Mai puteti pune si pPinx, cum doriti.
};
//Apoi punem la inceputul gm-ului:
forward Update(playerid, type);
//Mergem oriunde in gm si punem:
public Update(playerid, type)//de Update(); ne vom folosi mai tarziu, v-eti intelege.
{
if(IsPlayerConnected(playerid))
{
new string[256];//aici creem un string, sau putem pune query in loc de string.
new playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, sizeof(playerName));//Aici cautam numele playerului in cauza.
{
switch(type)
{
case pPinu:
{
mysql_format(handle, string, sizeof(string), "UPDATE `users` SET `Pin`='%d' WHERE `Nume`='%s'", PlayerData[playerid][pPin],playerName);//Aici se va face introducerea in baza de date.
mysql_query(handle, string);
}
}
}
}
}
Acum cand vom avea nevoie sa facem update la pin(sa facem introducerea in baza de date pentru cei care nu inteleg)vom pune:
Update(playerid, pPinu);//Se actioneaza collback-ul si se face update in baza de date, fara sa mai scriem altceva in plus
-Bun, apoi va trebui sa facem extragerea Pinului din baza de date:-Mergem la public OnLogin/OnPlayerLogin/WhenPlayerLogin depinde cum aveti voi si punem:
PlayerData[playerid][pPin] = cache_get_field_content_int(0, "Pin");//Aici vom extrage din baza de date pin-ul playerului in cauza.
-Bun acum structura este gata.
Pasul II: Textdraw-urile
-Eu am deja facute textdraw-urile, dar daca voi vreti altele puteti face cu ipleomax.
//Astea trebuie puse la inceputul Gm-ului, definim textdraw-urile.
new Text:PinBox[3][MAX_PLAYERS];
new Text:PinClose[2][MAX_PLAYERS];
new Text:PinVerde[MAX_PLAYERS];
new Text:PinRosu[MAX_PLAYERS];
new Text:PinCifra[10][MAX_PLAYERS];
new Text:PinText[MAX_PLAYERS];
new numberab[MAX_PLAYERS][5];//asta va fi pentru cifre
//Apoi, mergem la publicul OnPlayerConnect si punem textdraw-urile:
PinBox[0][playerid] = TextDrawCreate(393.999969, 132.913330, "usebox");
TextDrawLetterSize(PinBox[0][playerid], 0.000000, 26.618642);
TextDrawTextSize(PinBox[0][playerid], 235.777816, 0.000000);
TextDrawAlignment(PinBox[0][playerid], 1);
TextDrawColor(PinBox[0][playerid], 0);
TextDrawUseBox(PinBox[0][playerid], true);
TextDrawBoxColor(PinBox[0][playerid], 102);
TextDrawSetShadow(PinBox[0][playerid], 0);
TextDrawSetOutline(PinBox[0][playerid], 0);
TextDrawFont(PinBox[0][playerid], 0);
PinBox[1][playerid] = TextDrawCreate(386.444427, 141.375549, "usebox");
TextDrawLetterSize(PinBox[1][playerid], 0.000000, 24.904077);
TextDrawTextSize(PinBox[1][playerid], 242.000000, 0.000000);
TextDrawAlignment(PinBox[1][playerid], 1);
TextDrawColor(PinBox[1][playerid], 0);
TextDrawUseBox(PinBox[1][playerid], true);
TextDrawBoxColor(PinBox[1][playerid], 102);
TextDrawSetShadow(PinBox[1][playerid], 0);
TextDrawSetOutline(PinBox[1][playerid], 0);
TextDrawFont(PinBox[1][playerid], 0);
PinBox[2][playerid] = TextDrawCreate(386.000000, 141.375549, "usebox");
TextDrawLetterSize(PinBox[2][playerid], 0.000000, 5.767285);
TextDrawTextSize(PinBox[2][playerid], 242.444442, 0.000000);
TextDrawAlignment(PinBox[2][playerid], 1);
TextDrawColor(PinBox[2][playerid], 0);
TextDrawUseBox(PinBox[2][playerid], true);
TextDrawBoxColor(PinBox[2][playerid], -2139094785);
TextDrawSetShadow(PinBox[2][playerid], 0);
TextDrawSetOutline(PinBox[2][playerid], 0);
TextDrawFont(PinBox[2][playerid], 0);
PinClose[0][playerid] = TextDrawCreate(376.888885, 130.915557, "LD_POOL:BALL");
TextDrawLetterSize(PinClose[0][playerid], 0.000000, 0.000000);
TextDrawTextSize(PinClose[0][playerid], 15.111114, 16.924453);
TextDrawAlignment(PinClose[0][playerid], 1);
TextDrawColor(PinClose[0][playerid], -1);
TextDrawSetShadow(PinClose[0][playerid], 0);
TextDrawSetOutline(PinClose[0][playerid], 0);
TextDrawFont(PinClose[0][playerid], 4);
PinClose[1][playerid] = TextDrawCreate(385.333374, 131.911132, "X");
TextDrawLetterSize(PinClose[1][playerid], 0.454444, 1.624888);
TextDrawTextSize(PinClose[1][playerid], 10.000000, 10.000000);
TextDrawAlignment(PinClose[1][playerid], 2);
TextDrawColor(PinClose[1][playerid], -2147483393);
TextDrawSetShadow(PinClose[1][playerid], 0);
TextDrawSetOutline(PinClose[1][playerid], 1);
TextDrawBackgroundColor(PinClose[1][playerid], 51);
TextDrawFont(PinClose[1][playerid], 2);
TextDrawSetProportional(PinClose[1][playerid], 1);
TextDrawSetSelectable(PinClose[1][playerid], true);
PinVerde[playerid] = TextDrawCreate(272.888916, 341.475646, "OK");
TextDrawLetterSize(PinVerde[playerid], 0.501111, 1.500444);
TextDrawTextSize(PinVerde[playerid], 10.000000, 10.000000);
TextDrawAlignment(PinVerde[playerid], 2);
TextDrawColor(PinVerde[playerid], 16711935);
TextDrawSetShadow(PinVerde[playerid], 0);
TextDrawSetOutline(PinVerde[playerid], 1);
TextDrawBackgroundColor(PinVerde[playerid], 51);
TextDrawFont(PinVerde[playerid], 3);
TextDrawSetProportional(PinVerde[playerid], 1);
TextDrawSetSelectable(PinVerde[playerid], true);
PinRosu[playerid] = TextDrawCreate(355.555572, 341.475646, "DEL");
TextDrawLetterSize(PinRosu[playerid], 0.345555, 1.600000);
TextDrawTextSize(PinRosu[playerid], 10.000000, 10.000000);
TextDrawAlignment(PinRosu[playerid], 2);
TextDrawColor(PinRosu[playerid], -16776961);
TextDrawSetShadow(PinRosu[playerid], 0);
TextDrawSetOutline(PinRosu[playerid], 1);
TextDrawBackgroundColor(PinRosu[playerid], 51);
TextDrawFont(PinRosu[playerid], 3);
TextDrawSetProportional(PinRosu[playerid], 1);
TextDrawSetSelectable(PinRosu[playerid], true);
PinCifra[0][playerid] = TextDrawCreate(315.999908, 341.475646, "0");
TextDrawLetterSize(PinCifra[0][playerid], 0.449999, 1.600000);
TextDrawTextSize(PinCifra[0][playerid], 10.000000, 10.000000);
TextDrawAlignment(PinCifra[0][playerid], 2);
TextDrawColor(PinCifra[0][playerid], -1);
TextDrawSetShadow(PinCifra[0][playerid], 0);
TextDrawSetOutline(PinCifra[0][playerid], 1);
TextDrawBackgroundColor(PinCifra[0][playerid], 51);
TextDrawFont(PinCifra[0][playerid], 3);
TextDrawSetProportional(PinCifra[0][playerid], 1);
TextDrawSetSelectable(PinCifra[0][playerid], true);
PinCifra[1][playerid] = TextDrawCreate(264.444335, 207.573303, "1");
TextDrawLetterSize(PinCifra[1][playerid], 0.449999, 1.600000);
TextDrawTextSize(PinCifra[1][playerid], 10.000000, 10.000000);
TextDrawAlignment(PinCifra[1][playerid], 2);
TextDrawColor(PinCifra[1][playerid], -1);
TextDrawSetShadow(PinCifra[1][playerid], 0);
TextDrawSetOutline(PinCifra[1][playerid], 1);
TextDrawBackgroundColor(PinCifra[1][playerid], 51);
TextDrawFont(PinCifra[1][playerid], 3);
TextDrawSetProportional(PinCifra[1][playerid], 1);
TextDrawSetSelectable(PinCifra[1][playerid], true);
PinCifra[2][playerid] = TextDrawCreate(316.444396, 207.573318, "2");
TextDrawLetterSize(PinCifra[2][playerid], 0.449999, 1.600000);
TextDrawTextSize(PinCifra[2][playerid], 10.000000, 10.000000);
TextDrawAlignment(PinCifra[2][playerid], 2);
TextDrawColor(PinCifra[2][playerid], -1);
TextDrawSetShadow(PinCifra[2][playerid], 0);
TextDrawSetOutline(PinCifra[2][playerid], 1);
TextDrawBackgroundColor(PinCifra[2][playerid], 51);
TextDrawFont(PinCifra[2][playerid], 3);
TextDrawSetProportional(PinCifra[2][playerid], 1);
TextDrawSetSelectable(PinCifra[2][playerid], true);
PinCifra[3][playerid] = TextDrawCreate(359.999908, 209.066650, "3");
TextDrawLetterSize(PinCifra[3][playerid], 0.449999, 1.600000);
TextDrawTextSize(PinCifra[3][playerid], 10.000000, 10.000000);
TextDrawAlignment(PinCifra[3][playerid], 2);
TextDrawColor(PinCifra[3][playerid], -1);
TextDrawSetShadow(PinCifra[3][playerid], 0);
TextDrawSetOutline(PinCifra[3][playerid], 1);
TextDrawBackgroundColor(PinCifra[3][playerid], 51);
TextDrawFont(PinCifra[3][playerid], 3);
TextDrawSetProportional(PinCifra[3][playerid], 1);
TextDrawSetSelectable(PinCifra[3][playerid], true);
PinCifra[4][playerid] = TextDrawCreate(264.888824, 249.386657, "4");
TextDrawLetterSize(PinCifra[4][playerid], 0.449999, 1.600000);
TextDrawTextSize(PinCifra[4][playerid], 10.000000, 10.000000);
TextDrawAlignment(PinCifra[4][playerid], 2);
TextDrawColor(PinCifra[4][playerid], -1);
TextDrawSetShadow(PinCifra[4][playerid], 0);
TextDrawSetOutline(PinCifra[4][playerid], 1);
TextDrawBackgroundColor(PinCifra[4][playerid], 51);
TextDrawFont(PinCifra[4][playerid], 3);
TextDrawSetProportional(PinCifra[4][playerid], 1);
TextDrawSetSelectable(PinCifra[4][playerid], true);
PinCifra[5][playerid] = TextDrawCreate(315.111053, 249.386627, "5");
TextDrawLetterSize(PinCifra[5][playerid], 0.449999, 1.600000);
TextDrawTextSize(PinCifra[5][playerid], 10.000000, 10.000000);
TextDrawAlignment(PinCifra[5][playerid], 2);
TextDrawColor(PinCifra[5][playerid], -1);
TextDrawSetShadow(PinCifra[5][playerid], 0);
TextDrawSetOutline(PinCifra[5][playerid], 1);
TextDrawBackgroundColor(PinCifra[5][playerid], 51);
TextDrawFont(PinCifra[5][playerid], 3);
TextDrawSetProportional(PinCifra[5][playerid], 1);
TextDrawSetSelectable(PinCifra[5][playerid], true);
PinCifra[6][playerid] = TextDrawCreate(360.888793, 249.884399, "6");
TextDrawLetterSize(PinCifra[6][playerid], 0.449999, 1.600000);
TextDrawTextSize(PinCifra[6][playerid], 10.000000, 10.000000);
TextDrawAlignment(PinCifra[6][playerid], 2);
TextDrawColor(PinCifra[6][playerid], -1);
TextDrawSetShadow(PinCifra[6][playerid], 0);
TextDrawSetOutline(PinCifra[6][playerid], 1);
TextDrawBackgroundColor(PinCifra[6][playerid], 51);
TextDrawFont(PinCifra[6][playerid], 3);
TextDrawSetProportional(PinCifra[6][playerid], 1);
TextDrawSetSelectable(PinCifra[6][playerid], true);
PinCifra[7][playerid] = TextDrawCreate(264.888824, 291.697784, "7");
TextDrawLetterSize(PinCifra[7][playerid], 0.449999, 1.600000);
TextDrawTextSize(PinCifra[7][playerid], 10.000000, 10.000000);
TextDrawAlignment(PinCifra[7][playerid], 2);
TextDrawColor(PinCifra[7][playerid], -1);
TextDrawSetShadow(PinCifra[7][playerid], 0);
TextDrawSetOutline(PinCifra[7][playerid], 1);
TextDrawBackgroundColor(PinCifra[7][playerid], 51);
TextDrawFont(PinCifra[7][playerid], 3);
TextDrawSetProportional(PinCifra[7][playerid], 1);
TextDrawSetSelectable(PinCifra[7][playerid], true);
PinCifra[8][playerid] = TextDrawCreate(313.777709, 291.697723, "8");
TextDrawLetterSize(PinCifra[8][playerid], 0.449999, 1.600000);
TextDrawTextSize(PinCifra[8][playerid], 10.000000, 10.000000);
TextDrawAlignment(PinCifra[8][playerid], 2);
TextDrawColor(PinCifra[8][playerid], -1);
TextDrawSetShadow(PinCifra[8][playerid], 0);
TextDrawSetOutline(PinCifra[8][playerid], 1);
TextDrawBackgroundColor(PinCifra[8][playerid], 51);
TextDrawFont(PinCifra[8][playerid], 3);
TextDrawSetProportional(PinCifra[8][playerid], 1);
TextDrawSetSelectable(PinCifra[8][playerid], true);
PinCifra[9][playerid] = TextDrawCreate(361.333251, 291.199951, "9");
TextDrawLetterSize(PinCifra[9][playerid], 0.449999, 1.600000);
TextDrawTextSize(PinCifra[9][playerid], 10.000000, 10.000000);
TextDrawAlignment(PinCifra[9][playerid], 2);
TextDrawColor(PinCifra[9][playerid], -1);
TextDrawSetShadow(PinCifra[9][playerid], 0);
TextDrawSetOutline(PinCifra[9][playerid], 1);
TextDrawBackgroundColor(PinCifra[9][playerid], 51);
TextDrawFont(PinCifra[9][playerid], 3);
TextDrawSetProportional(PinCifra[9][playerid], 1);
TextDrawSetSelectable(PinCifra[9][playerid], true);
PinText[playerid] = TextDrawCreate(310.222320, 159.288879, "_");
TextDrawLetterSize(PinText[playerid], 0.449999, 1.600000);
TextDrawAlignment(PinText[playerid], 2);
TextDrawColor(PinText[playerid], -1378294017);
TextDrawSetShadow(PinText[playerid], 0);
TextDrawSetOutline(PinText[playerid], 0);
TextDrawBackgroundColor(PinText[playerid], 51);
TextDrawFont(PinText[playerid], 1);
TextDrawSetProportional(PinText[playerid], 1);
-Am create structura, am introdus textdra-urile acum ce face?
-Le facem functionale:
//Cautam publicul OnPlayerClickTextDraw, este posibil sa nu il aveti dar il copiati:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
if(clickedid == PinClose[1][playerid])
{
TextDrawHideForPlayer(playerid,PinBox[0][playerid]);
TextDrawHideForPlayer(playerid,PinBox[1][playerid]);
TextDrawHideForPlayer(playerid,PinBox[2][playerid]);
TextDrawHideForPlayer(playerid,PinVerde[playerid]);
TextDrawHideForPlayer(playerid,PinRosu[playerid]);
TextDrawHideForPlayer(playerid,PinCifra[0][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[1][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[2][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[3][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[4][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[5][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[6][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[7][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[8][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[9][playerid]);
TextDrawHideForPlayer(playerid,PinClose[0][playerid]);
TextDrawHideForPlayer(playerid,PinClose[1][playerid]);
TextDrawHideForPlayer(playerid,PinText[playerid]);
CancelSelectTextDraw(playerid);
TogglePlayerControllable(playerid, 1);
new string[12];
format(string, 32,"____");
TextDrawSetString(PinText[playerid], string);
}
if(clickedid == PinCifra[0][playerid])
{
strcat(numberab[playerid],"0");//aici se adauga pe rand cate o cifra la fel si la restul.
TextDrawSetString(PinText[playerid],numberab[playerid]);
}
if(clickedid == PinCifra[1][playerid])
{
strcat(numberab[playerid],"1");
TextDrawSetString(PinText[playerid],numberab[playerid]);
}
if(clickedid == PinCifra[2][playerid])
{
strcat(numberab[playerid],"2");
TextDrawSetString(PinText[playerid],numberab[playerid]);
}
if(clickedid == PinCifra[3][playerid])
{
strcat(numberab[playerid],"3");
TextDrawSetString(PinText[playerid],numberab[playerid]);
}
if(clickedid == PinCifra[4][playerid])
{
strcat(numberab[playerid],"4");
TextDrawSetString(PinText[playerid],numberab[playerid]);
}
if(clickedid == PinCifra[5][playerid])
{
strcat(numberab[playerid],"5");
TextDrawSetString(PinText[playerid],numberab[playerid]);
}
if(clickedid == PinCifra[6][playerid])
{
strcat(numberab[playerid],"6");
TextDrawSetString(PinText[playerid],numberab[playerid]);
}
if(clickedid == PinCifra[7][playerid])
{
strcat(numberab[playerid],"7");
TextDrawSetString(PinText[playerid],numberab[playerid]);
}
if(clickedid == PinCifra[8][playerid])
{
strcat(numberab[playerid],"8");
TextDrawSetString(PinText[playerid],numberab[playerid]);
}
if(clickedid == PinCifra[9][playerid])
{
strcat(numberab[playerid],"9");
TextDrawSetString(PinText[playerid],numberab[playerid]);
}
if(clickedid == PinVerde[playerid])
{
if(PlayerData[playerid][pPin] == 0)//aici verificam daca playerul nu are niciun pin in baza de date
{
new string[200];
new addpin = strval(numberab[playerid]);
PlayerData[playerid][pPin] = addpin;
format(string, sizeof(string), Bot"Contul tau este acum securizat.Codul pin este: %d.Nu uita sa fac printscreen in caz ca il vei uita(F8).", addpin);
SCM(playerid, -1, string);
Update(playerid,pPinu);
AccountLock[playerid] = 1;
TextDrawHideForPlayer(playerid,PinBox[0][playerid]);
TextDrawHideForPlayer(playerid,PinBox[1][playerid]);
TextDrawHideForPlayer(playerid,PinBox[2][playerid]);
TextDrawHideForPlayer(playerid,PinVerde[playerid]);
TextDrawHideForPlayer(playerid,PinRosu[playerid]);
TextDrawHideForPlayer(playerid,PinCifra[0][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[1][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[2][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[3][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[4][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[5][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[6][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[7][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[8][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[9][playerid]);
TextDrawHideForPlayer(playerid,PinClose[0][playerid]);
TextDrawHideForPlayer(playerid,PinClose[1][playerid]);
TextDrawHideForPlayer(playerid,PinText[playerid]);
TogglePlayerControllable(playerid, 1);
CancelSelectTextDraw(playerid);
format(string, 32,"_");
TextDrawSetString(PinText[playerid], string);
}
else
{
if(PlayerData[playerid][pPin] == strval(numberab[playerid]))//aici verificam daca, codul din baza de date este identic cu cel introdus
{
new string[32];
SCM(playerid, -1, Bot"Contul tau a fost deblocat cu succes!");
TextDrawHideForPlayer(playerid,PinBox[0][playerid]);
TextDrawHideForPlayer(playerid,PinBox[1][playerid]);
TextDrawHideForPlayer(playerid,PinBox[2][playerid]);
TextDrawHideForPlayer(playerid,PinVerde[playerid]);
TextDrawHideForPlayer(playerid,PinRosu[playerid]);
TextDrawHideForPlayer(playerid,PinCifra[0][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[1][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[2][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[3][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[4][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[5][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[6][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[7][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[8][playerid]);
TextDrawHideForPlayer(playerid,PinCifra[9][playerid]);
TextDrawHideForPlayer(playerid,PinClose[0][playerid]);
TextDrawHideForPlayer(playerid,PinClose[1][playerid]);
TextDrawHideForPlayer(playerid,PinText[playerid]);
TogglePlayerControllable(playerid, 1);
CancelSelectTextDraw(playerid);
format(string, 32,"_");
TextDrawSetString(PinText[playerid], string);
}
else{SCM(playerid,-1,"{f24848}Cod pin gresit!");}
}
}
if(clickedid == PinRosu[playerid])
{
strdel(numberab[playerid], 0,strval(numberab[playerid]));//aici stergem codul introdus
}
return 1;
}
-Bun deci structura a fost facuta, textdraw-urile puse, butoanele functionale, urmatorul pas comenzile.
Pasul III: Comenzile
CMD:setpin(playerid, params[])
{
if(PlayerData[playerid][pPin] == 0)//verificam daca playerul nu are pin
{
TextDrawShowForPlayer(playerid,PinBox[0][playerid]);
TextDrawShowForPlayer(playerid,PinBox[1][playerid]);
TextDrawShowForPlayer(playerid,PinBox[2][playerid]);
TextDrawShowForPlayer(playerid,PinVerde[playerid]);
TextDrawShowForPlayer(playerid,PinRosu[playerid]);
TextDrawShowForPlayer(playerid,PinCifra[0][playerid]);
TextDrawShowForPlayer(playerid,PinCifra[1][playerid]);
TextDrawShowForPlayer(playerid,PinCifra[2][playerid]);
TextDrawShowForPlayer(playerid,PinCifra[3][playerid]);
TextDrawShowForPlayer(playerid,PinCifra[4][playerid]);
TextDrawShowForPlayer(playerid,PinCifra[5][playerid]);
TextDrawShowForPlayer(playerid,PinCifra[6][playerid]);
TextDrawShowForPlayer(playerid,PinCifra[7][playerid]);
TextDrawShowForPlayer(playerid,PinCifra[8][playerid]);
TextDrawShowForPlayer(playerid,PinCifra[9][playerid]);
TextDrawShowForPlayer(playerid,PinClose[0][playerid]);
TextDrawShowForPlayer(playerid,PinClose[1][playerid]);
TextDrawShowForPlayer(playerid,PinText[playerid]);
SelectTextDraw(playerid, 0xFFFFFF33);
TogglePlayerControllable(playerid, 0);
}
else
{
SCM(playerid, COLOR_RED, Bot"Contul tau este deja securizat cu un cod pin tasteaza [/loginpin] pentru a debloca contul!");
}
return 1;
}
CMD:loginpin(playerid, params[])
{
if(PlayerData[playerid][pPin] > 0)//Verificam daca playerul are pin
{
TextDrawShowForPlayer(playerid,PinBox[0][playerid]);
TextDrawShowForPlayer(playerid,PinBox[1][playerid]);
TextDrawShowForPlayer(playerid,PinBox[2][playerid]);
TextDrawShowForPlayer(playerid,PinVerde[playerid]);
TextDrawShowForPlayer(playerid,PinRosu[playerid]);
TextDrawShowForPlayer(playerid,PinCifra[0][playerid]);
TextDrawShowForPlayer(playerid,PinCifra[1][playerid]);
TextDrawShowForPlayer(playerid,PinCifra[2][playerid]);
TextDrawShowForPlayer(playerid,PinCifra[3][playerid]);
TextDrawShowForPlayer(playerid,PinCifra[4][playerid]);
TextDrawShowForPlayer(playerid,PinCifra[5][playerid]);
TextDrawShowForPlayer(playerid,PinCifra[6][playerid]);
TextDrawShowForPlayer(playerid,PinCifra[7][playerid]);
TextDrawShowForPlayer(playerid,PinCifra[8][playerid]);
TextDrawShowForPlayer(playerid,PinCifra[9][playerid]);
TextDrawShowForPlayer(playerid,PinClose[0][playerid]);
TextDrawShowForPlayer(playerid,PinClose[1][playerid]);
TextDrawShowForPlayer(playerid,PinText[playerid]);
SelectTextDraw(playerid, 0xFFFFFF66);
TogglePlayerControllable(playerid, 0);
return 1;
}
else
{
SCM(playerid, COLOR_RED, Bot"Contul tau nu este securizat cu un cod pin!Tasteaza [/setpin] pentru a seta unul!");
}
return 1;
}
CMD:pin(playerid, params[])
{
return cmd::loginpin(playerid, params);//creem o scurtatura pentru comanda /Loginpin
}
!!!Atentie!!!Eu am folosit procesorul de comenzi LIFE-CMD, comenzile sunt la fel dar scurtatura acea difera, deci daca folositi zcmd veti pune:
CMD:pin(playerid, params[])
{
return cmd_loginpin(playerid, params);
}
Pasul IV: Tabelul in baza de date
1.Mergem la tabelul users sau players sau accounts cum aveti voi apoi:
2.Adaugam un nou rand dupa ultimul
3.Noul rand va fi de timp int(intreg)cu lungimea de 4, si va avea valoarea 0 pana ce aceasta se va schimba.
Bun, acesta a fost tutorialul, sper ca ati inteles.
Sper ca veti pastra creditele.
!!!Atentie!!! +1 daca ti-a fost de folos.