Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <crashdetect>
- #include <easyDialog>
- #include <ysilib\YSI_Storage\y_ini>
- #include <ysilib\YSI_Coding\y_hooks>
- #include <ysilib\YSI_Coding\y_malloc>
- #include <ysilib\YSI_Coding\y_timers>
- #include <ysilib\YSI_Coding\y_va>
- #include <ysilib\YSI_Core\y_master>
- #include <ysilib\YSI_Core\y_utils>
- #include <ysilib\YSI_Data\y_foreach>
- #include <sscanf2>
- #include <streamer>
- #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<length; n++)
- {
- s1 = (s1 + buf[n]) % 65521;
- s2 = (s2 + s1) % 65521;
- }
- return (s2 << 16) + s1;
- }
- forward LoadUser_data(const playerid,name[],value[]);
- public LoadUser_data(const playerid,name[],value[])
- {
- INI_Int("Lozinka",PlayerInfo[playerid][pLozinka]);
- INI_Int("Novac", PlayerInfo[playerid][pNovac]);
- INI_Int("Level", PlayerInfo[playerid][pLevel]);
- INI_Int("Respekti", PlayerInfo[playerid][pRespekti]);
- INI_Int("PotrebnoRespekta", PlayerInfo[playerid][pPotrebnoRespekta]);
- INI_Int("Admin", PlayerInfo[playerid][pAdmin]);
- INI_Int("Skin", PlayerInfo[playerid][pSkin]);
- return 1;
- }
- hook OnGameModeInit() {
- print("|------------------------------|");
- print(" reglog is loading... ");
- print(" reglog is founded ");
- print(" reglog is loaded ");
- print("|------------------------------|\n\n");
- return 1;
- }
- hook OnPlayerConnect(playerid) {
- if(fexist(UserPath(playerid))) {
- INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra=true, .extra=playerid);
- 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");
- }
- 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment