Jump to content

G-Stefan

Members
  • Posts

    205
  • Joined

  • Last visited

Everything posted by G-Stefan

  1. ATENTIE!!!!! In acest topic nu va voi invata EU cum sa faceti scripting Scripturile folosescun limbaj numit LUA.Pentru a sti scripting trebuie sa invezi acest limbaj(LUA este alfabetul iar scriptingul in mtasa sunt propozitiile/frazele https://www.lua.org/pil/contents.html Dupa ce stapanesti LUA trebuie sa inveti sa faci scripturi Acest lucru il poti face accesand https://wiki.multitheftauto.com/wiki/Main_Page in sectiunea Scripting de pe Main_Page Un lucru care ajuta foarte mult este PRACTICA Dupa ce ai invatat ceva pune acel lucru in practica Cum? -incearca sa-ti faci resursele tale proprii(Ia=o incet,nu te grabi sa inveti Advanced Scripting ca nu iti va reusii) ex:Fa resurse care sa iti scriu un mesaj atunci cand faci un lucru Event-urile,functiile MTA de pe wiki au o gramada de exemple! Uite-te pe ele si incearca sa intelegi ce fac(pe wiki la exemple ti se da mura in gura ) Degeaba incerci sa faci un gamemode(ex:RP) daca tu stii sa faci un script in care sa scrii un mesaj Dupa ce stapanesti limbajul LUA,stii ceva scripting incearca sa-ti faci resursele tale proprii Cum?: -gandeste-te ce resursa vrei sa faci(nu foarte complexa) -planifica ce vrei sa faca aceasta resursa /cum sa arate etc... -transpune planurile in limbaj LUA Site-ul https://forum.multitheftauto.com/index.php contine topicuri despre scripting cacalau Uite-te peste ele,vezi ce problema au,vezi cum s-au rezolvat etc.. Dupa ceva timp in care exersezi incearca sa faci resurse mai complexe !Asa NU: De la o resursa in care iti scrie coordonatele la care te aflii la un login-panel !Asa DA: Dela o resursa in care iti scrie coordonatele la care te aflii la una care iti zice:pozitia ta(x,y,z,interior,dimensiuneetc..),daca te aflii in masina sau nu(daca da in ce masina) Daca ai probleme/nelamuriri wiki-ul si forumul mta:sa iti stau la dispozitite ATENTIE!! Pe forum nimeni nu o sa iti dea mura in gura ASA NU!: Salut imi poate face cineva un login-panel ASA DA! Salut am incercat sa fac un login-panel Codul : .... Cand scriu /debugscript 3 imi da erorile ... Am problemele x,y,etc...
  2. Salut,ma numes Galea Stefan! Joc MTA:SA de mult timp numai ca o perioada m-am lasat de servere pentru a invata scripting. Am o propunere pentru voi,comunitatea romana de mta:sa Din cate am observat(in special din discutii pe acest subforum) au aparut multe servere romanesti care distrug cele originale si faine(GM leaked;150k de inceput,rang gratis,etc..) Idea mea este sa luam fiecare server romanesc de mta sa in parte si sa supunem anumitor voturi: Originalitate(nota de la 1 la 10 + comentarii) Amuzament (nota + comentarii) Calitate scripturi(nota + comentarii) Scripturi leaked(deloc,putine,multe,foarte multe) La ce vreau sa ajunga acest "vot": -la terminarea voturilor voi face un topic cu serverele ok,care merita atentia -sa le oferim jucatorilor(vechi,noi) o idee despre ce server(e) ar trebui sa aleaga -sa reconstruim aceasta comunitate pentru ca este posibil Rog fondatorii sa nu "caracterizeze" serverul lor Va rog dati relpy-uri nu seen-uri Va rog nu incepeti certuri pe acest topic si fiti corecti cand acordati notele(nu luati in calcul conflictele) Toti ziceti ca aceasta comunitate este pierduta dar daca fiecare incearca sa faca ceva poate pana la urma reusim sa o refacem p.s: Desi folosesc de putin timp forumul mta sa asta nu inseamna ca joc de putin timp,nu stiu scripting etc... Multumesc ca v-ati deranjat sa cititi acest topic
  3. Rescrie functia fara bindKey,adauga-i un addCommandHandler si dupa pune un bindKey Ex:function numeFunctie() ... End addCommandHandler("comanda",functie) bindKey(..)
  4. Am nevoie de un om care se pricepe cu DX,Advanced GUI(Daca serverul are succes si o sa am si doantori o sa si platesc)
  5. http://imgur.com/wFG77pz http://imgur.com/zAto5Qh Pareri,idei?
  6. Nu este,uite-te la descriere Daca stii design esti invitatul meu(Ma refer photoshop,guieditor)
  7. Multi Theft Auto : Racers Land Am stat cateva zile analizand fiecare server romanesc Din pacate romanii apreciaza mai nou rp-ul si serverele f vechi M-am gandit serios la treaba asta cu proiectul si am decis sa il refac de la 0 in limba engleză Un asemenea gamemode nu ar rezista nici o luna, mai ales ca romanii de pe mta sunt pe servere de rp si englezesti PROIECTUL VA CONTINUA Daca reușesc sa fac ceva cu acest proiect urmatoarea mea tinta va fi un gm de rp facut de la 0 si mult mult mai avansat Poate am luat o decizie buna, poate nu dar e decizia mea iar majoritatea românilor mă vor înțelege
  8. G-Stefan

    Unire.

    Propun un gamemode unic,ceva fain
  9. G-Stefan

    Unire.

    Ba daca va ganditi serios eu ma bag cu cea mai mare placere Cunostinte scripting(avansat) P.s Nu am nicio intentie de a fura Am proiectul meu propriu Daca faci rost de host si ai strans oameni da-mi pm sau reply
  10. This will be hard!If u wanna try GoodLuck!
  11. EDIT! : Aveti dreptate cand spuneti ca roleplay-ul e deja "expirat" asa ca m-am decis sa fac un gamemode nou,original(voi posta detaliile)
  12. BE CAREFUL! if Condition1 AND Condition2 then body The body will be executed ONLY IF Condition1 is TRUE AND Condition2 is TRUE if Condition1 or Condition2 then body The body will be executed ONLY IF Condition1 is TRUE or Condition2 is TRUE example:if HSteam and (getTeamName(HSteam)=="Admins" OR getTeamName(HSteam)=="Moderators") then ... the example should work
  13. Best solution is to create the objects in .lua !Is not that easy but i think is a solution. OR Find a resource same as guieditor but with dx
  14. Hello I want to ask you if you have/know where to find a custom road pack The pack must containt roads(curve,line,ramp) with the same texture I need this pack because i want to make a roleplay server with a custom map Ex:Custom LS roads(all of them with the same texture) Is important the roads to have the same textures
  15. To do this you need to create your own resource which can do this I think it is hard but it can be accomplished Or the easy way Search on community resources
  16. So if u want to learn to script use: https://wiki.multitheftauto.com/wiki/Main_Page U can learn alot of stuff from wiki and is useful af https://www.lua.org/ Basic lua language(IMPORTANT) After learning lua try this: https://wiki.multitheftauto.com/wiki/Scripting_Introduction Then Try to start with basic scripts(showing a message etc..) After that try to make ur scripts more advanced GUI is very inportant in MTA https://wiki.multitheftauto.com/wiki/Introduction_to_Scripting_the_GUI And wiki functions has alot of examples,look at these too
  17. G-Stefan

    not working

    try addEventHandler("stationGUI",root,guishow) if not working try addEventHandler("stationGUI",resourceRoot,guishow) verify if ur script types are correct in meta(can give errors if not )
  18. Numele sau parola este grestia = Username or password is wrong Numele este invalid!Incearca altul = uername is invalid!Please try another one Parola este invalida!Incearca alta = password is invalid!Please try another one Raspunsul este invalid = answer is invalid Numele acesta este luat ! Te rog incearca altul = Username already taken Variable - Raspunsul = Is a var that must be set when register so you can recover your password if u forget it
  19. The messages arent translated in EN but u can realise what any things do (Sorry 4 my bad ENG)
  20. Hi i am new scripting and i try to make a RP server! Now i am working at a new resource (accounts-system) It contains Login/Register Panel(GUI) Database for accounts(Custom accounts;Dont use mta sa accounts system) And i have some problems with my scripts The resource contains 5 .lua files 1.c_log.reg.gui(Login/Register Panel ) 2.c_log.reg.debug(Contains events with errors) 3.s_database(Loading the database) 4.s_login.validate 5.s_register.validate 1.c_log.reg.gui.lua addEventHandler("onClientResourceStart", resourceRoot, function() acc_guiWindow = guiCreateWindow(608, 470, 384, 430, "Multi Role Play : Inceputul", false) --The window guiWindowSetSizable(acc_guiWindow, false) acc_GuiTabPanel = guiCreateTabPanel(9, 19, 361, 399, false, acc_guiWindow) --TabPanel acc_loginTab = guiCreateTab("Logare", acc_GuiTabPanel) --LoginTab login_userLabel = guiCreateLabel(20, 7, 146, 53, "Nume", false, acc_loginTab) guiSetFont(login_userLabel, "sa-header") login_passwordLabel = guiCreateLabel(20, 65, 146, 53, "Parola", false, acc_loginTab) guiSetFont(login_passwordLabel, "sa-header") login_inputUser = guiCreateEdit(174, 19, 177, 31, "", false, acc_loginTab) --inputUser login_inputPassword = guiCreateEdit(174, 77, 177, 31, "", false, acc_loginTab) --inputPassword acc_loginButton = guiCreateButton(76, 146, 204, 48, "Logheaza-te", false, acc_loginTab) --loginbutton guiSetFont(acc_loginButton, "default-bold-small") guiSetProperty(acc_loginButton, "NormalTextColour", "FFAAAAAA") login_debugLabel = guiCreateLabel(21, 209, 330, 157, "Pentru un GUI mai frumos accesati \n\nSettings\Interface\Skin si alegeti \n\nLighter Black", false, acc_loginTab) --debuglabel guiSetFont(login_debugLabel, "default-small") guiLabelSetColor(login_debugLabel, 255, 0, 0) guiLabelSetHorizontalAlign(login_debugLabel, "center", false) acc_registerTab = guiCreateTab("Inregistrare", acc_GuiTabPanel) --tab register_userLabel = guiCreateLabel(12, 6, 146, 46, "Nume", false, acc_registerTab) guiSetFont(register_userLabel, "sa-header") register_passwordLabel = guiCreateLabel(12, 52, 146, 46, "Parola", false, acc_registerTab) guiSetFont(register_passwordLabel, "sa-header") register_userInput = guiCreateEdit(165, 20, 186, 32, "", false, acc_registerTab) --userinput register_passwordInput = guiCreateEdit(165, 62, 186, 32, "", false, acc_registerTab)--passwordinput register_passRecoveryText = guiCreateLabel(15, 108, 336, 16, " -- Pentru recuperarea parolei --", false, acc_registerTab) guiLabelSetHorizontalAlign(register_passRecoveryText, "center", false) register_passRecoveryQuestion = guiCreateLabel(22, 131, 50, 21, "1 + 1 = ", false, acc_registerTab) guiSetFont(register_passRecoveryQuestion, "default-bold-small") register_inputQuestionAnswer = guiCreateEdit(70, 134, 32, 15, "", false, acc_registerTab)--recoveryinput register_recoveryNote = guiCreateLabel(107, 132, 248, 17, "! Raspunsul trebuie sa fie un numar", false, acc_registerTab) guiSetFont(register_recoveryNote, "default-bold-small") guiLabelSetColor(register_recoveryNote, 255, 0, 0) acc_registerButton = guiCreateButton(69, 159, 240, 59, "Inregistreaza-te", false, acc_registerTab) --register button guiSetFont(acc_registerButton, "default-bold-small") guiSetProperty(acc_registerButton, "NormalTextColour", "FFAAAAAA") register_debugOutput = guiCreateLabel(28, 222, 317, 138, "Pentru un GUI mai frumos accesati \n\nSettings\Interface\Skin si alegeti \n\nLighter Black", false, acc_registerTab) guiSetFont(register_debugOutput, "default-small") guiLabelSetColor(register_debugOutput, 255, 0, 0) guiLabelSetHorizontalAlign(register_debugOutput, "center", false) acc_RecoveryTab = guiCreateTab("Recupereaza cont", acc_GuiTabPanel) recovery_nameLabel = guiCreateLabel(16, 12, 68, 41, "Nume", false, acc_RecoveryTab) guiSetFont(recovery_nameLabel, "default-bold-small") guiLabelSetHorizontalAlign(recovery_nameLabel, "center", false) recovery_userInput = guiCreateEdit(94, 12, 135, 19, "", false, acc_RecoveryTab) recovery_labelPassword = guiCreateLabel(16, 53, 68, 41, "Parola noua", false, acc_RecoveryTab) guiSetFont(recovery_labelPassword, "default-bold-small") guiLabelSetHorizontalAlign(recovery_labelPassword, "center", false) recovery_passwordInput = guiCreateEdit(94, 53, 135, 19, "", false, acc_RecoveryTab) recovery_answerLabel = guiCreateLabel(16, 94, 74, 41, "Raspuns \n intrebare", false, acc_RecoveryTab) guiSetFont(recovery_answerLabel, "default-bold-small") guiLabelSetHorizontalAlign(recovery_answerLabel, "center", false) recovery_answerInput = guiCreateEdit(94, 98, 135, 19, "", false, acc_RecoveryTab) acc_recoveryButton = guiCreateButton(87, 151, 171, 71, "Recupereaza cont", false, acc_RecoveryTab) guiSetFont(acc_recoveryButton, "default-bold-small") guiSetProperty(acc_recoveryButton, "NormalTextColour", "FFAAAAAA") recovery_debugLabel = guiCreateLabel(15, 230, 336, 140, "'Raspuns intrebare' e raspunsul la intrebarea 1 + 1 care \n l-ai dat cand ti-ai facut contul", false, acc_RecoveryTab) guiSetFont(recovery_debugLabel, "default-small") guiLabelSetColor(recovery_debugLabel, 255, 0, 0) guiLabelSetHorizontalAlign(recovery_debugLabel, "center", false) addEventHandler("onClientGUIClick",acc_loginButton,validateLogin) addEventHandler("onClientGUIClick",acc_registerButton,validateRegister) addEventHandler("onClientGUIClick",acc_recoveryButton,vaalidateRecovery) end ) function validateLogin(button,state) panelUser = tostring(guiGetText(login_inputUser)) panelPassword = tostring(guiGetText(login_inputPassword)) if button == "left" and state == "up" then triggerServerEvent("logInToServer",resourceRoot,panelUser,panelPassword) end end function validateRegister(button,state) panelUser = guiGetText(register_userInput) panelPassword = guiGetText(register_passwordInput) panelAnswer = tonumber(guiGetText(register_inputQuestionAnswer)) if button == "left" and state == "up" then triggerServerEvent("registerToServer",resourceRoot,panelAnswer,panelPassword,panelUser) end end function vaalidateRecovery(button,state) panelUser = guiGetText(recovery_userInput) panelPassword = guiGetText(recovery_passwordInput) panelAnswer = guiGetText(recovery_answerInput) if button == "left" and state == "up" then triggerServerEvent("recoverAccount",resourceRoot,panelAnswer,panelPassword,panelUser) end end 2.c_log.reg.debug.lua playerNickName = getPlayerName(getLocalPlayer()) --Login Events addEvent("wrongLoginUser",true) function isLoginUserWrong() guiSetText(login_debugLabel,"Numele sau Parola este \n GRESIT(A)") end addEventHandler("wrongLoginUser",root,isLoginUserWrong) addEvent("succesfullyLoggedIn",true) function isLoginUserAndPasswordRight() guiSetVisible(acc_guiWindow,false) showCursor(false) outputChatBox("Bine ai revenit "..playerNickName.." pe serverul Multi Role Play : Inceputul") end --Register Events addEvent("wrongRegisterUser",true) function isRegisterUserWrong() guiSetText(register_debugOutput,"Numele este invalid \n Incearca alt nume") end addEventHandler("wrongRegisterUser",root,isRegisterUserWrong) addEvent("wrongRegisterPassword",true) function isRegisterPasswordWrong() guiSetText(register_debugOutput,"Parola este invalida \n Incearca alta") end addEventHandler("wrongRegisterPassword",root,isRegisterPasswordWrong) addEvent("wrongRegisterAnswer",true) function isRegisterAnswerWrong() guiSetText(register_debugOutput,"Raspunsul este invalid \n Raspunsul trebuie sa fie \n un NUMAR") end addEventHandler("wrongRegisterAnswer",root,isRegisterAnswerWrong) addEvent("userAlreadyTaken",true) function isUserAlreadyTaken() guiSetText(register_debugOutput,"Numele acesta este luat \n Te rog incearca alt nume") end addEventHandler("userAlreadyTaken",root,isUserAlreadyTaken) addEvent("newAccountCreated",true) function theNewAccountHasBeenCreated() guiSetVisible(acc_guiWindow,false) showCursor(false) outputChatBox("Bine ai venit "..playerNickName.." pe serverul Multi Role Play : Inceputul") end addEventHandler("newAccountCreated",root,theNewAccountHasBeenCreated) 3.s_database.lua RootNode = xmlLoadFile("accounts.xml") addEventHandler("onResourceStart",resourceRoot, function () if RootNode then outputDebugString("Baza de date accounts.xml a fost incarcata") end end ) 4.s_login.validate.lua local vaildUser = 0 local vaidPassword = 0 addEvent("logInToServer",true) function isAccountVaild(panelUser,panelPassword) if RootNode then AccountsNode = xmlNodeGetChildren(RootNode) for i,node in ipairs (AccountsNode) do NodeOfAccount = xmlFindChild(RootNode,"cont",tonumber(i)) otherUsers = xmlNodeGetAttribute(NodeOfAccount,"nume") otherPasswords = xmlNodeGetAttribute(NodeOfAccount,"parola") if panelUser == tostring(otherUsers) then vaildUser = 1 if panelPassword == tostring(otherPasswords) then vaidPassword = 1 end end end end if vaildUser == 1 and vaidPassword == 1 then triggerClientEvent("succesfullyLoggedIn",resourceRoot) xmlSaveFile(RootNode) else triggerClientEvent("wrongLoginUser",resourceRoot) end vaildUser = 0 vaidPassword = 0 end addEventHandler("logInToServer",root,isAccountVaild) 5.s_register.validate.lua local vaildUser = 1 addEvent("registerToServer",true) function createNewAccount(panelUser,panelPassword,panelAnswer) if RootNode then AccountsNode = xmlNodeGetChildren(RootNode) for i,node in ipairs (AccountsNode) do local NodeOfAccount = xmlFindChild(RootNode,"cont",i) local otherUsers = xmlNodeGetAttribute(NodeOfAccount,"nume") if panelUser == tostring(otherUsers) then vaildUser = 0 end end if vaildUser == 1 then if panelUser then if panelPassword then if panelAnswer then local accNode = xmlCreateChild(RootNode,"cont") xmlNodeSetAttribute(accNode,"nume",panelUser) xmlNodeSetAttribute(accNode,"parola",panelPassword) xmlNodeSetAttribute(accNode,"raspuns",panelAnswer) triggerClientEvent(getRootElement(),"newAccountCreated",resourceRoot) xmlSaveFile(RootNode) else triggerClientEvent(getRootElement(),"wrongRegisterAnswer",resourceRoot) end else triggerClientEvent(getRootElement(),"wrongRegisterPassword",resourceRoot) end else triggerClientEvent(getRootElement(),"wrongRegisterUser",resourceRoot) end else triggerClientEvent(getRootElement(),"userAlreadyTaken",resourceRoot) end vaildUser = 0 end end addEventHandler("registerToServer",root,createNewAccount) So these are the scripts (s_ = server c_ = client) The GUI is working The database loader is working Problems When i press a tab in tab panel the debugLabels (The labels which output errors) changes and it is supposet to change only if user/password is wrong At register panel the debugLabel will output user already taken(translated) whatever i type in the EditBoxes At login panel same error The account dont save in accounts.xml
  21. The client script is: GUIEditor = { button = {}, window = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(0, 0, 312, 206, "Welcome to ...", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.button[1] = guiCreateButton(31, 31, 239, 51, "Login", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "sa-header") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF1BFB03") GUIEditor.button[2] = guiCreateButton(31, 110, 239, 51, "Register", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[2], "sa-header") guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFFDE801") addEventHandler("onClientGUIClick", GUIEditor.button[2], openRegisterPanel, false) end ) function openRegisterPanel(button,state) if button == "left" and state == "up" then guiSetVisible(GUIEditor.window[1],false) registerWindow = guiCreateWindow(0, 0, 239, 328, "Register if you dont have an account", false) guiWindowSetSizable(registerWindow, false) userLabel = guiCreateLabel(10, 27, 88, 45, "User", false, registerWindow) guiSetFont(userLabel, "sa-header") guiLabelSetColor(userLabel, 253, 232, 1) editUser = guiCreateEdit(105, 37, 124, 26, "", false, registerWindow) passLabel = guiCreateLabel(10, 82, 88, 45, "Pass", false, registerWindow) guiSetFont(passLabel, "sa-header") guiLabelSetColor(passLabel, 253, 232, 1) editPass = guiCreateEdit(105, 91, 124, 26, "", false, registerWindow) registerButton = guiCreateButton(21, 148, 198, 57, "Register", false, registerWindow) guiSetFont(registerButton, "sa-header") guiSetProperty(registerButton, "NormalTextColour", "FF36FC01") backButton = guiCreateButton(20, 235, 198, 57, "Back", false, registerWindow) guiSetFont(backButton, "sa-header") guiSetProperty(backButton, "NormalTextColour", "FFFD0000") addEventHandler("onClientGUIClick",registerButton,accountsDataBase, false) end end function accountsDataBase(button,state) if button == "left" and state == "up" then newUser = tostring(guiGetText(editUser)) newPass = tostring(guiGetText(editPass)) if newUser and newPass then triggerServerEvent("saveAccountInDatabase",resourceRoot) else outputChatBox("Please insert an username/password") end end end addCommandHandler("test",accountsDataBase) The server script: auxVar = 0 addEvent("saveAccountInDatabase",true) function xmlAccountsDataBase() accountsXML = xmlLoadFile("accounts.xml") if accountsXML then outputChatBox("accounts.xml loaded") accountsTable = xmlNodeGetChildren(accountsXML) for i,v in ipairs (accountsTable) do if newUser == tostring(v) then auxVar = 1 end end if auxVar == 0 then accountUsername = xmlCreateChild(accountsXML,newUser) xmlNodeSetAttribute(accountUsername,"password",newPass) xmlNodeSetAttribute(accountUsername,"money",0) end xmlSaveFile(accountsXML) else outputChatBox("creating accounts.xml") xmlCreateFile("accounts.xml","accounts") accountUsername = xmlCreateChild(accountsXML,newUser) xmlNodeSetAttribute(accountUsername,"password",newPass) xmlNodeSetAttribute(accountUsername,"money",0) xmlSaveFile(accountsXML) end end addEventHandler("saveAccountInDatabase",root,xmlAccountsDataBase) It gives me errors at al xml functions (request node at argument 1)
×
×
  • Create New...