/*•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• 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];public OnFilterScriptInit(){print(\"\\n--------------------------------------\");print(\"\");print(\"--------------------------------------\\n\");return 1;}public OnFilterScriptExit(){return 1;}#endifpublic 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 még nem vagy regisztrálva! \\n\\nKérjük regisztrálj.\", name);ShowPlayerDialog(playerid, ReGiStEr, DIALOG_STYLE_INPUT, \"Regisztráció\", string, \"Register\", \"Cancel.\");}if(fexist(file)){format(string, sizeof string, \"Üdv %s! \\nKérjük jelentkezz be! \\n\\nIrd be a jelszódat.\", name);ShowPlayerDialog(playerid, LoGiN, DIALOG_STYLE_INPUT, \"Bejelentkezés\", string, \"Login\", \"Cancel.\");}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,\"Weapon\", GetPlayerWeapon(playerid)); dini_IntSet(file,\"Money\", GetPlayerMoney(playerid)); dini_IntSet(file,\"Deaths\", PlayerInfo[playerid][Deaths]); dini_IntSet(file,\"Kills\", PlayerInfo[playerid][Kills]);}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, \"Register\", \"Cancel.\"); 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,\"Weapon\", GetPlayerWeapon(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, \"Login\", \"Cancel.\"); 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, \"Login\", \"Cancel.\"); 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: Rossz Jelszó! Ha elírtad lépj be újra!\"); 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\")); GetPlayerWeapon(playerid, dini_Int(file,\"Weapon\")); 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 be jelentkeztél!\"); TogglePlayerSpectating(playerid, 0); } }}}return 0;}
GetPlayerWeapon(playerid, dini_Int(file,\"Weapon\"));
GivePlayerWeapon(playerid, dini_Int(file,\"Weapon\", töltény szám));
GetPlayerWeaponData(playerid, slot, &weapons, &ammo);
new weapons[13][2];for (new i = 0; i < 13; i++){ GetPlayerWeaponData(playerid, i, weapons[0], weapons[1]);}
#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 0xFF0000FFnew weapons[13][2];new file[128];enum pInfo{Deaths,Kills,}new PlayerInfo[MAX_PLAYERS][pInfo];new IsLogged[MAX_PLAYERS];public OnFilterScriptInit(){print(\"\\n--------------------------------------\");print(\"\");print(\"--------------------------------------\\n\");return 1;}public OnFilterScriptExit(){return 1;}#endifpublic OnPlayerConnect(playerid){IsLogged[playerid] = 0; new 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 még nem vagy regisztrálva! \\n\\nKérjük regisztrálj.\", name);ShowPlayerDialog(playerid, ReGiStEr, DIALOG_STYLE_INPUT, \"Regisztráció\", string, \"Register\", \"Cancel.\");}if(fexist(file)){format(string, sizeof string, \"Üdv %s! \\nKérjük jelentkezz be! \\n\\nIrd be a jelszódat.\", name);ShowPlayerDialog(playerid, LoGiN, DIALOG_STYLE_INPUT, \"Bejelentkezés\", string, \"Login\", \"Cancel.\");}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]); } for (new i = 0; i < 13; i++) { dini_IntSet(file,\"Weapon\",GetPlayerWeaponData(playerid, i, weapons[0], weapons[1])); }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, \"Register\", \"Cancel.\"); 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,\"Weapon\", GetPlayerWeapon(playerid)); for (new i = 0; i < 13; i++) { dini_IntSet(file,\"Weapon\",GetPlayerWeaponData(playerid, i, weapons[0], weapons[1])); } 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, \"Login\", \"Cancel.\"); 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, \"Login\", \"Cancel.\"); 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: Rossz Jelszó! Ha elírtad lépj be újra!\"); 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\")); //GetPlayerWeapon(playerid, dini_Int(file,\"Weapon\")); 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 be jelentkeztél!\"); TogglePlayerSpectating(playerid, 0); } }}}return 0;}public OnPlayerSpawn(playerid){if(IsLogged[playerid] == 1) {for (new i = 0; i < 13; i++){ GivePlayerWeapon(playerid,dini_IntSet(file,\"Weapon\"),dini_IntSet(file,\"Weapon\"));}}return 1;}