#include #include #include #include #include #include #include #include #include #include #include #include #include #define KORISNICI_FILE "/Korisnici/%s.ini" enum pInfo { pLozinka, pNovac, pLevel, pRespekti, pPotrebnoRespekta, pAdmin, pSkin }; new PlayerInfo[MAX_PLAYERS][pInfo]; stock UserPath(const playerid) { new string[128],playername[MAX_PLAYER_NAME]; GetPlayerName(playerid,playername,sizeof(playername)); format(string,sizeof(string),KORISNICI_FILE,playername); return string; } stock udb_hash(const buf[]) { new length=strlen(buf); new s1 = 1; new s2 = 0; new n; for (n=0; n "c_white"Login", "Unesite vasu lozinku\nAko ste ju zaboravili, posjetite nas forum:"c_srv"www.balkan-original.info", ""c_white"Login", ""c_white"Izlaz"); } else { Dialog_Show(playerid, "d_register", DIALOG_STYLE_PASSWORD, ""c_srv"BO > "c_white"Register", ""c_white"Unesite zeljenu lozinku", ""c_white"Register", ""c_white"Izlaz"); } return 1; } hook OnPlayerDisconnect(playerid, reason) { new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File, "Informacije"); INI_WriteInt(File, "Novac", GetPlayerMoney(playerid)); INI_WriteInt(File, "Level", GetPlayerScore(playerid)); INI_WriteInt(File, "Respekti", PlayerInfo[playerid][pRespekti]); INI_WriteInt(File, "PotrebnoRespekta", PlayerInfo[playerid][pPotrebnoRespekta]); INI_WriteInt(File, "Admin", PlayerInfo[playerid][pAdmin]); INI_WriteInt(File, "Skin", PlayerInfo[playerid][pSkin]); INI_Close(File); return 1; } hook OnPlayerSpawn(playerid) { SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); return 1; } Dialog:d_register(const playerid, response, listitem, string: inputtext[]) { if(!response) return Kick(playerid); if(response) { if(!strlen(inputtext)) return Dialog_Show(playerid, "d_register", DIALOG_STYLE_PASSWORD, ""c_srv"BO > "c_white"Register", ""c_white"Unesite zeljenu lozinku", ""c_white"Register", ""c_white"Izlaz"); new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File, "Informacije"); INI_WriteInt(File, "Novac", 15000); INI_WriteInt(File, "Level", 3); INI_WriteInt(File, "Respekti", 0); INI_WriteInt(File, "PotrebnoRespekta", 15); INI_WriteInt(File, "Admin", 0); INI_WriteInt(File, "Skin", 7); INI_Close(File); SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); PlayerInfo[playerid][pNovac] = 15000; GivePlayerMoney(playerid, PlayerInfo[playerid][pNovac]); PlayerInfo[playerid][pLevel] = 3; SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]); PlayerInfo[playerid][pSkin] = 7; SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); PlayerInfo[playerid][pPotrebnoRespekta] = 15; } return 1; } Dialog:d_login(const playerid, response, listitem, string: inputtext[]) { if(!response) return Kick(playerid); if(response) { if(udb_hash(inputtext) == PlayerInfo[playerid][pLozinka]) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra=true, .extra=playerid); GivePlayerMoney(playerid, PlayerInfo[playerid][pNovac]); SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]); SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); } else { Dialog_Show(playerid, "d_login", DIALOG_STYLE_PASSWORD, ""c_srv"BO > "c_white"Login", "Unesite vasu lozinku\nAko ste ju zaboravili, posjetite nas forum:"c_srv"www.balkan-original.info", ""c_white"Login", ""c_white"Izlaz"); } return 1; } return 1; }