dranton17 Posted September 5, 2011 Share Posted September 5, 2011 I managed to make a script that when a player make a kill gets +100$ . But everytime i reconnect the money is reseted to 1000 (default value that i put) . How can i save the money he have when he log out and when he relog he get the same money he had last time . Also i thought about a little script about deposit money somewhere so not losing them when you die . I know how to make it but how do i save the money that have been deposited , and when they relog the money are still there ... Smth like this : function deposit(thePlayer, command, amount) local money = getPlayerMoney(thePlayer) if (money+1>amount) takePlayerMoney (thePlayer, tonumber(amount) ) --Here i don't know how to store the money outputChatBox("You have stored " amount " dollars in your bank account") else outputChatBox("You don't have so much money!") end end addCommandHandler("deposit", deposit) *Also i want to know how to show a tip or a text only to a player . I must write outputChatBox (thePlayer , "Hey!" ) ? *How can i output coloured text ? Red , blue ? And when output a text how can i make it on separate lines or i must put more output ? I want to make a /rules command *And how can i add any column to the table ? Link to comment
dranton17 Posted September 5, 2011 Author Share Posted September 5, 2011 Also i have this login gui script . How can i add a register button too ? function createLoginWindow() local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 wdwLogin = guiCreateWindow(X, Y, Width, Height, "Please Log In", true) -- define new X and Y positions for the first label X = 0.0825 Y = 0.2 -- define new Width and Height values for the first label Width = 0.25 Height = 0.25 -- create the first label, note the final argument passed is 'wdwLogin' meaning the window -- we created above is the parent of this label (so all the position and size values are now relative to the position of that window) guiCreateLabel(X, Y, Width, Height, "Username", true, wdwLogin) -- alter the Y value, so the second label is slightly below the first Y = 0.5 guiCreateLabel(X, Y, Width, Height, "Password", true, wdwLogin) X = 0.415 Y = 0.2 Width = 0.5 Height = 0.15 edtUser = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) Y = 0.5 edtPass = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) -- set the maximum character length for the username and password fields to 50 guiEditSetMaxLength(edtUser, 50) guiEditSetMaxLength(edtPass, 50) X = 0.415 Y = 0.7 Width = 0.25 Height = 0.2 btnLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwLogin) -- make the window invisible guiSetVisible(wdwLogin, false) end addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () -- create the log in window and its components createLoginWindow() -- output a brief welcome message to the player outputChatBox("Welcome to Mountain Fort . Please log in !") -- if the GUI was successfully created, then show the GUI to the player if (wdwLogin ~= nil) then guiSetVisible(wdwLogin, true) else -- if the GUI hasnt been properly created, tell the player outputChatBox("An unexpected error has occurred and the log in GUI has not been created.") end -- enable the players cursor (so they can select and click on the components) showCursor(true) -- set the input focus onto the GUI, allowing players (for example) to press 'T' without the chatbox opening guiSetInputEnabled(true) end ) function clientSubmitLogin(button,state) if button == "left" and state == "up" then -- get the text entered in the 'username' field local username = guiGetText(edtUser) -- get the text entered in the 'password' field local password = guiGetText(edtPass) -- if the username and password both exist if username and password then -- trigger the server event 'submitLogin' and pass the username and password to it triggerServerEvent("submitLogin", getRootElement(), username, password) -- hide the gui, hide the cursor and return control to the player guiSetInputEnabled(false) guiSetVisible(wdwLogin, false) showCursor(false) else -- otherwise, output a message to the player, do not trigger the server -- and do not hide the gui outputChatBox("Please enter a username and password.") end end end Link to comment
dranton17 Posted September 5, 2011 Author Share Posted September 5, 2011 Also how can i create admin ? I didn't understand the whole part with ACL . How do i set my account on admin ? Link to comment
bandi94 Posted September 5, 2011 Share Posted September 5, 2011 in acl search and add this for output use client side and ouputChatBox("text",red,green,blue) or on server side outputChatBox("text",theplayer,red,green,blue) Link to comment
BinSlayer1 Posted September 5, 2011 Share Posted September 5, 2011 also how can I play MTA? Why don't you just start by reading up the wiki so you can get a general knowledge about MTA and scripting https://wiki.multitheftauto.com/wiki/Main_Page Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now