Advertisement
Guest User

Untitled

a guest
Oct 7th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 22.32 KB | None | 0 0
  1. local screenWidth, screenHeight = guiGetScreenSize()
  2. function callClientFunction_s(funcname, ...)
  3.     local arg = { ... }
  4.     if (arg[1]) then
  5.         for key, value in next, arg do arg[key] = tonumber(value) or value end
  6.     end
  7.     loadstring("return "..funcname)()(unpack(arg))
  8. end
  9. addEvent("onServerCallsClientFunction_s", true)
  10. addEventHandler("onServerCallsClientFunction_s", root, callClientFunction_s)
  11. local language = 1
  12. local Hud_Data = {acc = "",kills = "",deaths = "",pos = "",ratio = ""}
  13. local colors_t = {black2=tocolor( 69 ,69 ,69),gold=tocolor(238,180,34,255),gray=tocolor(200,200,200,255),green=tocolor(100,180,34,255),green2=tocolor(100,200,34,255),black=tocolor(0,0,0,255),gray2=tocolor( 25 ,24 ,24),red=tocolor( 225 ,25 ,25),blue=tocolor( 5 ,50 ,225)}
  14. function math.format(number)
  15. return tonumber(string.format("%.4f", number))
  16. end
  17.  
  18. function math.round(number, decimals, method)
  19.     decimals = decimals or 0
  20.     local factor = 10 ^ decimals
  21.     if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor
  22.     else return tonumber(("%."..decimals.."f"):format(number)) end
  23. end
  24.  
  25. function getScreenPositionByRelative(x,y)
  26.     local nX,nY =x*screenWidth,y*screenHeight
  27.     return math.format(nX),math.format(nY)
  28. end
  29. function yhy2(h,s)
  30. local mn = s/h
  31. return tonumber(string.format("%.1f", screenHeight*mn))
  32. end
  33. function UpdateHudData(type_d,val)
  34.     if type_d == "t" then
  35.         for k,v in pairs(val) do
  36.             if k == "ratio" then
  37.             Hud_Data[k] = tostring(math.round(v ,2))
  38.             else
  39.             Hud_Data[k] = tostring(v)
  40.             end
  41.         end
  42.     else
  43.         if type_d == "ratio" then
  44.         Hud_Data[type_d] = tostring(math.round(val ,2))
  45.         else
  46.         Hud_Data[type_d] = tostring(val)
  47.         end
  48.     end
  49. end
  50.  
  51. function callServerFunction_s(funcname, ...)
  52.     local arg = { ... }
  53.     if (arg[1]) then
  54.         for key, value in next, arg do
  55.             if (type(value) == "number") then arg[key] = tostring(value) end
  56.         end
  57.     end
  58.     triggerServerEvent("onClientCallsServerFunction_s", root, funcname, unpack(arg))
  59. end
  60. function getSizeFromResolution2(x)
  61. local s1,s2 = 0,0
  62.     if x > 1279 then
  63.     s1 = 1.4 s2 = 1.0
  64.     elseif x > 1023 then
  65.     s1 = 1.2 s2 = 1.0
  66.     elseif x > 799 then
  67.     s1 = 1.0 s2 = 1.0
  68.     else
  69.     s1 = 0.85 s2 = 1.0
  70.     end
  71.     return s1,s2
  72. end
  73.  
  74.  
  75.  
  76.  
  77.  
  78.    
  79.   local window_login   
  80.   local edit
  81.   local edit1
  82.   local obrazek
  83.  
  84.   function outputEditBox ( )
  85.     if source == edit or source == edit1 then
  86.        toggleControl ( "chatbox", false )
  87.       else
  88.  toggleControl ( "chatbox",true )    
  89.     end
  90. end
  91. local spawn = false
  92. addEventHandler( "onClientPlayerSpawn", getLocalPlayer( ),
  93.     function (res  )
  94.     if spawn == false then
  95.         spawn = true
  96.         --LoginMenu_hs()
  97.         chooseLang()
  98.      end
  99.     end
  100. )
  101.  
  102. function LoginMenu_hs()
  103. if window_login == nil then
  104. local x_,y_ = guiGetScreenSize()
  105.     fadeCamera(false)
  106.     addEventHandler("onClientRender", getRootElement(), draw_loginf)
  107.             local as_x= x_/3.53103448
  108.     local as_y= y_/25.6
  109.         guiCreateStaticImage ( (x_-as_x)/2, 0, as_x, as_y, "mini.png",  false )
  110.        edit = guiCreateEdit ( 0.41, 0.495, 0.12, 0.035, "",  true)
  111.        guiSetAlpha(edit,0.8)
  112.         guiSetFont ( edit, "default-bold-small" )
  113.        edit1 = guiCreateEdit (  0.41, 0.55, 0.12, 0.035, "",  true )
  114.        guiSetAlpha(edit1,0.8)
  115.         guiSetFont ( edit1, "default-bold-small" ) 
  116.         guiEditSetMaxLength ( edit,16 )
  117.         guiEditSetMaxLength ( edit1,16 )
  118. button = guiCreateButton ( 0.3, 0.625, 0.15, 0.04, "Login",  true )
  119.         addEventHandler ( "onClientGUIClick", button, Login )
  120. button2 = guiCreateButton ( 0.5 ,0.625, 0.15, 0.04, "Register",  true  )
  121.         addEventHandler ( "onClientGUIClick", button2,Register )
  122.        
  123.         showChat(true)
  124.         showCursor(true)
  125.         addEventHandler ( "onClientGUIClick", getRootElement(), outputEditBox )
  126. end
  127. end
  128.    
  129.     local texts_t = {
  130.     info= {
  131.     [1]="Regulamin:",
  132.     [2]="Rules",
  133.     [3]="ARABIC"},
  134.     rule = {
  135.     [1]="1. Wykazujemy sie kultura osobist¹ i szanujemy innych graczy. \n2. Dzia³anie zgodnie z zasadami serwera, oraz regulaminem. \n3. Team Say (Nie piszemy na ogólnym czacie niepotrzebnych rzeczy) \n4. Czysta gra. \n5. Nie mo¿na wychodzic po za teren areny. \n6. Wykonywanie poleceñ admina \n7. W ka¿dym przypadku nie przestrzegania regulaminu gracz zostaje\n   ukarany kick'iem\ban'em.",
  136.     [2]="1. Be fully cultural towards other players, respect their. \n2. Follow the rules of the server. \n3. Use Team Say (do not write unnecessary things at global chat) \n4. Do not use any cheats, only clean playing. \n5. Do not try to run away from the arena's area. \n6. Follow the admin's orders. \n7. Everyone, who won't follow the rules, will be kicked or banned.",
  137.     [3]="1. Be fully cultural towards other players, respect their. \n2. Follow the rules of the server. \n3. Use Team Say (do not write unnecessary things at global chat) \n4. Do not use any cheats, only clean playing. \n5. Do not try to run away from the arena's area. \n6. Follow the admin's orders. \n7. Everyone, who won't follow the rules, will be kicked or banned."},
  138.     has = {
  139.     [1]="Haslo:",
  140.     [2]="Password:",
  141.     [3]="Password:"},
  142.     aut = {
  143.     [1]="Podany login, bedzie automatycznie ustawiany jako nick gracza.",
  144.     [2]="The given login name will be set as your player nickname automatically.",
  145.     [3]="The given login name will be set as your player nickname automatically."}
  146.     }
  147.     local draw_login = {
  148.     box={getScreenPositionByRelative(0.25,0.15)},
  149.     boxsize={getScreenPositionByRelative(0.5,0.55)},
  150.     boxcolor = tocolor(255,255,255,25),
  151.     info={getScreenPositionByRelative(0.35,0.155)},
  152.     rule={getScreenPositionByRelative(0.265,0.22)},
  153.     login={getScreenPositionByRelative(0.345,0.50)},
  154.     register={getScreenPositionByRelative(0.345,0.555)},
  155.     att={getScreenPositionByRelative(0.275,0.45)},
  156.     size1=yhy2(768,1.2),
  157.     size2=yhy2(640,1.0),
  158.     }
  159. function draw_loginf()
  160.     dxDrawRectangle ( draw_login.box[1],draw_login.box[2],draw_login.boxsize[1],draw_login.boxsize[2] ,draw_login.boxcolor )
  161.     --dxDrawImage ( draw_login.box[1],draw_login.box[2],draw_login.boxsize[1],draw_login.boxsize[2], "s.png" ,0, 0, 0, draw_login.boxcolor )
  162.     dxDrawText (texts_t.info[language], draw_login.info[1],draw_login.info[2] , 0, 0,colors_t.gold,draw_login.size1 , "bankgothic")
  163.     dxDrawText (texts_t.rule[language], draw_login.rule[1],draw_login.rule[2] , 0, 0,colors_t.gray,draw_login.size2 , "default")
  164.     dxDrawText ("    Nick:", draw_login.login[1],draw_login.login[2] , 0, 0,colors_t.gold,draw_login.size1 , "default-bold")
  165.     dxDrawText (texts_t.has[language], draw_login.register[1],draw_login.register[2] , 0, 0,colors_t.gold,draw_login.size1 , "default-bold")
  166.     dxDrawText (texts_t.aut[language], draw_login.att[1],draw_login.att[2] , 0, 0,colors_t.red,draw_login.size1 , "default-bold")
  167. end
  168.  
  169.     function Login()
  170.     local username = guiGetText ( edit )
  171.     local password = guiGetText ( edit1 )
  172.         if(password ~= "" and username ~= "" ) then
  173.             callServerFunction_s("LoginOnAccount",getLocalPlayer(),username,password)
  174.         end
  175.  
  176.     end
  177.     function Register()
  178.     local username = guiGetText ( edit )
  179.     local password = guiGetText ( edit1 )
  180.     if type(tonumber(password)) == "number" then
  181.         local txt = {
  182.     [1]="#FF0000** Blad:#0AC419 Haslo musi zawierac chociaz jednen znak inny niz cyfra.",
  183.     [2]="#FF0000** Error:#0AC419 Your login must contain at least one letter besides numbers."}
  184.     outputChatBox ( txt[language], 255, 255, 255, true )
  185.     elseif string.len(username) < 4 then
  186.     local txt = {
  187.     [1]="#FF0000** Blad:#0AC419 Login musi sk³adac sie z minimum 4 znakow.",
  188.     [2]="#FF0000** Error:#0AC419 Username must consist of a minimum of 4 characters."}
  189.     outputChatBox ( txt[language], 255, 255, 255, true )
  190.     elseif string.len(password) < 5 then
  191.     local txt = {
  192.     [1]="#FF0000** Blad:#0AC419 Haslo musi sk³adac sie z minimum 5 znakow.",
  193.     [2]="#FF0000** Error:#0AC419 Password must consist of a minimum of 5 characters."}
  194.     outputChatBox ( txt[language], 255, 255, 255, true )
  195.     elseif type(tonumber(username)) == "number" then
  196.     local txt = {
  197.     [1]="#FF0000** Blad:#0AC419 Login musi zawierac chociaz jednen znak inny niz cyfra.",
  198.     [2]="#FF0000** Error:#0AC419 Your login must contain at least one letter besides numbers."}
  199.     outputChatBox ( txt[language], 255, 255, 255, true )
  200.     elseif string.find(username,"\"") then
  201.     local txt = {
  202.     [1]="#FF0000** Blad:#0AC419 Nie moza uzywac znaku \".",
  203.     [2]="#FF0000** Error:#0AC419 This character is not allowed to use - \"."}
  204.     outputChatBox ( txt[language], 255, 255, 255, true )
  205.     else
  206.    
  207.         if(password ~= "" and username ~= "" ) then
  208.             callServerFunction_s("CreateNewAccount",getLocalPlayer(),username,password)
  209.         end
  210.    
  211.     end
  212.     end
  213.    
  214.     function destroyLogWin()
  215.     addEventHandler("onClientRender", getRootElement(), s_onClientPreRender_Hud)
  216.     removeEventHandler ( "onClientGUIClick", getRootElement(), outputEditBox )
  217.     removeEventHandler("onClientRender", getRootElement(), draw_loginf)
  218.      toggleControl ( "chatbox",true )    
  219.     showCursor(false)
  220.     destroyElement(edit )
  221.     destroyElement(edit1    )
  222.     destroyElement(button)
  223.     destroyElement(button2)
  224.     fadeCamera(true)
  225.     --setTimer(triggerEvent,200,1,"introEvent",getLocalPlayer())
  226.      texts_t= nil
  227.     end
  228.    
  229.  
  230.  
  231. local help_win
  232. function Help()
  233. if help_win == nil then
  234. help_win = guiCreateWindow ( 0.25, 0.2, 0.5, 0.45, "Help", true )
  235.  local l = guiCreateLabel ( 0.15, 0.15, 1, 1, "                          ** Commands: \n\n/top10 - list of top10 players\n/stats - to check your own statistics \n/stats loginID - to check other players stats\n\n                          ** Other Commands:\n\n /vote [arena/base] [ID]  \nnp: /vote arena 20 \nlub /vote arena 20 26 34 56 ", true, help_win   )
  236.     guiSetFont ( l, "default-bold-small" )
  237.  
  238. local Button = guiCreateButton ( 0.05, 0.9, 0.9, 0.05, "ok", true, help_win )
  239. addEventHandler ( "onClientGUIClick", Button, OkButton2 )
  240. showCursor(true)
  241. end
  242. end
  243. addCommandHandler("help",Help)
  244.  
  245. function OkButton2 ()
  246. removeEventHandler ( "onClientGUIClick", source, OkButton2 )
  247. destroyElement(help_win)
  248. help_win = nil
  249. showCursor(false)
  250. end
  251.  
  252.  
  253.  
  254.  
  255. local top_win
  256. function DrawTop15(t)
  257. if top_win == nil then
  258. local c = {
  259. [1]={109,109,109},
  260. [2]={69,69,69 },
  261. c = 1}
  262. top_win = guiCreateStaticImage ((screenWidth-400)/2, (screenHeight-500)/2,400, 500, "top10.png", false)
  263. r = guiCreateLabel ( 0.10, 0.110, 1, 1,"Pos", true, top_win )
  264. guiSetFont ( r, "default-bold-small" )
  265. guiLabelSetColor ( r,c[c.c][1],c[c.c][2],c[c.c][3] )
  266. r = guiCreateLabel ( 0.23, 0.110, 1, 1,"Name", true, top_win )
  267. guiSetFont ( r, "default-bold-small" )
  268. guiLabelSetColor ( r,c[c.c][1],c[c.c][2],c[c.c][3] )
  269. r = guiCreateLabel ( 0.45, 0.110, 1, 1,"Kills", true, top_win )
  270. guiSetFont ( r, "default-bold-small" )
  271. guiLabelSetColor ( r,c[c.c][1],c[c.c][2],c[c.c][3] )
  272. r = guiCreateLabel ( 0.6, 0.110, 1, 1,"Deaths", true, top_win )
  273. guiSetFont ( r, "default-bold-small" )
  274. guiLabelSetColor ( r,c[c.c][1],c[c.c][2],c[c.c][3] )
  275. r = guiCreateLabel ( 0.775, 0.110, 1, 1,"Ratio", true, top_win )
  276. guiSetFont ( r, "default-bold-small" )
  277. guiLabelSetColor ( r,c[c.c][1],c[c.c][2],c[c.c][3] )
  278. local yP = 0.18
  279. for k,v in ipairs(t) do
  280. c.c = c.c + 1
  281. if c.c > 2 then
  282. c.c = 1
  283. end
  284. r = guiCreateLabel ( 0.1, yP, 1, 1,tostring(k)..".", true, top_win )
  285. guiSetFont ( r, "default-bold-small" )
  286. guiLabelSetColor ( r,c[c.c][1],c[c.c][2],c[c.c][3] )
  287. r = guiCreateLabel ( 0.23, yP, 1, 1,tostring(t[k].acc), true, top_win )
  288. guiSetFont ( r, "default-bold-small" )
  289. guiLabelSetColor ( r,c[c.c][1],c[c.c][2],c[c.c][3] )
  290. r = guiCreateLabel ( 0.45, yP, 1, 1,tostring(t[k].kills), true, top_win )
  291. guiSetFont ( r, "default-bold-small" )
  292. guiLabelSetColor ( r,c[c.c][1],c[c.c][2],c[c.c][3] )
  293. r = guiCreateLabel ( 0.6, yP, 1, 1,tostring(t[k].deaths), true, top_win )
  294. guiSetFont ( r, "default-bold-small" )
  295. guiLabelSetColor ( r,c[c.c][1],c[c.c][2],c[c.c][3] )
  296. r = guiCreateLabel ( 0.775, yP, 1, 1,tostring(math.round(t[k].ratio ,2)), true, top_win )
  297. guiSetFont ( r, "default-bold-small" )
  298. guiLabelSetColor ( r,c[c.c][1],c[c.c][2],c[c.c][3] )
  299. yP = yP + 0.07
  300. end
  301. local Button = guiCreateButton ( 0.05, 0.9, 0.9, 0.05, "", true, top_win )
  302. r = guiCreateLabel ( 0.45, 0.25, 1, 1,"CLOSE!", true, Button )
  303. guiSetFont ( r, "default-bold-small" )
  304. guiSetAlpha(Button,0.5)
  305. guiLabelSetColor (r,255,255,255)
  306. addEventHandler ( "onClientGUIClick", Button, OkButton )
  307. showCursor(true)
  308. end
  309. end
  310.  
  311.  
  312. function OkButton ()
  313. removeEventHandler ( "onClientGUIClick", source, OkButton )
  314. destroyElement(top_win)
  315. top_win = nil
  316. showCursor(false)
  317. end
  318.  
  319.     local She_L = {
  320.     box={getScreenPositionByRelative(0.78,0.185)},
  321.     boxsize={getScreenPositionByRelative(0.17,0.135)},
  322.     boxcolor=tocolor(0,0,0,130),
  323.     info={getScreenPositionByRelative(0.8,0.195)},
  324.     kills={getScreenPositionByRelative(0.795,0.235)},
  325.     kills2={getScreenPositionByRelative(0.83,0.235)},
  326.     deaths={getScreenPositionByRelative(0.865,0.235)},
  327.     deaths2={getScreenPositionByRelative(0.915,0.235)},
  328.     ratio={getScreenPositionByRelative(0.795,0.27)},
  329.     ratio2={getScreenPositionByRelative(0.835,0.27)},
  330.     pos={getScreenPositionByRelative(0.875,0.27)},
  331.     pos2={getScreenPositionByRelative(0.915,0.27)},
  332.     size1=yhy2(768,1.2),
  333.     size2=yhy2(768,0.8),
  334.     }
  335.  
  336.     function s_onClientPreRender_Hud()
  337.      dxDrawImage ( She_L.box[1],She_L.box[2],She_L.boxsize[1],She_L.boxsize[2], "s.png" ,0, 0, 0, She_L.boxcolor )
  338.      
  339.      dxDrawText ("Statistics:", She_L.info[1],She_L.info[2] , 0, 0,colors_t.green,She_L.size2 , "bankgothic")
  340.      
  341.       dxDrawText ("Kills: ", She_L.kills[1],She_L.kills[2] , 0, 0,colors_t.gold,She_L.size1 , "default-bold")
  342.       dxDrawText (Hud_Data.kills, She_L.kills2[1],She_L.kills2[2] , 0, 0,colors_t.gray,She_L.size1 , "default-bold")
  343.      
  344.       dxDrawText ("Deaths: ", She_L.deaths[1],She_L.deaths[2] , 0, 0,colors_t.gold,She_L.size1 , "default-bold")
  345.       dxDrawText (Hud_Data.deaths, She_L.deaths2[1],She_L.deaths2[2] , 0, 0,colors_t.gray,She_L.size1 , "default-bold")
  346.      
  347.       dxDrawText ("Ratio: ", She_L.ratio[1],She_L.ratio[2] , 0, 0,colors_t.gold,She_L.size1 , "default-bold")
  348.       dxDrawText (Hud_Data.ratio, She_L.ratio2[1],She_L.ratio2[2] , 0, 0,colors_t.gray,She_L.size1 , "default-bold")
  349.      
  350.       dxDrawText ("Rank: ", She_L.pos[1],She_L.pos[2] , 0, 0,colors_t.gold,She_L.size1 , "default-bold")
  351.       dxDrawText (Hud_Data.pos, She_L.pos2[1],She_L.pos2[2] , 0, 0,colors_t.gray,She_L.size1 , "default-bold")
  352.  
  353.     end
  354.  
  355.     local lang = {
  356.     info={getScreenPositionByRelative(0.3,0.3)},
  357.     plf={getScreenPositionByRelative(0.22,0.61)},
  358.     engf={getScreenPositionByRelative(0.635,0.61)},
  359.     size1=yhy2(768,1.2),
  360.     }
  361. function chooseLang()
  362. lang.pl = guiCreateStaticImage ( 0.11, 0.43, 0.25, 0.16, "pl.png",  true )
  363. lang.eng = guiCreateStaticImage ( 0.41, 0.43, 0.25, 0.16, "eng.png",  true )
  364. lang.ar = guiCreateStaticImage ( 0.61, 0.43, 0.25, 0.16, "ar.png",  true )
  365. addEventHandler("onClientRender", getRootElement(), bm_onClientPreRender_Login1)
  366. addEventHandler ( "onClientGUIClick", lang.pl, onClickFlag, false )
  367. addEventHandler ( "onClientGUIClick", lang.eng, onClickFlag, false )
  368. addEventHandler ( "onClientGUIClick", lang.ar, onClickFlag, false )
  369. showCursor(true)
  370. end
  371.  
  372.     function bm_onClientPreRender_Login1()
  373.      dxDrawText ("Select Your Language: \n      (click on flag)", lang.info[1],lang.info[2] , 0, 0,colors_t.gold,lang.size1 , "bankgothic")
  374.      dxDrawText ("Polish", lang.plf[1],lang.plf[2] , 0, 0,colors_t.red,lang.size1 , "bankgothic")
  375.      dxDrawText ("English", lang.engf[1],lang.engf[2] , 0, 0,colors_t.blue,lang.size1 , "bankgothic")
  376.      dxDrawText ("Arabic", lang.arf[1],lang.arf[2] , 0, 0,colors_t.blue,lang.size1 , "bankgothic")
  377.      end
  378.      
  379.     function onClickFlag()
  380.         if source == lang.pl then
  381.             removeEventHandler("onClientRender", getRootElement(), bm_onClientPreRender_Login1)
  382.             removeEventHandler ( "onClientGUIClick", lang.pl, onClickFlag, false )
  383.             removeEventHandler ( "onClientGUIClick", lang.eng, onClickFlag, false )
  384.             removeEventHandler ( "onClientGUIClick", lang.ar, onClickFlag, false )
  385.             destroyElement(lang.pl)
  386.             destroyElement(lang.eng)
  387.             destroyElement(lang.ar)
  388.             lang = {}
  389.             language = 1
  390.             callServerFunction_s("lang_upd",getLocalPlayer(),language)
  391.             LoginMenu_hs()
  392.         else
  393.             removeEventHandler("onClientRender", getRootElement(), bm_onClientPreRender_Login1)
  394.             removeEventHandler ( "onClientGUIClick", lang.pl, onClickFlag, false )
  395.             removeEventHandler ( "onClientGUIClick", lang.eng, onClickFlag, false )
  396.             removeEventHandler ( "onClientGUIClick", lang.ar, onClickFlag, false )
  397.             destroyElement(lang.pl)
  398.             destroyElement(lang.eng)
  399.             destroyElement(lang.ar)
  400.             lang = {}
  401.             language = 2
  402.             callServerFunction_s("lang_upd",getLocalPlayer(),language)
  403.             LoginMenu_hs()
  404.         else
  405.             removeEventHandler("onClientRender", getRootElement(), bm_onClientPreRender_Login1)
  406.             removeEventHandler ( "onClientGUIClick", lang.pl, onClickFlag, false )
  407.             removeEventHandler ( "onClientGUIClick", lang.eng, onClickFlag, false )
  408.             removeEventHandler ( "onClientGUIClick", lang.ar, onClickFlag, false )
  409.             destroyElement(lang.pl)
  410.             destroyElement(lang.eng)
  411.             destroyElement(lang.ar)
  412.             lang = {}
  413.             language = 3
  414.             callServerFunction_s("lang_upd",getLocalPlayer(),language)
  415.             LoginMenu_hs()
  416.         end
  417.     end
  418. end
  419.    
  420.     local konto = {}
  421.     function konto_f(data)
  422.         showCursor(true)
  423.         konto.window = guiCreateWindow(0.35,0.35,0.3,0.3,"Your account Panel.",true)
  424.         local tt = {{"Nazwa","Name","arabic"},{"Zabojstwa","Kills","arabic"},{"Smierci","Deaths","arabic"},{
  425.         "Ratio","Ratio","arabic"},{"Pozycja","Ranking","arabic"},{"Zadane obrazania","Total Damage","arabic"}}
  426.         local yP = 0.1
  427.             for i=1,6 do
  428.                 local r = guiCreateLabel ( 0.1, yP, 1, 1,tt[i][language]..":", true, konto.window )
  429.                 guiSetFont ( r, "default-bold-small" )
  430.                 guiLabelSetColor ( r,125,125,125 )
  431.                 r = guiCreateLabel ( 0.4, yP, 1, 1,tostring(data[i]), true, konto.window )
  432.                 guiSetFont ( r, "default-bold-small" )
  433.                 guiLabelSetColor ( r,225,225,225 )
  434.                 yP = yP + 0.07
  435.             end
  436.         local txt = {"Zmien Nick","Change Nick","arabic"}
  437.         konto.nick = guiCreateButton ( 0.05, 0.56, 0.9, 0.07, txt[language], true, konto.window )
  438.         addEventHandler ( "onClientGUIClick", konto.nick, konto_f_onClientGUIClick )
  439.         local txt = {"Zmien Haslo","Change Password","arabic"}
  440.         konto.haslo = guiCreateButton ( 0.05, 0.7, 0.9, 0.07, txt[language], true, konto.window )
  441.         addEventHandler ( "onClientGUIClick", konto.haslo, konto_f_onClientGUIClick )
  442.         local txt = {"Zamknij","Close","arabic"}
  443.         konto.close = guiCreateButton ( 0.05, 0.84, 0.9, 0.07, txt[language], true, konto.window )
  444.         addEventHandler ( "onClientGUIClick", konto.close, konto_f_onClientGUIClick )
  445.     end
  446.     addCommandHandler("account",konto_f)
  447.  
  448.     function konto_f_onClientGUIClick()
  449.         if source == konto.close then
  450.             removeEventHandler ( "onClientGUIClick", konto.nick, konto_f_onClientGUIClick )
  451.             removeEventHandler ( "onClientGUIClick", konto.haslo, konto_f_onClientGUIClick )
  452.             removeEventHandler ( "onClientGUIClick", konto.close, konto_f_onClientGUIClick )
  453.             destroyElement(konto.window)
  454.             konto = {}
  455.             showCursor(false)
  456.         elseif source == konto.change_button_close then
  457.             removeEventHandler ( "onClientGUIClick", konto.change_button)
  458.             removeEventHandler ( "onClientGUIClick",  konto.change_button_close )
  459.             destroyElement(konto.change)
  460.             guiSetVisible(konto.window,true)
  461.         elseif source == konto.change_button then  
  462.             if konto.type == "pass" then
  463.                 local password = guiGetText ( konto.change_edit )
  464.                 if type(tonumber(password)) == "number" then
  465.                     local txt = {
  466.                     [1]="#FF0000** Blad:#0AC419 Haslo musi zawierac chociaz jednen znak inny niz cyfra.",
  467.                     [2]="#FF0000** Error:#0AC419 Your login must contain at least one letter besides numbers."}
  468.                     [3]="#FF0000** Error:#0AC419 Your login must contain at least one letter besides numbers."}
  469.                     outputChatBox ( txt[language], 255, 255, 255, true )
  470.                 elseif string.len(password) < 5 then
  471.                     local txt = {
  472.                     [1]="#FF0000** Blad:#0AC419 Haslo musi sk³adac sie z minimum 5 znakow.",
  473.                     [2]="#FF0000** Error:#0AC419 Password must consist of a minimum of 5 characters."}
  474.                     [3]="#FF0000** Error:#0AC419 Password must consist of a minimum of 5 characters."}                 
  475.                     outputChatBox ( txt[language], 255, 255, 255, true )
  476.                 else
  477.                 callServerFunction_s("doThinkWithAccount",getLocalPlayer(),"pass",password)
  478.                 guiSetEnabled(source,false)
  479.                 end
  480.             elseif konto.type == "name" then
  481.                     local username = guiGetText ( konto.change_edit )
  482.                     if string.len(username) < 4 then
  483.                         local txt = {
  484.                         [1]="#FF0000** Blad:#0AC419 Login musi sk³adac sie z minimum 4 znakow.",
  485.                         [2]="#FF0000** Error:#0AC419 Username must consist of a minimum of 4 characters."}
  486.                         [3]="#FF0000** Error:#0AC419 Username must consist of a minimum of 4 characters."}
  487.                     outputChatBox ( txt[language], 255, 255, 255, true )
  488.                     elseif type(tonumber(username)) == "number" then
  489.                         local txt = {
  490.                         [1]="#FF0000** Blad:#0AC419 Login musi zawierac chociaz jednen znak inny niz cyfra.",
  491.                         [2]="#FF0000** Error:#0AC419 Your login must contain at least one letter besides numbers."}
  492.                         [3]="#FF0000** Error:#0AC419 Your login must contain at least one letter besides numbers."}
  493.                         outputChatBox ( txt[language], 255, 255, 255, true )
  494.                     elseif string.find(username,"\"") then
  495.                         local txt = {
  496.                         [1]="#FF0000** Blad:#0AC419 Nie moza uzywac znaku \".",
  497.                         [2]="#FF0000** Error:#0AC419 This character is not allowed to use - \"."}
  498.                         [3]="#FF0000** Error:#0AC419 This character is not allowed to use - \"."}
  499.                         outputChatBox ( txt[language], 255, 255, 255, true )
  500.                     else
  501.                     callServerFunction_s("doThinkWithAccount",getLocalPlayer(),"name",username)
  502.                     guiSetEnabled(source,false)
  503.                     end
  504.             end
  505.         elseif source == konto.haslo then
  506.         createChangeWindow({"Zmien Haslo:","Change your password:","arabic"},"pass")
  507.         elseif source == konto.nick then
  508.         createChangeWindow({"Zmien nikc:","Change your nickname:","arabic"},"name")
  509.         end
  510.     end
  511.    
  512.     function createChangeWindow(title,type)
  513.     guiSetVisible(konto.window,false)
  514.     konto.type = type
  515.     konto.change = guiCreateWindow(0.35,0.35,0.3,0.15,title[language],true)
  516.     konto.change_edit = guiCreateEdit (  0.05, 0.25, 0.9, 0.175, "",  true,konto.change )
  517.     local txt = {"Zmnien.","Change.","arabic."}
  518.     konto.change_button = guiCreateButton ( 0.05, 0.5, 0.9, 0.15, txt[language], true, konto.change )
  519.     addEventHandler ( "onClientGUIClick", konto.change_button, konto_f_onClientGUIClick )
  520.     local txt = {"Zamknij","Close","arabic"}
  521.     konto.change_button_close = guiCreateButton ( 0.05, 0.75, 0.9, 0.15, txt[language], true, konto.change )
  522.     addEventHandler ( "onClientGUIClick", konto.change_button_close, konto_f_onClientGUIClick )
  523.    
  524.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement