Wysłany: 2018-07-19, 08:11
hansik96
Wiek: 29 Na forum: 3288 dni Posty: 5
Nick w MP: hansik
Piwa : 1
Witam, pisze troch? w pawn ale napotka?em problem kt?rego nie mog? rozwi?za?.
Mianowicie zapis daty rejestracji gracza np. Admin zarejestrowany od: rok,miesi?ce,dni.
Nie wiem dok?adnie jak ten kod zrobi? wi?c prosz? was o pomoc, z g?ry dzi?ki!
SS jak to wygl?da na mysql:
https://i.imgur.com/r9R6fvU.png
i Linijka kodu ze /staty
Kod: CMD:staty(pid, params[])
{
new playerid;
if(sscanf(params, "u", playerid)) playerid = pid;
if(!IsPlayerConnected(playerid)) return SCM(playerid, COLOR_LIGHTRED, "B?AD: "WHITE"Ten gracz nie jest pod??czony!");
if(!pData[playerid][loggedIn]) return SCM(playerid, COLOR_LIGHTRED, "B?AD: "WHITE"Ten gracz nie jest zalogowany!");
bstrx = "";
StrStaty(""PSR"Nick: "WHITE"%s", GetPlayerNick(playerid));
StrStaty(""PSR"UID:"WHITE"%d", pData[playerid][accountID]);
StrStaty(""PSR"Wizyt: "WHITE"{ffffff}%d", pData[playerid][player_achievements][ACH_WITAMY]);
if(pData[playerid][adminLevel] == 1) StrStaty(""PSR"Ranga: "MODERATOR"{ffffff}JuniorAdmin", 0);
else if(pData[playerid][adminLevel] == 2) StrStaty(""PSR"Ranga: "CHAT"{ffffff}Admin", 0);
else if(pData[playerid][adminLevel] == 3) StrStaty(""PSR"Ranga: "BLUE"{ffffff}ViceHead", 0);
else if(pData[playerid][adminLevel] == 4) StrStaty(""PSR"Ranga: "LIGHTRED"{ffffff}HeadAdmin", 0);
else if(pData[playerid][Eventowicz] == 1) StrStaty(""PSR"Ranga: {ffffff}Eventowicz", 0);
else StrStaty(""PSR"Ranga: "WHITE"%s", Rangi[pData[playerid][PlayerRanga]][RangaName]);
if(pData[playerid][vipEnabled]) StrStaty(""PSR"Aktywny VIP: "LIGHTORANGE"{FFFFFF}Tak\n", 0);
else StrStaty(""PSR"Antywny VIP: "LIGHTORANGE"{FFFFFF}Nie\n", 0);
if(pData[playerid][player_gang])
{
new gangranga[40];
switch(pData[playerid][player_gangrank])
{
case 0: gangranga = ""LIGHTGREEN"{ffffff}Cz?onek";
case 1: gangranga = ""LIGHTGREEN"{ffffff}Cz?onek";
case 2: gangranga = ""INFO"{ffffff}Vice Lider";
case 3: gangranga = ""LIGHTRED"{ffffff}Lider";
}
StrStaty(""PSR"Gang: "ORANGE"{ffffff}%s", gInfo[pData[playerid][player_gang]][gangNazwa]);
StrStaty(""PSR"Ranga: "ORANGE"{ffffff}%s\n", gangranga);
}
StrStaty(""PSR"Poziom: "WHITE"{ffffff}%d", pData[playerid][pLevel]);
StrStaty(""PSR"Exp: "WHITE"{ffffff}%d/%d\n", pData[playerid][respect], pData[playerid][pNextLevel]);
StrStaty(""PSR"Zab?jstw: "WHITE"{ffffff}%d", pData[playerid][kills]);
StrStaty(""PSR"?mierci: "WHITE"{ffffff}%d", pData[playerid][deaths]);
StrStaty(""PSR"Samob?jstw: "WHITE"{ffffff}%d", pData[playerid][suicides]);
StrStaty(""PSR"Ratio: "WHITE"{ffffff}%.2f", float(pData[playerid][kills])/float(pData[playerid][deaths]));
StrStaty(""PSR"Najszybszy Glitch: "WHITE"{ffffff}%.3f", glitchRecord[playerid]);
StrStaty(""PSR"Zabitych potwor?w: "WHITE"{ffffff}%d", pData[playerid][player_achievements][ACH_POTWOR]);
StrStaty(""PSR"Najlepszy KillStreak: "WHITE"{ffffff}%d\n", pData[playerid][bestStreak]);
StrStaty(""PSR"Kasa: "WHITE"{ffffff}%d$", GetPlayerMoney(playerid));
StrStaty(""PSR"Kasa w banku: "WHITE"{ffffff}%s$\n", GetPlayerAccountData(playerid, "bank_money"));
StrStaty(""PSR"Za g?ow?: "WHITE"{ffffff}%d$", pData[playerid][hitman]);
StrStaty(""PSR"Skin: "WHITE"{ffffff}%d", GetPlayerSkin(playerid));
StrStaty(""PSR"Warny: "WHITE"{ffffff}%d\n", pData[playerid][warningReceived]);
new h, m;
h = floatround(((pData[playerid][player_connected]+pData[playerid][LacznyCzasGry]) / 3600));
m = floatround(((pData[playerid][player_connected]+pData[playerid][LacznyCzasGry]) / 60) % 60);
// new xstr[16];
// format(xstr, 16, "%d:%02d", h, m);
format(bstrx, sizeof bstrx, "{00ecff}%s"PSR"??czny czas gry: "WHITE"%02d godziny %02d minut\n", bstrx, h, m);
InfoBox(pid, bstrx);
return 1;
}
Wysłany: 2018-07-29, 11:17
Robson04
Wiek: 23 Na forum: 3183 dni Posty: 58
Nick w MP: Robson04
Piwa : 512
Gdy gracz zarejestruje konto na serwerze musisz pobra? dat? do zmiennych i zapisa? je do bazy lub do plik?w lokalnych.
Poka?e Ci przyk?ad na plikach dfile.
Kod: #include <a_samp> //globalna biblioteka
#include <dfile> //Biblioteka, kt?ra zapisuje dane do plik?w (prosty)
..GdyGraczStworzyKonto(playerid)
{
new Year, Month, Day;
getdate(Year, Month, Day);
dfile_Open(SciezkaKontaGracza);
dfile_WriteInt("Rok", Year);
dfile_WriteInt("Miesiac", Month);
dfile_WriteInt("Dzien", Day);
dfile_SaveFile();
dfile_CloseFile();
return 1;
}
..GdyGraczZalogujeSie(playerid)
{
//Najlepiej pobiera? wszystkie dane do enuma, aby potem m?c je u?y? w przysz?o?ci.
//Wi?c u?yjemy zmiennych.
dfile_Open(SciezkaKontaGracza);
MyEnum[playerid][REG_YEAR] = dfile_ReadInt("Rok");
MyEnum[playerid][REG_MONTH] = dfile_ReadInt("Miesiac");
MyEnum[playerid][REG_DAY] = dfile_ReadInt("Dzien");
dfile_CloseFile();
return 1;
}
..GdyGraczWpiszeWybranaKomende(playerid)
{
new string_message[258];
format(string_message, sizeof string_message, "Witaj! Twoje Konto zosta?o zarejestrowane: %i.%i.%i", MyEnum[playerid][REG_DAY], MyEnum[playerid][REG_MONTH], MyEnum[playerid][REG_YEAR]);
SendClientMessage(playerid, -1, string_message);
return 1;
}
W twoim przypadku to MySQL, przy zalogowaniu gracza pobierz dane z MySQL do zmiennych i poka? to graczowi gdy wykona /stats
Tagi: data :: rejestracji :: /staty
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: