Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define PATH "/Nalozi/%s.ini"
- forward LoadUser_data(playerid,name[],value[]);
- stock UserPath(playerid)
- {
- new string[128],pn[MAX_PLAYER_NAME];
- GetPlayerName(playerid,pn,sizeof(pn));
- format(string,sizeof(string),PATH,pn);
- return string;
- }
- enum pData
- {
- Lozinka,
- Administrator,
- VIP,
- Cash,
- Level,
- Godine,
- Pol,
- Drzavljanstvo,
- ORG,
- ORGRank,
- Banovan,
- Skin,
- BankCash,
- Float:x,
- Float:y,
- Float:z,
- Float:a,
- ////////////////////////////////////////////////////////////////////////////////
- Ulogovan
- };
- new PlayerData[MAX_PLAYERS][pData];
- //============================================================================ >OnPlayerConnect
- public OnPlayerConnect(playerid)
- {
- SCM(playerid, ZUTA,"SERVER:Ucitavanje podataka iz nase baze, molimo da pricekate!");
- TogglePlayerSpectating(playerid, true);
- //------------------------------------------------------------------------------
- if(fexist(UserPath(playerid)))
- {
- INI_ParseFile(UserPath(playerid),"LoadUser_%s",.bExtra = true,.extra = playerid);
- SPD(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,""svetloplava"Login:",""plava"Molimo vas da unesete vasu lozinku!","Potvrdi","X");
- }
- else
- {
- SPD(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,""svetloplava"Register",""plava"Molimo vas da se registrujete tako sto cete uneti vasu sifru!","Potvrdi","X");
- }
- }
- //============================================================================ >OnPlayerDisconnect
- public OnPlayerDisconnect(playerid, reason)
- {
- new Float:posx, Float:posy, Float:posz, Float:posa; GetPlayerPos(playerid, posx, posy, posz); GetPlayerFacingAngle(playerid, posa);
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File,"data");
- INI_WriteInt(File,"Novac",GetPlayerMoney(playerid));
- INI_WriteInt(File,"Sifra",PlayerData[playerid][Lozinka]);
- INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
- INI_WriteInt(File,"Level",GetPlayerScore(playerid));
- INI_WriteInt(File,"Admin",PlayerData[playerid][Administrator]);
- INI_WriteInt(File,"Drzava",PlayerData[playerid][Drzavljanstvo]);
- INI_WriteInt(File,"Pol",PlayerData[playerid][Pol]);
- INI_WriteInt(File,"Godine",PlayerData[playerid][Godine]);
- INI_WriteInt(File,"VIP",PlayerData[playerid][VIP]);
- INI_WriteInt(File,"ORG",PlayerData[playerid][ORG]);
- INI_WriteInt(File,"Rank",PlayerData[playerid][ORGRank]);
- INI_WriteInt(File,"Banovan",PlayerData[playerid][Banovan]);
- INI_WriteInt(File,"Banka novac",PlayerData[playerid][BankCash]);
- INI_WriteFloat(File,"x",posx);
- INI_WriteFloat(File,"y",posy);
- INI_WriteFloat(File,"z",posz);
- INI_WriteFloat(File,"a",posa);
- INI_Close(File);
- return 1;
- }
- //============================================================================ >OnDialogResponse
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch(dialogid)
- {
- case DIALOG_REGISTER:
- {
- if(!response) return Kick(playerid);
- if(response)
- {
- PlayerData[playerid][Ulogovan] = 0;
- if(!strlen(inputtext)) return SPD(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,""svetloplava"Registracija:",""plava"Nevazeca sifra,upisite novu!","Potvrdi","X");
- PlayerData[playerid][Lozinka] = udb_hash(inputtext);
- ShowPlayerDialog(playerid, DIALOG_POL, DIALOG_STYLE_LIST,""svetloplava"Registracija:"""plava" Molimo vas da izaberete vas pol:","Musko \n Zensko","Potvrdi","X");
- }
- }
- case DIALOG_LOGIN:
- {
- if(!response) return Kick(playerid);
- if(response)
- {
- PlayerData[playerid][Ulogovan] = 0;
- if(udb_hash(inputtext) == PlayerData[playerid][Lozinka])
- {
- INI_ParseFile(UserPath(playerid),"LoadUser_%s",.bExtra = true,.extra = playerid);
- SpawnPlayer(playerid);
- GivePlayerMoney(playerid, PlayerData[playerid][Cash]);
- SetPlayerScore(playerid,PlayerData[playerid][Level]);
- SetPlayerPos(playerid,PlayerData[playerid][x],PlayerData[playerid][y],PlayerData[playerid][z]);
- SetPlayerFacingAngle(playerid, PlayerData[playerid][a]);
- TogglePlayerSpectating(playerid, false);
- PlayerData[playerid][Ulogovan] = 1;
- }
- else
- {
- SPD(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,""svetloplava"Login:",""crvena"Upisali ste pogresnu lozinku!","Potvrdi","X");
- }
- }
- }
- case DIALOG_POL:
- {
- if(!response) return Kick(playerid);
- if(response)
- {
- if(listitem == 0)
- {
- PlayerData[playerid][Pol] = 0;
- SCM(playerid, ZELENA,"Ok, vi ste musko");
- }
- if(listitem == 1)
- {
- PlayerData[playerid][Pol] = 1;
- SCM(playerid, ZELENA,"Ok, vi ste zensko");
- }
- SPD(playerid, DIALOG_GODINE, DIALOG_STYLE_INPUT,""svetloplava"Registracija:",""plava"Upisite vase godine:","Potvrdi","X");
- }
- }
- case DIALOG_GODINE:
- {
- if(!response) return Kick(playerid);
- if(response)
- {
- new godine = strval(inputtext);
- new txt[40];
- if(godine < 7) return SPD(playerid, DIALOG_GODINE, DIALOG_STYLE_INPUT,""svetloplava"Registracija:",""crvena"Vase godine nemogu biti manje od 7","Potvrdi","X");
- if(godine > MAX_GOD) return SPD(playerid, DIALOG_GODINE, DIALOG_STYLE_INPUT,""svetloplava"Registracija:",""crvena"Vase godine nemogu biti vece od 65","Potvrdi","X");
- PlayerData[playerid][Godine] = godine;
- format(txt,sizeof(txt),"Ok,Idemo na dialog drzavljanstva!");
- SCM(playerid, ZELENA,txt);
- SPD(playerid, DIALOG_DRZAVLJANSTVO, DIALOG_STYLE_LIST,""svetloplava"Registracija - "plava"Izaberite vase drzavljanstvo","Srbija \n Hrvatska \n Bosna i Herzegovina \n Crna Gora \n Makedonija \n Slovenija \n Ostalo","Potvrdi","X");
- }
- }
- case DIALOG_DRZAVLJANSTVO:
- {
- if(!response) return Kick(playerid);
- if(response)
- {
- if(listitem == 0)
- {
- PlayerData[playerid][Drzavljanstvo] = 0; //SRB
- SCM(playerid, ZELENA,"Ok,Iz Srbije ste");
- }
- if(listitem == 1)
- {
- PlayerData[playerid][Drzavljanstvo] = 1; //HR
- SCM(playerid, ZELENA,"Ok,Iz Hrvatske ste");
- }
- if(listitem == 2)
- {
- PlayerData[playerid][Drzavljanstvo] = 2; //BIH
- SCM(playerid, ZELENA,"Ok,Iz BIH ste");
- }
- if(listitem == 3)
- {
- PlayerData[playerid][Drzavljanstvo] = 3; //CG
- SCM(playerid, ZELENA,"Ok,Iz Crne Gore ste");
- }
- if(listitem == 4)
- {
- PlayerData[playerid][Drzavljanstvo] = 4; //MK
- SCM(playerid, ZELENA,"Ok,Iz Makedonije ste");
- }
- if(listitem == 5)
- {
- PlayerData[playerid][Drzavljanstvo] = 5; //SLO
- SCM(playerid, ZELENA,"Ok,Iz Slovenije ste");
- }
- if(listitem == 6)
- {
- PlayerData[playerid][Drzavljanstvo] = 6; //OST
- }
- if(PlayerData[playerid][Pol] == 0) { PlayerData[playerid][Skin] = 22; }
- if(PlayerData[playerid][Pol] == 1) { PlayerData[playerid][Skin] = 56; }
- SPD(playerid, DIALOG_DOBRODOSLICA, DIALOG_STYLE_MSGBOX,""svetloplava"Registracija - Uspesna",""bela"Uzivajte igrajuci na serveru zeli vam \n "zelena" FH:RP STAFF TEAM!","Nastavi","");
- SetSpawnInfo( playerid, 0, PlayerData[playerid][Skin], 2351.3213,-36.1563,26.4844,56.5654, 0, 0, 0, 0, 0, 0 );
- SpawnPlayer(playerid);
- for(new i; i < 20; i++)
- {
- SendClientMessage(playerid, -1," ");
- }
- SCM(playerid, ZUTA,"Cilj nam je da nam server bude sto unikatniji!");
- SCM(playerid, ZUTA,"Ukoliko ste novi i potrebna vam je pomoc ukucajte /novi");
- SCM(playerid, ZUTA,"Ukoliko zelite da postavite pitanje ukucajte /pitaj");
- SCM(playerid, ZUTA,"Za pocetak dobijate 350$");
- GivePlayerMoney(playerid, 350);
- PlayerData[playerid][Ulogovan] = 1;
- return 1;
- }
- }
- case DIALOG_DOBRODOSLICA:
- {
- if(response)
- {
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File,"data");
- INI_WriteInt(File,"Sifra",PlayerData[playerid][Lozinka]);
- INI_WriteInt(File,"Novac",0);
- INI_WriteInt(File,"Skin",0);
- INI_WriteInt(File,"Level",0);
- INI_WriteInt(File,"Admin",0);
- INI_WriteInt(File,"VIP",0);
- INI_WriteInt(File,"ORG",-1);
- INI_WriteInt(File,"Rank",-1);
- INI_WriteInt(File,"Banovan",0);
- INI_WriteInt(File,"Banka novac",0);
- INI_WriteFloat(File,"x",0);
- INI_WriteFloat(File,"y",0);
- INI_WriteFloat(File,"z",0);
- INI_WriteFloat(File,"a",0);
- INI_Close(File);
- TogglePlayerSpectating(playerid, false);
- }
- }
- }
- return 1;
- }
- //============================================================================ >OnPlayerSpawn
- public OnPlayerSpawn(playerid)
- {
- SetPlayerSkin(playerid,PlayerData[playerid][Skin]);
- return 1;
- }
- //============================================================================ >Dodatni public-i
- public LoadUser_data(playerid,name[],value[])
- {
- INI_Int("Sifra",PlayerData[playerid][Lozinka]);
- INI_Int("Godine",PlayerData[playerid][Godine]);
- INI_Int("Novac",PlayerData[playerid][Cash]);
- INI_Int("Skin",PlayerData[playerid][Skin]);
- INI_Int("Level",PlayerData[playerid][Level]);
- INI_Int("Admin",PlayerData[playerid][Administrator]);
- INI_Int("VIP",PlayerData[playerid][VIP]);
- INI_Int("Godine",PlayerData[playerid][Godine]);
- INI_Int("Drzava",PlayerData[playerid][Drzavljanstvo]);
- INI_Int("Pol",PlayerData[playerid][Pol]);
- INI_Int("ORG",PlayerData[playerid][ORG]);
- INI_Int("Rank",PlayerData[playerid][ORGRank]);
- INI_Int("Banovan",PlayerData[playerid][Banovan]);
- INI_Int("Banka novac",PlayerData[playerid][BankCash]);
- INI_Float("x",PlayerData[playerid][x]);
- INI_Float("y",PlayerData[playerid][y]);
- INI_Float("z",PlayerData[playerid][z]);
- INI_Float("a",PlayerData[playerid][a]);
- return 1;
- }
- //PS:Imam sve defines ostale itd.
Advertisement
Add Comment
Please, Sign In to add comment