Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define ACC Account(playerid)
- stock GetName(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- return name;
- }
- stock Account(playerid)
- {
- new path[200];
- format(path,200,"Users/%s.ini",GetName(playerid));
- return path;
- }
- stock GetIP(playerid)
- {
- new ip[16];
- GetPlayerIp(playerid,ip,sizeof(ip));
- return ip;
- }
- enum dialogs
- {
- DIALOG_NONE,//0
- DIALOG_LOGIN,//1
- DIALOG_REGISTER,//2
- DIALOG_UCET,//ATD
- DIALOG_CHANGEPASS,
- DIALOG_CHANGEIP,
- DIALOG_CHANGEPASS2,
- DIALOG_UCETINFO,
- DIALOG_SKYPE,
- }
- enum DriveLicenceTypes//Není hotovo
- {
- dA,//Normal auta
- dB,//Nakladaky, vetsi auta
- dC,//Autobusy
- dAirvehicles
- }
- enum pDATA
- {
- pZabiti,
- pUmrti,
- pAdminLevel,
- pMoney,
- pMoneyInBank,
- pIP,
- Float:pX,
- Float:pY,
- Float:pZ,
- pSkin,
- Float:pHP,
- Float:pAR,
- DriveLicence[DriveLicenceTypes]
- }
- new PlayerData[MAX_PLAYERS][pDATA];
- new PlayerWeapon[MAX_PLAYERS][13][2];
- public OnPlayerConnect(playerid)
- {
- if(DOF2_FileExists(Account(playerid)))
- {
- if(strmatch(GetIP(playerid),DOF2_GetString(Account(playerid),"IP")))
- {
- PlayerData[playerid][pZabiti] = DOF2_GetInt(Account(playerid),"Zabiti","Informace");
- PlayerData[playerid][pUmrti] = DOF2_GetInt(Account(playerid),"Umrti","Informace");
- PlayerData[playerid][pAdminLevel] = DOF2_GetInt(Account(playerid),"AdminLevel","Informace");
- PlayerData[playerid][pMoney] = DOF2_GetInt(Account(playerid),"Money","Penize");
- PlayerData[playerid][pMoneyInBank] = DOF2_GetInt(Account(playerid),"MoneyInBank","Informace");
- PlayerData[playerid][pX] = DOF2_GetFloat(Account(playerid),"X","Pozice");
- PlayerData[playerid][pY] = DOF2_GetFloat(Account(playerid),"Y","Pozice");
- PlayerData[playerid][pZ] = DOF2_GetFloat(Account(playerid),"Z","Pozice");
- PlayerData[playerid][pHP] = DOF2_GetFloat(Account(playerid),"HP","Informace");
- PlayerData[playerid][pAR] = DOF2_GetFloat(Account(playerid),"ARMOR","Informace");
- PlayerData[playerid][pSkin] = DOF2_GetInt(Account(playerid),"Skin","Informace");
- GivePlayerMoney(playerid,PlayerData[playerid][pMoney]);
- for(new i=0;i<13;i++)
- {
- new strwep[50];
- format(strwep,50,"Weapon%d",i);
- new strwep2[50];
- format(strwep2,50,"Ammo%d",i);
- PlayerWeapon[playerid][i][0] = DOF2_GetInt(Account(playerid),strwep,"WeaponsData");
- PlayerWeapon[playerid][i][1] = DOF2_GetInt(Account(playerid),strwep2,"WeaponsData");
- }
- SendClientMessage(playerid,C_ERROR,""r"["inf"ParadoxGames"r"] "g"AutoLogin: "w"Byl jsi automaticky přihlášen.");
- }
- else
- {
- SendClientMessage(playerid,C_ERROR,""r"["inf"ParadoxGames"r"] "g"AutoLogin: "w"Automatické přihlášení se nezdařilo prosím zadej heslo manuálně.");
- ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"[ParadoxGames] Life : Login","Vítej zpět!\n\n\tPravidla:\n{FFFFFF}1. {0055FF}Nemluvit sprostě\n{FFFFFF}2. {0055FF}Nezabijet na spawnu\n{FFFFFF}3.{0055FF} Dodržovat pravidla\n\nPřejeme příjemnou hru.","Login","Odejít");
- }
- }
- else
- {
- ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_PASSWORD,"[ParadoxGames] Life : Register","Vítej pro hraní na tomto serveru se musíš zaregistrovat.\n\n\tPravidla:\n{FFFFFF}1. {0055FF}Nemluvit sprostě\n{FFFFFF}2. {0055FF}Nezabijet na spawnu\n{FFFFFF}3.{0055FF} Dodržovat pravidla\n\nPřejeme příjemnou hru.","Zaregistrovat","Odejít");
- }
- SetTimerEx("Autosave",1000*60*15,true,"inf",playerid);
- return 1;
- }
- public Autosave(playerid)
- {
- GetPlayerPos(playerid,PlayerData[playerid][pX],PlayerData[playerid][pY],PlayerData[playerid][pZ]);
- GetPlayerHealth(playerid,PlayerData[playerid][pHP]);
- GetPlayerArmour(playerid,PlayerData[playerid][pAR]);
- PlayerData[playerid][pSkin] = GetPlayerSkin(playerid);
- PlayerData[playerid][pMoney] = GetPlayerMoney(playerid);
- DOF2_SetInt(Account(playerid),"Zabiti",PlayerData[playerid][pZabiti],"Informace");
- DOF2_SetInt(Account(playerid),"Umrti",PlayerData[playerid][pUmrti],"Informace");
- DOF2_SetInt(Account(playerid),"AdminLevel",PlayerData[playerid][pAdminLevel],"Informace");
- DOF2_SetInt(Account(playerid),"Money",PlayerData[playerid][pMoney],"Penize");
- DOF2_SetInt(Account(playerid),"MoneyInBank",PlayerData[playerid][pMoneyInBank],"Penize");
- DOF2_SetFloat(Account(playerid),"X",PlayerData[playerid][pX],"Pozice");
- DOF2_SetFloat(Account(playerid),"Y",PlayerData[playerid][pY],"Pozice");
- DOF2_SetFloat(Account(playerid),"Z",PlayerData[playerid][pZ],"Pozice");
- DOF2_SetFloat(Account(playerid),"HP",PlayerData[playerid][pHP],"Informace");
- DOF2_SetFloat(Account(playerid),"ARMOR",PlayerData[playerid][pAR],"Informace");
- DOF2_SetInt(Account(playerid),"Skin",PlayerData[playerid][pSkin],"Informace");
- for (new i = 0; i < 13; i++)
- {
- GetPlayerWeaponData(playerid, i, PlayerWeapon[playerid][i][0], PlayerWeapon[playerid][i][1]);
- new strwep[50];
- format(strwep,50,"Weapon%d",i);
- new strwep2[50];
- format(strwep2,50,"Ammo%d",i);
- DOF2_SetInt(Account(playerid),strwep,PlayerWeapon[playerid][i][0],"WeaponsData");
- DOF2_SetInt(Account(playerid),strwep2,PlayerWeapon[playerid][i][1],"WeaponsData");
- }
- GivePlayerMoney(playerid,PlayerData[playerid][pMoney]);
- DOF2_SaveFile();
- return true;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- GetPlayerPos(playerid,PlayerData[playerid][pX],PlayerData[playerid][pY],PlayerData[playerid][pZ]);
- GetPlayerHealth(playerid,PlayerData[playerid][pHP]);
- GetPlayerArmour(playerid,PlayerData[playerid][pAR]);
- PlayerData[playerid][pSkin] = GetPlayerSkin(playerid);
- PlayerData[playerid][pMoney] = GetPlayerMoney(playerid);
- DOF2_SetInt(Account(playerid),"Zabiti",PlayerData[playerid][pZabiti],"Informace");
- DOF2_SetInt(Account(playerid),"Umrti",PlayerData[playerid][pUmrti],"Informace");
- DOF2_SetInt(Account(playerid),"AdminLevel",PlayerData[playerid][pAdminLevel],"Informace");
- DOF2_SetInt(Account(playerid),"Money",PlayerData[playerid][pMoney],"Penize");
- DOF2_SetInt(Account(playerid),"MoneyInBank",PlayerData[playerid][pMoneyInBank],"Penize");
- DOF2_SetFloat(Account(playerid),"X",PlayerData[playerid][pX],"Pozice");
- DOF2_SetFloat(Account(playerid),"Y",PlayerData[playerid][pY],"Pozice");
- DOF2_SetFloat(Account(playerid),"Z",PlayerData[playerid][pZ],"Pozice");
- DOF2_SetFloat(Account(playerid),"HP",PlayerData[playerid][pHP],"Informace");
- DOF2_SetFloat(Account(playerid),"ARMOR",PlayerData[playerid][pAR],"Informace");
- DOF2_SetInt(Account(playerid),"Skin",PlayerData[playerid][pSkin],"Informace");
- for (new i = 0; i < 13; i++)
- {
- GetPlayerWeaponData(playerid, i, PlayerWeapon[playerid][i][0], PlayerWeapon[playerid][i][1]);
- new strwep[50];
- format(strwep,50,"Weapon%d",i);
- new strwep2[50];
- format(strwep2,50,"Ammo%d",i);
- DOF2_SetInt(Account(playerid),strwep,PlayerWeapon[playerid][i][0],"WeaponsData");
- DOF2_SetInt(Account(playerid),strwep2,PlayerWeapon[playerid][i][1],"WeaponsData");
- }
- GivePlayerMoney(playerid,PlayerData[playerid][pMoney]);
- DOF2_SaveFile();
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetSpawnInfo(playerid,0,PlayerData[playerid][pSkin],PlayerData[playerid][pX],PlayerData[playerid][pY],PlayerData[playerid][pZ],0,0,0,0,0,0,0);
- SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- for(new i=0;i<13;i++)
- {
- GivePlayerWeapon(playerid,PlayerWeapon[playerid][i][0],PlayerWeapon[playerid][i][1]);
- }
- SetTimerEx("SpawnProtect",5000,false,"inf",playerid);
- SetPlayerHealth(playerid,100000000);
- return 1;
- }
- public SpawnProtect(playerid)
- {
- SetPlayerHealth(playerid,DOF2_GetFloat(Account(playerid),"HP","Informace"));
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- SetPosFromFile[playerid] = false;
- SendDeathMessage(killerid,playerid,reason);
- PlayerData[playerid][pUmrti]++;
- PlayerData[killerid][pZabiti]++;
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch(dialogid)
- {
- case DIALOG_REGISTER:
- {
- if(!response) return Kick(playerid);
- if(response)
- {
- DOF2_CreateFile(Account(playerid),inputtext);
- DOF2_SetInt(Account(playerid),"Zabiti",0,"Informace");
- DOF2_SetInt(Account(playerid),"Umrti",0,"Informace");
- DOF2_SetInt(Account(playerid),"AdminLevel",0,"Informace");
- DOF2_SetInt(Account(playerid),"Money",0,"Penize");
- DOF2_SetInt(Account(playerid),"MoneyInBank",0,"Penize");
- DOF2_SetFloat(Account(playerid),"X",0,"Pozice");
- DOF2_SetFloat(Account(playerid),"Y",0,"Pozice");
- DOF2_SetFloat(Account(playerid),"Z",0,"Pozice");
- DOF2_SetFloat(Account(playerid),"HP",100,"Informace");
- DOF2_SetFloat(Account(playerid),"ARMOR",0,"Informace");
- DOF2_SetString(Account(playerid),"IP",GetIP(playerid));
- DOF2_SetInt(Account(playerid),"Skin",0,"Informace");
- DOF2_SaveFile();
- GivePlayerMoney(playerid,10000);
- ShowPlayerDialog(playerid,DIALOG_SKYPE,DIALOG_STYLE_INPUT,"[ParadoxGames] Dokončení registrace",""w"Pokud máte skype účet nebo email na který bychom vás mohli kontaktovat neváhejte a zadejteho.\n Na váš skype/email nebudou chodit žádné spamy kontaktní udaje potřebujeme pro řešení případných problémů.\n "r"(Nepoviné)","Zadat","Odejít");
- }
- return 1;
- }
- case DIALOG_SKYPE:
- {
- DOF2_SetString(Account(playerid),"Skype/Email",inputtext,"Informace");
- DOF2_SaveFile();
- return 1;
- }
- case DIALOG_LOGIN:
- {
- if(!response) return Kick(playerid);
- if(response)
- {
- if(DOF2_CheckLogin(Account(playerid),inputtext))
- {
- PlayerData[playerid][pZabiti] = DOF2_GetInt(Account(playerid),"Zabiti","Informace");
- PlayerData[playerid][pUmrti] = DOF2_GetInt(Account(playerid),"Umrti","Informace");
- PlayerData[playerid][pAdminLevel] = DOF2_GetInt(Account(playerid),"AdminLevel","Informace");
- PlayerData[playerid][pMoney] = DOF2_GetInt(Account(playerid),"Money","Penize");
- PlayerData[playerid][pMoneyInBank] = DOF2_GetInt(Account(playerid),"MoneyInBank","Informace");
- PlayerData[playerid][pX] = DOF2_GetFloat(Account(playerid),"X","Pozice");
- PlayerData[playerid][pY] = DOF2_GetFloat(Account(playerid),"Y","Pozice");
- PlayerData[playerid][pZ] = DOF2_GetFloat(Account(playerid),"Z","Pozice");
- PlayerData[playerid][pHP] = DOF2_GetFloat(Account(playerid),"HP","Informace");
- PlayerData[playerid][pAR] = DOF2_GetFloat(Account(playerid),"ARMOR","Informace");
- PlayerData[playerid][pSkin] = DOF2_GetInt(Account(playerid),"Skin","Informace");
- for(new i=0;i<13;i++)
- {
- new wepdata[50];
- format(wepdata,50,"Weapon%d",i);
- new wepdata2[50];
- format(wepdata2,50,"Ammo%d",i);
- PlayerWeapon[playerid][i][0] = DOF2_GetInt(Account(playerid),wepdata,"WeaponsData");
- PlayerWeapon[playerid][i][1] = DOF2_GetInt(Account(playerid),wepdata2,"WeaponsData");
- GivePlayerWeapon(playerid,PlayerWeapon[playerid][i][0],PlayerWeapon[playerid][i][1]);
- }
- }
- else
- {
- ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"[ParadoxGames] Life : Login",""g"Vítej zpět!\n\n"r"Pravidla:\n\t"r"1."inf" {0055FF}Nemluvit sprostě\n\t"r"2. "inf"Nezabijet na spawnu\n\t3. "inf"Dodržovat pravidla\n\nPřejeme příjemnou hru.\n"r"Zadal jsi špatné heslo.","Login","Odejít");
- }
- }
- return 1;
- }
- case DIALOG_UCET:
- {
- if(response)
- {
- switch(listitem)
- {
- case 0://Změnit heslo
- {
- ShowPlayerDialog(playerid,DIALOG_CHANGEPASS,DIALOG_STYLE_INPUT,"[ParadoxGames] Změnit heslo",""inf"Napiš svoje "r"staré heslo:","Potvrdit","Zpět");
- return 1;
- }
- case 1://Změnit IP
- {
- ShowPlayerDialog(playerid,DIALOG_CHANGEIP,DIALOG_STYLE_MSGBOX,"[ParadoxGames] Změnit heslo",""inf"Opravdu chceš změnit IP ?\n"r"Možná potom nebude fungovat autologin.","Potvrdit","Zpět");
- return 1;
- }
- }
- }
- return 1;
- }
- case DIALOG_CHANGEPASS:
- {
- if(!response) return ShowPlayerDialog(playerid,DIALOG_UCET,DIALOG_STYLE_LIST,"[ParadoxGames] Účet","Změnit heslo.\nZměnit IP","Vybrat","Odejít");
- if(response)
- {
- if(DOF2_CheckLogin(Account(playerid),inputtext))
- {
- ShowPlayerDialog(playerid,DIALOG_CHANGEPASS2,DIALOG_STYLE_INPUT,"[ParadoxGames] Změnit heslo","Napiš svoje nové heslo:","Potvrdit","Zpět");
- }
- else
- {
- SendClientMessage(playerid,C_ERROR,""r"["inf"ParadoxGames] "g"Změna hesla: "w"Zadané heslo neodpovídá heslo zadaném při registraci.");
- }
- }
- return 1;
- }
- case DIALOG_CHANGEIP:
- {
- if(!response) return ShowPlayerDialog(playerid,DIALOG_UCET,DIALOG_STYLE_LIST,"[ParadoxGames] Účet","Změnit heslo.\nZměnit IP","Vybrat","Odejít");
- if(response)
- {
- DOF2_SetString(Account(playerid),"IP",GetIP(playerid));
- DOF2_SaveFile();
- new str[100];
- format(str,100,""r"["inf"ParadoxGames"r"] "g"Účet: "w"Změna vaší IP proběhla úspěšně. Vaše nová IP je - %s",GetIP(playerid));
- SendClientMessage(playerid,C_SUCCES,str);
- }
- }
- case DIALOG_CHANGEPASS2:
- {
- DOF2_RemoveFile(Account(playerid));
- DOF2_CreateFile(Account(playerid),inputtext);
- DOF2_SetInt(Account(playerid),"Zabiti",PlayerData[playerid][pZabiti],"Informace");
- DOF2_SetInt(Account(playerid),"Umrti",PlayerData[playerid][pUmrti],"Informace");
- DOF2_SetInt(Account(playerid),"AdminLevel",PlayerData[playerid][pAdminLevel],"Informace");
- DOF2_SetInt(Account(playerid),"Money",PlayerData[playerid][pMoney],"Penize");
- DOF2_SetInt(Account(playerid),"MoneyInBank",PlayerData[playerid][pMoneyInBank],"Penize");
- DOF2_SetFloat(Account(playerid),"X",PlayerData[playerid][pX],"Pozice");
- DOF2_SetFloat(Account(playerid),"Y",PlayerData[playerid][pY],"Pozice");
- DOF2_SetFloat(Account(playerid),"Z",PlayerData[playerid][pZ],"Pozice");
- DOF2_SetFloat(Account(playerid),"HP",PlayerData[playerid][pHP],"Informace");
- DOF2_SetFloat(Account(playerid),"ARMOR",PlayerData[playerid][pAR],"Informace");
- DOF2_SetInt(Account(playerid),"Skin",PlayerData[playerid][pSkin],"Informace");
- DOF2_SaveFile();
- new str[100];
- format(str,100,""r"["inf"ParadoxGames"r"] "g"Účet: "w"Změna hesla proběhla úspěšně. Vaše nové heslo je - %s",inputtext);
- SendClientMessage(playerid,C_SUCCES,str);
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement