Guest User

Untitled

a guest
Jan 29th, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 10.11 KB | None | 0 0
  1. #define PATH "/Nalozi/%s.ini"
  2. forward LoadUser_data(playerid,name[],value[]);
  3. stock UserPath(playerid)
  4. {
  5.     new string[128],pn[MAX_PLAYER_NAME];
  6.     GetPlayerName(playerid,pn,sizeof(pn));
  7.     format(string,sizeof(string),PATH,pn);
  8.     return string;
  9. }
  10.  
  11. enum pData
  12. {
  13.     Lozinka,
  14.     Administrator,
  15.     VIP,
  16.     Cash,
  17.     Level,
  18.     Godine,
  19.     Pol,
  20.     Drzavljanstvo,
  21.     ORG,
  22.     ORGRank,
  23.     Banovan,
  24.     Skin,
  25.     BankCash,
  26.     Float:x,
  27.     Float:y,
  28.     Float:z,
  29.     Float:a,
  30. ////////////////////////////////////////////////////////////////////////////////
  31.     Ulogovan
  32. };
  33. new PlayerData[MAX_PLAYERS][pData];
  34. //============================================================================ >OnPlayerConnect
  35. public OnPlayerConnect(playerid)
  36. {
  37.     SCM(playerid, ZUTA,"SERVER:Ucitavanje podataka iz nase baze, molimo da pricekate!");
  38.     TogglePlayerSpectating(playerid, true);
  39. //------------------------------------------------------------------------------
  40.     if(fexist(UserPath(playerid)))
  41.     {
  42.         INI_ParseFile(UserPath(playerid),"LoadUser_%s",.bExtra = true,.extra = playerid);
  43.         SPD(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,""svetloplava"Login:",""plava"Molimo vas da unesete vasu lozinku!","Potvrdi","X");
  44.     }
  45.     else
  46.     {
  47.         SPD(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,""svetloplava"Register",""plava"Molimo vas da se registrujete tako sto cete uneti vasu sifru!","Potvrdi","X");
  48.     }
  49. }
  50. //============================================================================ >OnPlayerDisconnect
  51. public OnPlayerDisconnect(playerid, reason)
  52. {
  53.     new Float:posx, Float:posy, Float:posz, Float:posa; GetPlayerPos(playerid, posx, posy, posz); GetPlayerFacingAngle(playerid, posa);
  54.     new INI:File = INI_Open(UserPath(playerid));
  55.     INI_SetTag(File,"data");
  56.     INI_WriteInt(File,"Novac",GetPlayerMoney(playerid));
  57.     INI_WriteInt(File,"Sifra",PlayerData[playerid][Lozinka]);
  58.     INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
  59.     INI_WriteInt(File,"Level",GetPlayerScore(playerid));
  60.     INI_WriteInt(File,"Admin",PlayerData[playerid][Administrator]);
  61.     INI_WriteInt(File,"Drzava",PlayerData[playerid][Drzavljanstvo]);
  62.     INI_WriteInt(File,"Pol",PlayerData[playerid][Pol]);
  63.     INI_WriteInt(File,"Godine",PlayerData[playerid][Godine]);
  64.     INI_WriteInt(File,"VIP",PlayerData[playerid][VIP]);
  65.     INI_WriteInt(File,"ORG",PlayerData[playerid][ORG]);
  66.     INI_WriteInt(File,"Rank",PlayerData[playerid][ORGRank]);
  67.     INI_WriteInt(File,"Banovan",PlayerData[playerid][Banovan]);
  68.     INI_WriteInt(File,"Banka novac",PlayerData[playerid][BankCash]);
  69.     INI_WriteFloat(File,"x",posx);
  70.     INI_WriteFloat(File,"y",posy);
  71.     INI_WriteFloat(File,"z",posz);
  72.     INI_WriteFloat(File,"a",posa);
  73.     INI_Close(File);
  74.     return 1;
  75. }
  76. //============================================================================ >OnDialogResponse
  77. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  78. {
  79.     switch(dialogid)
  80.     {
  81.         case DIALOG_REGISTER:
  82.         {
  83.             if(!response) return Kick(playerid);
  84.             if(response)
  85.             {
  86.                 PlayerData[playerid][Ulogovan] = 0;
  87.                 if(!strlen(inputtext)) return SPD(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,""svetloplava"Registracija:",""plava"Nevazeca sifra,upisite novu!","Potvrdi","X");
  88.                 PlayerData[playerid][Lozinka] = udb_hash(inputtext);
  89.                 ShowPlayerDialog(playerid, DIALOG_POL, DIALOG_STYLE_LIST,""svetloplava"Registracija:"""plava" Molimo vas da izaberete vas pol:","Musko \n Zensko","Potvrdi","X");
  90.             }
  91.         }
  92.         case DIALOG_LOGIN:
  93.         {
  94.             if(!response) return Kick(playerid);
  95.             if(response)
  96.             {
  97.                 PlayerData[playerid][Ulogovan] = 0;
  98.                 if(udb_hash(inputtext) == PlayerData[playerid][Lozinka])
  99.                 {
  100.                     INI_ParseFile(UserPath(playerid),"LoadUser_%s",.bExtra = true,.extra = playerid);
  101.                     SpawnPlayer(playerid);
  102.                     GivePlayerMoney(playerid, PlayerData[playerid][Cash]);
  103.                     SetPlayerScore(playerid,PlayerData[playerid][Level]);
  104.                     SetPlayerPos(playerid,PlayerData[playerid][x],PlayerData[playerid][y],PlayerData[playerid][z]);
  105.                     SetPlayerFacingAngle(playerid, PlayerData[playerid][a]);
  106.                     TogglePlayerSpectating(playerid, false);
  107.                     PlayerData[playerid][Ulogovan] = 1;
  108.                 }
  109.                 else
  110.                 {
  111.                     SPD(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,""svetloplava"Login:",""crvena"Upisali ste pogresnu lozinku!","Potvrdi","X");
  112.                 }
  113.             }
  114.         }
  115.         case DIALOG_POL:
  116.         {
  117.             if(!response) return Kick(playerid);
  118.             if(response)
  119.             {
  120.                 if(listitem == 0)
  121.                 {
  122.                     PlayerData[playerid][Pol] = 0;
  123.                     SCM(playerid, ZELENA,"Ok, vi ste musko");
  124.                 }
  125.                 if(listitem == 1)
  126.                 {
  127.                     PlayerData[playerid][Pol] = 1;
  128.                     SCM(playerid, ZELENA,"Ok, vi ste zensko");
  129.                 }
  130.                 SPD(playerid, DIALOG_GODINE, DIALOG_STYLE_INPUT,""svetloplava"Registracija:",""plava"Upisite vase godine:","Potvrdi","X");
  131.             }
  132.         }
  133.         case DIALOG_GODINE:
  134.         {
  135.             if(!response) return Kick(playerid);
  136.             if(response)
  137.             {
  138.                 new godine = strval(inputtext);
  139.                 new txt[40];
  140.                 if(godine < 7) return SPD(playerid, DIALOG_GODINE, DIALOG_STYLE_INPUT,""svetloplava"Registracija:",""crvena"Vase godine nemogu biti manje od 7","Potvrdi","X");
  141.                 if(godine > MAX_GOD) return SPD(playerid, DIALOG_GODINE, DIALOG_STYLE_INPUT,""svetloplava"Registracija:",""crvena"Vase godine nemogu biti vece od 65","Potvrdi","X");
  142.                 PlayerData[playerid][Godine] = godine;
  143.                 format(txt,sizeof(txt),"Ok,Idemo na dialog drzavljanstva!");
  144.                 SCM(playerid, ZELENA,txt);
  145.                 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");
  146.             }
  147.         }
  148.                 case DIALOG_DRZAVLJANSTVO:
  149.         {
  150.             if(!response) return Kick(playerid);
  151.             if(response)
  152.             {
  153.                 if(listitem == 0)
  154.                 {
  155.                     PlayerData[playerid][Drzavljanstvo] = 0; //SRB
  156.                     SCM(playerid, ZELENA,"Ok,Iz Srbije ste");
  157.                 }
  158.                 if(listitem == 1)
  159.                 {
  160.                     PlayerData[playerid][Drzavljanstvo] = 1; //HR
  161.                     SCM(playerid, ZELENA,"Ok,Iz Hrvatske ste");
  162.                 }
  163.                 if(listitem == 2)
  164.                 {
  165.                     PlayerData[playerid][Drzavljanstvo] = 2; //BIH
  166.                     SCM(playerid, ZELENA,"Ok,Iz BIH ste");
  167.                 }
  168.                 if(listitem == 3)
  169.                 {
  170.                     PlayerData[playerid][Drzavljanstvo] = 3; //CG
  171.                     SCM(playerid, ZELENA,"Ok,Iz Crne Gore ste");
  172.                 }
  173.                 if(listitem == 4)
  174.                 {
  175.                     PlayerData[playerid][Drzavljanstvo] = 4; //MK
  176.                     SCM(playerid, ZELENA,"Ok,Iz Makedonije ste");
  177.                 }
  178.                 if(listitem == 5)
  179.                 {
  180.                     PlayerData[playerid][Drzavljanstvo] = 5; //SLO
  181.                     SCM(playerid, ZELENA,"Ok,Iz Slovenije ste");
  182.                 }
  183.                 if(listitem == 6)
  184.                 {
  185.                     PlayerData[playerid][Drzavljanstvo] = 6; //OST
  186.                 }
  187.                 if(PlayerData[playerid][Pol] == 0) { PlayerData[playerid][Skin] = 22; }
  188.                 if(PlayerData[playerid][Pol] == 1) { PlayerData[playerid][Skin] = 56; }
  189.                 SPD(playerid, DIALOG_DOBRODOSLICA, DIALOG_STYLE_MSGBOX,""svetloplava"Registracija - Uspesna",""bela"Uzivajte igrajuci na serveru zeli vam \n "zelena"   FH:RP STAFF TEAM!","Nastavi","");
  190.                 SetSpawnInfo( playerid, 0, PlayerData[playerid][Skin], 2351.3213,-36.1563,26.4844,56.5654, 0, 0, 0, 0, 0, 0 );
  191.                 SpawnPlayer(playerid);
  192.                 for(new i; i < 20; i++)
  193.                 {
  194.                         SendClientMessage(playerid, -1," ");
  195.                 }
  196.                 SCM(playerid, ZUTA,"Cilj nam je da nam server bude sto unikatniji!");
  197.                 SCM(playerid, ZUTA,"Ukoliko ste novi i potrebna vam je pomoc ukucajte /novi");
  198.                 SCM(playerid, ZUTA,"Ukoliko zelite da postavite pitanje ukucajte /pitaj");
  199.                 SCM(playerid, ZUTA,"Za pocetak dobijate 350$");
  200.                 GivePlayerMoney(playerid, 350);
  201.                 PlayerData[playerid][Ulogovan] = 1;
  202.                 return 1;
  203.             }
  204.         }
  205.         case DIALOG_DOBRODOSLICA:
  206.         {
  207.             if(response)
  208.             {
  209.                 new INI:File = INI_Open(UserPath(playerid));
  210.                 INI_SetTag(File,"data");
  211.                 INI_WriteInt(File,"Sifra",PlayerData[playerid][Lozinka]);
  212.                 INI_WriteInt(File,"Novac",0);
  213.                 INI_WriteInt(File,"Skin",0);
  214.                 INI_WriteInt(File,"Level",0);
  215.                 INI_WriteInt(File,"Admin",0);
  216.                 INI_WriteInt(File,"VIP",0);
  217.                 INI_WriteInt(File,"ORG",-1);
  218.                 INI_WriteInt(File,"Rank",-1);
  219.                 INI_WriteInt(File,"Banovan",0);
  220.                 INI_WriteInt(File,"Banka novac",0);
  221.                 INI_WriteFloat(File,"x",0);
  222.                 INI_WriteFloat(File,"y",0);
  223.                 INI_WriteFloat(File,"z",0);
  224.                 INI_WriteFloat(File,"a",0);
  225.                 INI_Close(File);
  226.                 TogglePlayerSpectating(playerid, false);
  227.             }
  228.         }
  229.     }
  230.     return 1;
  231. }
  232. //============================================================================ >OnPlayerSpawn
  233. public OnPlayerSpawn(playerid)
  234. {
  235.     SetPlayerSkin(playerid,PlayerData[playerid][Skin]);
  236.     return 1;
  237. }
  238. //============================================================================ >Dodatni public-i
  239. public LoadUser_data(playerid,name[],value[])
  240. {
  241.     INI_Int("Sifra",PlayerData[playerid][Lozinka]);
  242.     INI_Int("Godine",PlayerData[playerid][Godine]);
  243.     INI_Int("Novac",PlayerData[playerid][Cash]);
  244.     INI_Int("Skin",PlayerData[playerid][Skin]);
  245.     INI_Int("Level",PlayerData[playerid][Level]);
  246.     INI_Int("Admin",PlayerData[playerid][Administrator]);
  247.     INI_Int("VIP",PlayerData[playerid][VIP]);
  248.     INI_Int("Godine",PlayerData[playerid][Godine]);
  249.     INI_Int("Drzava",PlayerData[playerid][Drzavljanstvo]);
  250.     INI_Int("Pol",PlayerData[playerid][Pol]);
  251.     INI_Int("ORG",PlayerData[playerid][ORG]);
  252.     INI_Int("Rank",PlayerData[playerid][ORGRank]);
  253.     INI_Int("Banovan",PlayerData[playerid][Banovan]);
  254.     INI_Int("Banka novac",PlayerData[playerid][BankCash]);
  255.     INI_Float("x",PlayerData[playerid][x]);
  256.     INI_Float("y",PlayerData[playerid][y]);
  257.     INI_Float("z",PlayerData[playerid][z]);
  258.     INI_Float("a",PlayerData[playerid][a]);
  259.     return 1;
  260. }
  261.  
  262.  
  263.  
  264. //PS:Imam sve defines ostale itd.
Advertisement
Add Comment
Please, Sign In to add comment