
megaman54
Members-
Posts
245 -
Joined
-
Last visited
Everything posted by megaman54
-
Well here is the server part, its only in debug stage so it doesnt have any actual stuff yet: function debug() outputChatBox("triggered: server_DoLogin") end addEvent("server_DoLogin", true) addEventHandler("serer_DoLogin", getRootElement(), debug) function debug2() outputChatBox("triggered: server_DoRegister") end addEvent("server_DoRegister", true) addEventHandler("server_DoRegister", getRootElement(), debug2) function openLoginScreenOnRequest(thePlayer) triggerClientEvent(thePlayer, "client_openLoginScreen", getRootElement()) outputChatBox("loginScreen tirggered!") end addEvent("server_requestOpenLoginScreen", true) addEventHandler("server_requestOpenLoginScreen", getRootElement(), openLoginScreenOnRequest) and here is for buttons: loginButton = guiCreateButton(10,108,84,27,"Login",false,GUIEditor_Tab[1]) clearButtonLogin = guiCreateButton(220,108,84,27,"Clear",false,GUIEditor_Tab[1]) registerButton = guiCreateButton(13,117,102,30,"Register",false,GUIEditor_Tab[2]) clearButtonRegister = guiCreateButton(199,117,102,30,"Clear",false,GUIEditor_Tab[2])
-
Hello! I'm making a login GUI for my server but i have faced this problem: when i press the gui button, nothing happens. I have scripted event for that button but for some reason it wont work. Here is my code: addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()), function ( ) if(source == loginButton)then local username = guiGetText(usernameBoxLogin) local password = guiGetText(passwordBoxLogin) if(username)then if(password)then triggerServerEvent("server_DoLogin", getRootElement(), username, password) end end elseif(source == loginClearButton)then guiSetText(usernameBoxLogin, "") guiSetText(passwordBoxLogin, "") elseif(source == registerButton)then local regUsername = guiGetText(usernameBoxRegister) local regPassword = guiGetText(passwordBoxRegister) local regEmail = guiGetText(emailBoxRegister) if(regUsername)then if(regPassword)then if(regEmail)then triggerServerEvent("server_doRegister", getLocalPlayer()) end end end elseif(source == registerClearButton)then guiSetText(usernameBoxRegister, "") guiSetText(passwordBoxRegister, "") guiSetText(emailBoxRegister, "") end end ) It might be because of those "elseif" and "if" things or some misplaced "end" 's but i'm not so good with those "if" 's yet...
-
Thanks! It looks kinda hard but maybe i will learn
-
Is there any tutorial on how to use tables in mta lua scripting? Or can someone teach me?
-
Add this if possible: https://forum.multitheftauto.com/viewtopic.php?f=108&t=36514
-
even i do that ;P great tool! Thanks guys ! V1.1 has been released. Changes: New design More meta tags added Clear and New Line buttons added for the text window
-
Yes, thanks man, it works perfectly now!
-
Ok, i made a delete button but now it gives this warning when i select account from the list and press delete: WARNING: accountManager\client.lua:21: Bad Argument @ 'triggerServerEvent' [Expected element at argument 2, got string 'testaccount'] Clientside code: function buttonHandler() if(source == refreshButton)then triggerServerEvent("serverGetAccounts", localPlayer, localPlayer) elseif(source == deleteButton)then local row,col = guiGridListGetSelectedItem(accountGrid) if row and col and row ~= -1 and col ~= -1 then local targetAccount = guiGridListGetItemText(accountGrid, row, 1) triggerServerEvent("requestAccountDelete", targetAccount) end end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), buttonHandler) (Only the button handling function) Serverside: function deleteAccount(targetAccount) removeAccount(targetAccount) end addEvent("requestAccountDelete", true) addEventHandler("requestAccountDelete", getRootElement(), deleteAccount)
-
Hello! I'm trying to make a account manager with a ingame GUI but i'm stuck on the part where i must place the accounts to a gridlist. The error is: ERROR: Client triggered serverside event serverGetAccounts, but event is not added serverside And the other problem is that it wont show the accounts in the list. So here is my code what i have created so far: Serverside: function getTheAccounts() accountTable = getAccounts() if(#accountTable == 0)then outputDebugString("No accounts in database!") else triggerClientEvent("serverGivesAccounts", getResourceRootElement(getThisResource()), getRootElement(), accountTable) end end addEvent("serverGetAccounts", true) addEventHandler("serverGetAccounts", getRootElement(), getTheAccounts) Clientside: function createAccountWindow() mainWnd = guiCreateWindow(307, 256, 268, 361, "Account Manager", false) accountGrid = guiCreateGridList(9, 23, 249, 228, false, mainWnd) guiGridListSetSelectionMode(accountGrid, 2) refreshButton = guiCreateButton(12, 258, 91, 26, "Refresh", false, mainWnd) guiGridListAddColumn(accountGrid, "Account Name", 0.3) guiSetVisible(mainWnd, true) showCursor(true) end addCommandHandler("accountmanager", createAccountWindow) function refreshGridlist(accountTable) guiGridListClear(accountGrid) triggerServerEvent("serverGetAccounts", getRootElement()) for index, accounts in ipairs(getElementsByType("account")) do local row = guiGridListAddRow(accountGrid) guiGridListSetItemText(accountGrid, row, 1, tostring(accountTable), false, false) end end addEvent("serverGivesAccounts", true) addEventHandler("serverGivesAccounts", getRootElement(), refreshGridlist) addCommandHandler("refac", refreshGridlist)
-
I made a simple and easy to use meta generator. It is made in Visual Basic 2008. I maybe update this later and add more of the avaible meta tags. Screenshot: Virus check: http://www.virustotal.com/file-scan/report.html?id=3a49ec615c903e351b9258e5a6d6022b29484405ae09ad8561607da6a9f15609-1318860430 Download: http://adf.ly/3FqQa (Use this to help me by viewing a little advert ) http://www.mediafire.com/?2z7oq169ulomxmh (Or use this to go straight to the download ) Old Versions: -------------------------------------------------------------------------------- 1.0: Download: [url]http://adf.ly/3DZJj[/url] Download: [url]http://www.mediafire.com/?zwpn4qttwcy4v50[/url] Picture: [url]http://img838.imageshack.us/img838/6613/screenshotbuz.png[/url] Virus Check: [url]http://www.virustotal.com/file-scan/report.html?id=5e211c835c13dc9ffe6521d74ac15b0e9dbee97cc82ba267868dd30f69a99725-1318690087[/url] -------------------------------------------------------------------------------- I hope this is useful to atleast someone.
-
Hi! I'm trying to get my server name under the minimap, like the MTA version number is in the lower right corner. But when i start the script, it goes to the right place on my screen but for some players it is above the minimap and for other it wont show at all. My code is just a simple guiCreateLabel but how to calculate the right position for every screen/resolution?
-
Yes, thanks. I got it working. Thanks!
-
I mean when players add upgrades in the F1 panel of the freeroam resource. I want to prevent that, but only for specific cars.
-
How i can prevent players from adding vehicle upgrades to a specific vehicle?
-
Thanks again !
-
Ahh, i dont really understand so i must make a example.. So its like this? : function calcMsecs(player, command, mSecs) seconds = tonumber(mSecs) / 1000 outputChatBox(seconds, player) end addCommandHandler("msecs", calcMsecs)
-
You need .col files to modify the collisions.
-
Yes, but i need the script to calculate it. I mean, i type a command like this: /calc then it outputs that in seconds. What function should i use for this?
-
What function is that?
-
How to covert milliseconds to seconds?
-
Thanks!
-
Where i should put those files? ...maybe into "c:/program files/notepad++/plugins/APIs" ?
-
It has LUA, but it wont recognize MTA functions
-
I'm not very sure if his question belongs here but i ask anyway. So, is there a MTA LUA syntax "plugin" for notepad++ ? Even a out-dated one will do. I'm sorry if i posted this into a wrong section.
-
Thanks! Now it works great And thanks to Callum for the range-ban info