Advertisement
Guest User

Untitled

a guest
Oct 13th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 9.35 KB | None | 0 0
  1. #include <a_samp>
  2. #include <YSI\y_ini>
  3.  
  4. enum
  5. {
  6. dialog_none,
  7. dialog_register,
  8. dialog_login,
  9. dialog_godine,
  10. dialog_pol,
  11. dialog_drzava
  12. }
  13.  
  14. #define PATH "/Nalozi/%s.ini"
  15.  
  16. enum pData
  17. {
  18.         pPassword,
  19.         pNovac,
  20.         pLevel,
  21.         pGodine,
  22.         pPol,
  23.         pDrzava
  24. }
  25. new PlayerData[MAX_PLAYERS][pData];
  26. forward LoadUser_data(playerid,name[],value[]);
  27. public LoadUser_data(playerid,name[],value[])
  28. {
  29.     INI_Int("Password",PlayerData[playerid][pPassword]);
  30.     INI_Int("Novac",PlayerData[playerid][pNovac]);
  31.     INI_Int("Level",PlayerData[playerid][pLevel]);
  32.     INI_Int("Godine",PlayerData[playerid][pGodine]);
  33.     INI_Int("Pol",PlayerData[playerid][pPol]);
  34.     INI_Int("Drzava",PlayerData[playerid][pDrzava]);
  35.     return 1;
  36. }
  37. //------------------------------------------------------------------------------
  38. stock UserPath(playerid)
  39. {
  40.     new string[128],playername[MAX_PLAYER_NAME];
  41.     GetPlayerName(playerid,playername,sizeof(playername));
  42.     format(string,sizeof(string),PATH,playername);
  43.     return string;
  44. }
  45.  
  46. main()
  47. {
  48. }
  49.  
  50. public OnGameModeInit()
  51. {
  52.     return (true);
  53. }
  54.  
  55. public OnGameModeExit()
  56. {
  57.     return (true);
  58. }
  59.  
  60. public OnPlayerConnect(playerid)
  61. {
  62.     if(fexist(UserPath(playerid)))
  63.     {
  64.     INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  65.     new formatmsg[1024],
  66.     PlayerName[MAX_PLAYER_NAME + 1];
  67.     GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  68.     format(formatmsg, 1024, "{FFFFFF}Dobrodosli na {8000FF}Alyx RolePlay {FFFFFF}online gaming zajednicu.\
  69.     \n\n{8000FF}Vase ime: {FFFFFF}%s\
  70.     \n{8000FF}Nalog: {FFFFFF}Imate\
  71.     \n{8000FF}Forum: {FFFFFF}www.forum.com\
  72.     \n{8000FF}TeamSpeak 3: {FFFFFF}ts3.server:7777\
  73.     \n\nUnesite vas password da bi ste se prijavili na vas nalog.", PlayerName[playerid]);
  74.     ShowPlayerDialog(playerid, dialog_login, DIALOG_STYLE_INPUT, "Alyx RolePlay", formatmsg, "Dalje", "Izlaz");
  75.     }
  76.     else
  77.     {
  78.     new formatmsg[1024],
  79.     PlayerName[MAX_PLAYER_NAME + 1];
  80.     GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  81.     format(formatmsg, 1024, "{FFFFFF}Dobrodosli na {8000FF}Alyx RolePlay {FFFFFF}online gaming zajednicu.\
  82.     \n\n{8000FF}Vase ime: {FFFFFF}%s\
  83.     \n{8000FF}Nalog: {FFFFFF}Nemate\
  84.     \n{8000FF}Forum: {FFFFFF}www.forum.com\
  85.     \n{8000FF}TeamSpeak 3: {FFFFFF}ts3.server:7777\
  86.     \n\nUnesite vas password da bi ste registrovali nalog.", PlayerName[playerid]);
  87.     ShowPlayerDialog(playerid, dialog_register, DIALOG_STYLE_INPUT, "Alyx RolePlay", formatmsg, "Dalje", "Izlaz");
  88.     }
  89.     return (true);
  90. }
  91.  
  92. public OnPlayerSpawn(playerid)
  93. {
  94.     return (true);
  95. }
  96.  
  97. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  98. {
  99.     switch (dialogid)
  100.     {
  101.     case dialog_register:
  102.     {
  103.     if (!response) return Kick(playerid);
  104.     if(response)
  105.     {
  106.     if(strlen(inputtext))
  107.     {
  108.     new INI:File = INI_Open(UserPath(playerid));
  109.     INI_SetTag(File,"Data");
  110.     INI_WriteString(File,"Password",inputtext);
  111.     INI_WriteInt(File,"Novac",10000);
  112.     INI_WriteInt(File,"Level",1);
  113.     INI_WriteInt(File,"Godine",0);
  114.     INI_WriteInt(File,"Pol",0);
  115.     INI_WriteInt(File,"Drzava",0);
  116.     INI_Close(File);
  117.    
  118.     ShowPlayerDialog(playerid, dialog_godine, DIALOG_STYLE_LIST, "Alyx RolePlay", "{8000FF}[-] {FFFFFF}12\
  119.     \n{8000FF}[-] {FFFFFF}13\
  120.     \n{8000FF}[-] {FFFFFF}14\
  121.     \n{8000FF}[-] {FFFFFF}15\
  122.     \n{8000FF}[-] {FFFFFF}16\
  123.     \n{8000FF}[-] {FFFFFF}17\
  124.     \n{8000FF}[-] {FFFFFF}18+", "Dalje", "Izlaz");
  125.     }
  126.     else
  127.     {
  128.     new formatmsg[1024],
  129.     PlayerName[MAX_PLAYER_NAME + 1];
  130.     GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  131.     format(formatmsg, 1024, "{FFFFFF}Dobrodosli na {8000FF}Alyx RolePlay {FFFFFF}online gaming zajednicu.\
  132.     \n\n{8000FF}Vase ime: {FFFFFF}%s\
  133.     \n{8000FF}Nalog: {FFFFFF}Nemate\
  134.     \n{8000FF}Forum: {FFFFFF}www.forum.com\
  135.     \n{8000FF}TeamSpeak 3: {FFFFFF}ts3.server:7777\
  136.     \n\nUnesite vas password da bi ste registrovali nalog.", PlayerName[playerid]);
  137.     ShowPlayerDialog(playerid, dialog_register, DIALOG_STYLE_INPUT, "Alyx RolePlay", formatmsg, "Dalje", "Izlaz");
  138.     }
  139.     }
  140.     }
  141.     case dialog_godine:
  142.     {
  143.     switch (listitem)
  144.     {
  145.     case 0:
  146.     {
  147.     PlayerData[playerid][pGodine] = 1;
  148.     ShowPlayerDialog(playerid, dialog_drzava, DIALOG_STYLE_LIST, "Alyx RolePlay", "{8000FF}[-] {FFFFFF}Republika Srpska\
  149.     \n{8000FF}[-] {FFFFFF}Bosna i Hercegovina\
  150.     \n{8000FF}[-] {FFFFFF}Srbija\
  151.     \n{8000FF}[-] {FFFFFF}Crna Gora\
  152.     \n{8000FF}[-] {FFFFFF}Slovenija\
  153.     \n{8000FF}[-] {FFFFFF}Ostalo", "Dalje", "Izlaz");
  154.     }
  155.     case 1:
  156.     {
  157.     PlayerData[playerid][pGodine] = 2;
  158.     ShowPlayerDialog(playerid, dialog_drzava, DIALOG_STYLE_LIST, "Alyx RolePlay", "{8000FF}[-] {FFFFFF}Republika Srpska\
  159.     \n{8000FF}[-] {FFFFFF}Bosna i Hercegovina\
  160.     \n{8000FF}[-] {FFFFFF}Srbija\
  161.     \n{8000FF}[-] {FFFFFF}Crna Gora\
  162.     \n{8000FF}[-] {FFFFFF}Slovenija\
  163.     \n{8000FF}[-] {FFFFFF}Ostalo", "Dalje", "Izlaz");
  164.     }
  165.     case 2:
  166.     {
  167.     PlayerData[playerid][pGodine] = 3;
  168.     ShowPlayerDialog(playerid, dialog_drzava, DIALOG_STYLE_LIST, "Alyx RolePlay", "{8000FF}[-] {FFFFFF}Republika Srpska\
  169.     \n{8000FF}[-] {FFFFFF}Bosna i Hercegovina\
  170.     \n{8000FF}[-] {FFFFFF}Srbija\
  171.     \n{8000FF}[-] {FFFFFF}Crna Gora\
  172.     \n{8000FF}[-] {FFFFFF}Slovenija\
  173.     \n{8000FF}[-] {FFFFFF}Ostalo", "Dalje", "Izlaz");
  174.     }
  175.     case 3:
  176.     {
  177.     PlayerData[playerid][pGodine] = 4;
  178.     ShowPlayerDialog(playerid, dialog_drzava, DIALOG_STYLE_LIST, "Alyx RolePlay", "{8000FF}[-] {FFFFFF}Republika Srpska\
  179.     \n{8000FF}[-] {FFFFFF}Bosna i Hercegovina\
  180.     \n{8000FF}[-] {FFFFFF}Srbija\
  181.     \n{8000FF}[-] {FFFFFF}Crna Gora\
  182.     \n{8000FF}[-] {FFFFFF}Slovenija\
  183.     \n{8000FF}[-] {FFFFFF}Ostalo", "Dalje", "Izlaz");
  184.     }
  185.     case 4:
  186.     {
  187.     PlayerData[playerid][pGodine] = 5;
  188.     ShowPlayerDialog(playerid, dialog_drzava, DIALOG_STYLE_LIST, "Alyx RolePlay", "{8000FF}[-] {FFFFFF}Republika Srpska\
  189.     \n{8000FF}[-] {FFFFFF}Bosna i Hercegovina\
  190.     \n{8000FF}[-] {FFFFFF}Srbija\
  191.     \n{8000FF}[-] {FFFFFF}Crna Gora\
  192.     \n{8000FF}[-] {FFFFFF}Slovenija\
  193.     \n{8000FF}[-] {FFFFFF}Ostalo", "Dalje", "Izlaz");
  194.     }
  195.     case 5:
  196.     {
  197.     PlayerData[playerid][pGodine] = 6;
  198.     ShowPlayerDialog(playerid, dialog_drzava, DIALOG_STYLE_LIST, "Alyx RolePlay", "{8000FF}[-] {FFFFFF}Republika Srpska\
  199.     \n{8000FF}[-] {FFFFFF}Bosna i Hercegovina\
  200.     \n{8000FF}[-] {FFFFFF}Srbija\
  201.     \n{8000FF}[-] {FFFFFF}Crna Gora\
  202.     \n{8000FF}[-] {FFFFFF}Slovenija\
  203.     \n{8000FF}[-] {FFFFFF}Ostalo", "Dalje", "Izlaz");
  204.     }
  205.     case 6:
  206.     {
  207.     PlayerData[playerid][pGodine] = 7;
  208.     ShowPlayerDialog(playerid, dialog_drzava, DIALOG_STYLE_LIST, "Alyx RolePlay", "{8000FF}[-] {FFFFFF}Republika Srpska\
  209.     \n{8000FF}[-] {FFFFFF}Bosna i Hercegovina\
  210.     \n{8000FF}[-] {FFFFFF}Srbija\
  211.     \n{8000FF}[-] {FFFFFF}Crna Gora\
  212.     \n{8000FF}[-] {FFFFFF}Slovenija\
  213.     \n{8000FF}[-] {FFFFFF}Ostalo", "Dalje", "Izlaz");
  214.     }
  215.     }
  216.     }
  217.     case dialog_drzava:
  218.     {
  219.     switch (listitem)
  220.     {
  221.     case 0:
  222.     {
  223.     PlayerData[playerid][pDrzava] = 1;
  224.     ShowPlayerDialog(playerid, dialog_pol, DIALOG_STYLE_LIST, "Alyx RolePlay", "{8000FF}[-] {FFFFFF}Musko\
  225.     \n{8000FF}[-] {FFFFFF}Zensko", "Dalje", "Izlaz");
  226.     }
  227.     case 1:
  228.     {
  229.     PlayerData[playerid][pDrzava] = 2;
  230.     ShowPlayerDialog(playerid, dialog_pol, DIALOG_STYLE_LIST, "Alyx RolePlay", "{8000FF}[-] {FFFFFF}Musko\
  231.     \n{8000FF}[-] {FFFFFF}Zensko", "Dalje", "Izlaz");
  232.     }
  233.     case 2:
  234.     {
  235.     PlayerData[playerid][pDrzava] = 3;
  236.     ShowPlayerDialog(playerid, dialog_pol, DIALOG_STYLE_LIST, "Alyx RolePlay", "{8000FF}[-] {FFFFFF}Musko\
  237.     \n{8000FF}[-] {FFFFFF}Zensko", "Dalje", "Izlaz");
  238.     }
  239.     case 3:
  240.     {
  241.     PlayerData[playerid][pDrzava] = 4;
  242.     ShowPlayerDialog(playerid, dialog_pol, DIALOG_STYLE_LIST, "Alyx RolePlay", "{8000FF}[-] {FFFFFF}Musko\
  243.     \n{8000FF}[-] {FFFFFF}Zensko", "Dalje", "Izlaz");
  244.     }
  245.     case 4:
  246.     {
  247.     PlayerData[playerid][pDrzava] = 5;
  248.     ShowPlayerDialog(playerid, dialog_pol, DIALOG_STYLE_LIST, "Alyx RolePlay", "{8000FF}[-] {FFFFFF}Musko\
  249.     \n{8000FF}[-] {FFFFFF}Zensko", "Dalje", "Izlaz");
  250.     }
  251.     case 5:
  252.     {
  253.     PlayerData[playerid][pDrzava] = 6;
  254.     ShowPlayerDialog(playerid, dialog_pol, DIALOG_STYLE_LIST, "Alyx RolePlay", "{8000FF}[-] {FFFFFF}Musko\
  255.     \n{8000FF}[-] {FFFFFF}Zensko", "Dalje", "Izlaz");
  256.     }
  257.     }
  258.     }
  259.     case dialog_pol:
  260.     {
  261.     switch (listitem)
  262.     {
  263.     case 0:
  264.     {
  265.     PlayerData[playerid][pPol] = 1;
  266.     SetSpawnInfo(playerid, 0, 26, 1481.3978, -1732.6604, 13.6672, 0, 0, 0, 0, 0, 0, 0);
  267.     SpawnPlayer(playerid);
  268.     }
  269.     case 1:
  270.     {
  271.     PlayerData[playerid][pPol] = 2;
  272.     SetSpawnInfo(playerid, 0, 26, 1481.3978, -1732.6604, 13.6672, 0, 0, 0, 0, 0, 0, 0);
  273.     SpawnPlayer(playerid);
  274.     }
  275.     }
  276.     }
  277.     case dialog_login:
  278.     {
  279.     if (!response) return Kick(playerid);
  280.     if (response)
  281.     {
  282.     if(strcmp(PlayerData[playerid][pPassword],inputtext , true ) == 0)
  283.     {
  284.     INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  285.     GivePlayerMoney(playerid, PlayerData[playerid][pNovac]);
  286.     SetPlayerScore(playerid, PlayerData[playerid][pLevel]);
  287.     SetSpawnInfo(playerid, 0, 26, 1481.3978, -1732.6604, 13.6672, 0, 0, 0, 0, 0, 0, 0);
  288.     SpawnPlayer(playerid);
  289.     }
  290.     else
  291.     {
  292.     new formatmsg[1024],
  293.     PlayerName[MAX_PLAYER_NAME + 1];
  294.     GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  295.     format(formatmsg, 1024, "{FFFFFF}Dobrodosli na {8000FF}Alyx RolePlay {FFFFFF}online gaming zajednicu.\
  296.     \n\n{8000FF}Vase ime: {FFFFFF}%s\
  297.     \n{8000FF}Nalog: {FFFFFF}Imate\
  298.     \n{8000FF}Forum: {FFFFFF}www.forum.com\
  299.     \n{8000FF}TeamSpeak 3: {FFFFFF}ts3.server:7777\
  300.     \n\nUnesite vas password da bi ste se prijavili na vas nalog.", PlayerName[playerid]);
  301.     ShowPlayerDialog(playerid, dialog_login, DIALOG_STYLE_INPUT, "Alyx RolePlay", formatmsg, "Dalje", "Izlaz");
  302.     }
  303.     }
  304.     }
  305.     //
  306.     }
  307.     return(true);
  308. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement