http://kepfeltoltes.hu/120320/976074224g_www.kepfeltoltes.hu_.jpg[/img]
ezt a jelszo-t .....-okba irja vagy ******[pawn]/*
Regisztráció
*/
#include <a_samp>
#include <dudb>
#include <dini>
#pragma unused strtok
#pragma unused ret_memcpy
#define FILTERSCRIPT
#if defined FILTERSCRIPT
#define ReGiStEr 8
#define LoGiN 9
#define COLOR_GREEN 0x00FF00FF
#define COLOR_RED 0xFF0000FF
enum pInfo
{
Deaths,
Kills,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
new IsLogged[MAX_PLAYERS];
new szin[MAX_PLAYERS];
public OnFilterScriptInit()
{
print(\"\\n--------------------------------------\");
print(\" tRegistration System by Torran\");
print(\"--------------------------------------\\n\");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#endif
public OnPlayerConnect(playerid)
{
IsLogged[playerid] = 0;
new file[128], string[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),\"/tReg/%s.ini\",name);
if(!fexist(file))
{
format(string, sizeof string, \"Üdv %s! \\nTe {057CEA}még {33FF33}nem {FF0000}vagy {CDF917}regisztrálva! \\n\\nKérjük {33FF33}regisztrálj.\", name);
ShowPlayerDialog(playerid, ReGiStEr, DIALOG_STYLE_INPUT, \"{CDF917}Regisztráció\", string, \"Regisztrál\", \"Kilép\");
}
if(fexist(file))
{
format(string, sizeof string, \"Üdv %s! \\nKérjük {33FF33}jelentkezz {33CCFF}be! \\n\\nIrd be a jelszódat.\", name);
ShowPlayerDialog(playerid, LoGiN, DIALOG_STYLE_INPUT, \"{CDF917}Bejelentkezés\", string, \"Belép\", \"Kilép\");
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new file[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),\"/tReg/%s.ini\",name);
if(fexist(file))
{
dini_IntSet(file,\"Score\", GetPlayerScore(playerid));
dini_IntSet(file,\"Money\", GetPlayerMoney(playerid));
dini_IntSet(file,\"Deaths\", PlayerInfo[playerid][Deaths]);
dini_IntSet(file,\"Kills\", PlayerInfo[playerid][Kills]);
dini_IntSet(file,\"Skin\", szin[playerid]);
}
IsLogged[playerid] = 0;
return 1;
}
public OnPlayerDeath(playerid, killerid)
{
PlayerInfo[playerid][Deaths] ++;
PlayerInfo[killerid][Kills] ++;
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == ReGiStEr)
{
if(response)
{
new file[128];
new string[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if(strlen(inputtext) == 0)
{
format(string, sizeof string, \"Regisztráció \\n\\nÜdv %s! \\nTe még nem vagy regisztrálva! \\n\\nKérjük regisztrálj.\", name);
ShowPlayerDialog(playerid, ReGiStEr, DIALOG_STYLE_INPUT, \"Regisztráció\", string, \"Regisztrálj\", \"Kilép\");
return 0;
}
format(file,sizeof(file),\"/tReg/%s.ini\",name);
if(!fexist(file))
{
dini_Create(file);
dini_IntSet(file,\"Password\", udb_hash(inputtext));
dini_IntSet(file,\"Score\", GetPlayerScore(playerid));
dini_IntSet(file,\"Money\", GetPlayerMoney(playerid));
dini_IntSet(file,\"Deaths\", PlayerInfo[playerid][Deaths]);
dini_IntSet(file,\"Kills\", PlayerInfo[playerid][Kills]);
format(string, sizeof string, \"Bejelentkezés \\n\\nÜdv %s! \\nTe regisztrálva vagy! \\n\\nKérjük jelentkezz be.\", name);
ShowPlayerDialog(playerid, LoGiN, DIALOG_STYLE_INPUT, \"Bejelentkezés\", string, \"Belép\", \"Kilép\");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
GetPlayerName(playerid, name, sizeof(name));
printf(\"%s sikeresen regisztrált!\", name);
}
}
}
if(dialogid == LoGiN)
{
if(response)
{
new file[128];
new string[128];
new PlayerName[24];
if(strlen(inputtext) == 0)
{
GetPlayerName(playerid, PlayerName, sizeof PlayerName);
format(string, sizeof string, \"Bejelentkezés \\n\\nÜdv %s! \\nTe regisztrálva vagy! \\n\\nKérjük jelentkezz be.\", PlayerName);
ShowPlayerDialog(playerid, LoGiN, DIALOG_STYLE_INPUT, \"Bejelentkezés\", string, \"Belép\", \"Kilép\");
return 0;
}
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),\"/tReg/%s.ini\",name);
if(fexist(file))
{
new password = dini_Int(file, \"Password\");
if(udb_hash(inputtext) != password)
{
SendClientMessage(playerid, COLOR_RED, \"***Hiba:Nem jó jelszó!\");
Kick(playerid);
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
printf(\"%s Nem tudott bejelentkezni!\", name);
}
else
{
IsLogged[playerid] = 1;
ResetPlayerMoney(playerid);
SetPlayerScore(playerid, dini_Int(file,\"Score\"));
GivePlayerMoney(playerid, dini_Int(file,\"Money\"));
PlayerInfo[playerid][Deaths] = dini_Int(file,\"Deaths\");
PlayerInfo[playerid][Kills] = dini_Int(file,\"Kills\");
SendClientMessage(playerid, COLOR_GREEN, \"***Sikeresen {33FF33}be {33CCFF}jelentkeztél!\");
TogglePlayerSpectating(playerid, 0);
}
}
}
}
return 0;
}[/pawn]