
maky55
Members-
Posts
57 -
Joined
-
Last visited
Everything posted by maky55
-
It still doesn't seem to be working :3. Same problem as before, it doesn't tell my my username and password is wrong, and the button doesn't do anything. Still the same warnings as before . Sorry if this is bothering anyone i'm just a beginner at doing this . Maybe if anyone other then me could test the scripts to see if I'm doing something wrong?
-
and one more: ERROR: Loading script failed: [gameplay]\Server\Client.lua:12: '' expected near 'end'
-
ERROR: Loading script failed: [gameplay]\Server\Server.lua:18: '' expected near 'end' ERROR: Loading script failed: [gameplay]\Server\Client.lua:12: '' expected near 'end'
-
Server: local posX, posY, posZ = 2584.9523925781, -2209.318359375, 1.9927320480347 function loginHandler(player, username, password) local account = getAccount(username, password) if (account ~= false) then if (logIn(player, username, password) == true) then spawnPlayer(source, posX, posY, posZ) fadeCamera(source, true) setCameraTarget(source, source) setPedArmor(source, 100) setElementModel(source, 287) outputChatBox("Wow, you actually made it on", player) triggerClientEvent(player, "hideLoginWindow", getRootElement()) end else outputChatBox("Invalid username or password!",player) end end addEvent("submitLogin", true) addEventHandler("submitLogin", getRootElement(), loginHandler) function dieInServer() spawnPlayer(source, posX, posY, posZ) fadeCamera(source, true) setCameraTarget(source, source) setPedArmor(source, 100) setElementModel(source, 287) outputChatBox("And.... BAM! You're back!", source) end addEventHandler("onPlayerWasted",getRootElement(),dieInServer) Client: local localPlayer = getLocalPlayer() local playerName = getPlayerName(localPlayer) function clientSubmitLogin(button,state) if button == "left" and state == "up" then local username = guiGetText(edtUser) local password = guiGetText(edtPass) if username and password then triggerServerEvent("submitLogin", getRootElement(), localPlayer, username, password) else outputChatBox("Please enter a username and password.") end end end 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) X = 0.0825 Width = 0.25 Height = 0.25 guiCreateLabel(X, Y, Width, Height, "Username", true, wdwLogin) Y = 0.5 guiCreateLabel(X, Y, Width, Height, "Password", true, wdwLogin) X = 0.415 Y = 0.25 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) guiEditSetMaxLength(edtUser, 20) guiEditSetMaxLength(edtpass, 20) X = 0.415 Y = 0.7 Width = 0.25 Height = 0.20 bntLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwLogin) addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin) end addEventHandler("onClientResourceStart", getResourceRootElement(), function () createLoginWindow() outputChatBox("Welcome to My MTA:SA Server, please log in.") showCursor(true) guiSetInputEnabled(true) end ) function hideLoginWindow() guiSetInputEnabled(false) guiSetVisible(wdwLogin, false) showCursor(false) end addEvent("hideLoginWindow", true) addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow) Meta: (For the meta, I've tried both gamemode and script. Neither work <meta> <info author="Tiger" version="1.0" type="gamemode" name="Server" description="a simple spawn script" /> <script src="Server.lua" /> <script src="Client.lua" type="client" /> </meta>
-
No error comes up. The same two warnings are there. I created a new account to test it on and gave it admin. Username: admin Password: password. I typed it all in, and clicked the button. The button could be clicked, but it didn't do anything. Normally if the password/username was bad, it would put in the chatbox 'Invalid username or password!' but it didn't. I think the problem is the button.
-
Still doesn't work, although the output chatbox works now. Ill upload a youtube clip of it now.
-
Still didn't work The WARNINGS are the same as last time I've noticed another thing, it doesn't output this to chatbox: Welcome to My MTA:SA Server, please log in.
-
Also debugscript gives me two warnings: http://imgur.com/ddLk9YU Which would be these two lines: addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin) guiEditSetMaxLength(edtpass, 20) And putting it in admin didn't change a thing.
-
Whats the command to give it admin privalages? or do I have to put it in the ACL?
-
No sadly it still isn't working :\. Maybe it's a problem with the server side script? local posX, posY, posZ = 2584.9523925781, -2209.318359375, 1.9927320480347 function loginHandler(player, username, password) local account = getAccount(username, password) if (account ~= false) then if (logIn(player, username, password) == true) then spawnPlayer(source, posX, posY, posZ) fadeCamera(source, true) setCameraTarget(source, source) setPedArmor(source, 100) setElementModel(source, 287) outputChatBox("Wow, you actually made it on", player) triggerClientEvent(player, "hideLoginWindow", getRootElement()) end else outputChatBox("Invalid username or password!",player) end end addEvent("submitLogin", true) addEventHandler("submitLogin", getRootElement(), loginHandler) function dieInServer() spawnPlayer(source, posX, posY, posZ) fadeCamera(source, true) setCameraTarget(source, source) setPedArmor(source, 100) setElementModel(source, 287) outputChatBox("And.... BAM! You're back!", source) end addEventHandler("onPlayerWasted",getRootElement(),dieInServer)
-
Why don't you just use the normal RPG, and stop people from using the heat seeker?
-
Hello again . I've only just had time to test it, and this time the login panel shows, but the same problem as before, when you click the button, it doesn't do anything. When I activate debugscript 3, I get no errors, only 4 warnings: -- WARNING: Server\Client.lua:26: Bad argument @ 'addEventHandler' [expected element at argument 2, got nil] -- WARNING: Server\Client.lua:35: Bad argument @ 'addEventHandler' [expected element at argument 2, got nil] -- WARNING: Server\Client.lua:45: Bad argument @ guiEditSetMaxLength' [expected gui-element at argument 1, got nil] -- WARNING: Server\Client.lua:46: Bad argument @ 'addEventHandler' [expected element at argument 2, got nil] these are the lines it's got problems with: addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) -- For 3 of them guiEditSetMaxLength(edtUser, 20) -- For 1 of them. here is the full client code: local localPlayer = getLocalPlayer() local playerName = getPlayerName(localPlayer) function clientSubmitLogin(button,state) if button == "left" and state == "up" then local username = guiGetText(edtUser) local password = guiGetText(edtPass) if username and password then triggerServerEvent("submitLogin", getRootElement(), localPlayer, username, password) else outputChatBox("Please enter a username and password.") end end end 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) addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) X = 0.0825 Y = 0.25 Width = 0.25 Height = 0.25 guiCreateLabel(X, Y, Width, Height, "Username", true, wdwLogin) Y = 0.5 guiCreateLabel(X, Y, Width, Height, "Password", true, wdwLogin) addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) X = 0.415 Y = 0.25 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) guiEditSetMaxLength(edtUser, 20) guiEditSetMaxLength(edtpass, 20) addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin) X = 0.415 Y = 0.7 Width = 0.25 Height = 0.20 bntLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwLogin) guiSetVisible(wdwLogin, false) end addEventHandler("onClientResourceStart", getResourceRootElement(), function () createLoginWindow() outputChatBox("Welcome to My MTA:SA Server, please log in.") if (wdwLogin ~= nil) then guiSetVisible(wdwLogin, true) else outputChatBox("An unexpected error has occurred and the log in GUI has not been created.") end showCursor(true) guiSetInputEnabled(true) end ) function hideLoginWindow() guiSetInputEnabled(false) guiSetVisible(wdwLogin, false) showCursor(false) end addEvent("hideLoginWindow", true) addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow)
-
Crap.. I know that I forgot something so simple.
-
Meta: <meta> <info author="Tiger" version="1.0" type="gamemode" name="Server" description="a simple spawn script" /> <script src="Server.lua" /> <script src="Client.lua" /> </meta> Client: local localPlayer = getLocalPlayer() local playerName = getPlayerName(localPlayer) function clientSubmitLogin(button,state) if button == "left" and state == "up" then local username = guiGetText(edtUser) local password = guiGetText(edtPass) if username and password then triggerServerEvent("submitLogin", getRootElement(), localPlayer, username, password) else outputChatBox("Please enter a username and password.") end end end 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) addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) X = 0.0825 Y = 0.25 Width = 0.25 Height = 0.25 guiCreateLabel(X, Y, Width, Height, "Username", true, wdwLogin) Y = 0.5 guiCreateLabel(X, Y, Width, Height, "Password", true, wdwLogin) addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) X = 0.415 Y = 0.25 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) guiEditSetMaxLength(edtUser, 20) guiEditSetMaxLength(edtpass, 20) addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin) X = 0.415 Y = 0.7 Width = 0.25 Height = 0.20 bntLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwLogin) guiSetVisible(wdwLogin, false) end addEventHandler("onClientResourceStart", getResourceRootElement(), function () createLoginWindow() outputChatBox("Welcome to My MTA:SA Server, please log in.") if (wdwLogin ~= nil) then guiSetVisible(wdwLogin, true) else outputChatBox("An unexpected error has occurred and the log in GUI has not been created.") end showCursor(true) guiSetInputEnabled(true) end ) function hideLoginWindow() guiSetInputEnabled(false) guiSetVisible(wdwLogin, false) showCursor(false) end addEvent("hideLoginWindow", true) addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow) Server: local posX, posY, posZ = 2584.9523925781, -2209.318359375, 1.9927320480347 function loginHandler(player, username, password) local account = getAccount(username, password) if (account ~= false) then if (logIn(player, username, password) == true) then spawnPlayer(source, posX, posY, posZ) fadeCamera(source, true) setCameraTarget(source, source) setPedArmor(source, 100) setElementModel(source, 287) outputChatBox("Wow, you actually made it on", player) triggerClientEvent(player, "hideLoginWindow", getRootElement()) end else outputChatBox("Invalid username or password!",player) end end addEvent("submitLogin", true) addEventHandler("submitLogin", getRootElement(), loginHandler) function dieInServer() spawnPlayer(source, posX, posY, posZ) fadeCamera(source, true) setCameraTarget(source, source) setPedArmor(source, 100) setElementModel(source, 287) outputChatBox("And.... BAM! You're back!", source) end addEventHandler("onPlayerWasted",getRootElement(),dieInServer)
-
Sorted that bit, the error it's giving now is: ERROR: [gameplay]\Server\Client.lua:1: attempt to call global 'getLocalPlayer' (A nill value)
-
Thanks, but it now says: ERROR: Client (asdf) triggered serverside event requestLODsClient, but event is not added serverside.
-
Hi, thanks for the reply. Sadly this didn't work and it still had the same problem. You also made an error in the script: addEventHandler("submitLogin", getRootElement(), LoginHandler) It should be loginHandler, with lowercase l. I changed it but it still doesnt work. This is the video of it: https://www.youtube.com/watch?v=YEU5lz7Gj6g&feature=youtu.be
-
Really, all I want is to know what's wrong with this. It's just so I can log onto a local server for fun without having to type /login all the time. The login window shows up, you can type things in and you can click the buttons, but the buttons don't do anything.
-
Hello men! Well as you know, i'm an lua newb. I was following the wiki on a basic login screen, and i've to the point where you can click login, and it knows you click it, but does nothing . I don't know what the problem is, but heres the script I tried to put together: client function clientSubmitLogin(button,state) if button == "left" and state == "up" then local username = guiGetText(edtUser) local password = guiGetText(edtPass) if username and password then triggerServerEvent("submitLogin", getRootElement(), username, password) guiSetInputEnabled(false) guiSetVisible(wdwLogin, false) showCursor(false) else outputChatBox("Please enter a username and password.") end end end 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) addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) X = 0.0825 Y = 0.25 Width = 0.25 Height = 0.25 guiCreateLabel(X, Y, Width, Height, "Username", true, wdwLogin) Y = 0.5 guiCreateLabel(X, Y, Width, Height, "Password", true, wdwLogin) addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) X = 0.415 Y = 0.25 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) guiEditSetMaxLength(edtUser, 20) guiEditSetMaxLength(edtpass, 20) addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) X = 0.415 Y = 0.7 Width = 0.25 Height = 0.20 bntLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwLogin) guiSetVisible(wdwLogin, false) addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) end addEventHandler("onClientResourceStart", getResourceRootElement(), function () createLoginWindow() outputChatBox("Welcome to My MTA:SA Server, please log in.") if (wdwLogin ~= nil) then guiSetVisible(wdwLogin, true) else outputChatBox("An unexpected error has occurred and the log in GUI has not been created.") end showCursor(true) guiSetInputEnabled(true) end ) Server local spawnX, spawnY, spawnZ = 2584.9523925781, -2209.318359375, 1.9927320480347 function loginHandler(username, password) if username =="" and password == "" then if (client) then spawnPlayer(client, spawnX, spawnY, spawnZ) fadeCamera(client, true) setCameraTarget(client, cient) setElementModel(source, 287) setPedArmor (source, 100) outputChatBox("Welcome to the test server!", client) end else outputChatBox("Invalid username or password", client) end end It looks really simple, but I don't know whats wrong. It's all from the wiki, but the wiki doesn't show you what the finished serverside and clientside should look like so I'm lost. Also, what do I put in this bit for username and password?: function loginHandler(username, password) if username =="" and password == "" then if (client) then Please help with this
-
NVM I think i've figured it out!
-
Hey again! Last year, I had a script that could make gates that open and close. This is the code: gate = createObject( 975, 2585.6999511719, -2125.1000976563, 4.1999998092651, 0, 0, 0 ) --Object ID (Airport Gate=978) & Co-Ordinates of your gates start of position. gatecol = createColCircle ( 2581.1999511719, -2125.3999023438, 15 ) --Co-Ordinates "X" and "Y" and the radius, I use 15 as default. function openagates ( thePlayer ) if ( getElementType ( thePlayer ) == "player" ) then if ( isPlayerInGroup ( thePlayer ) ) then moveObject ( gate, 2000, 2593.8000488281, -2124.8000488281, 4.1999998092651 ) --The speed in which 7000 is slow and 2000 is fast to open, Co-Ordinates for the gate to move to. else outputChatBox ( "Sorry, you can not open this gate as you are not in the specified groups", thePlayer ) end end end addEventHandler ( "onColShapeHit", gatecol, openagates ) --Event Handler to trigger the function function closeagates ( thePlayer ) if ( getElementType ( thePlayer ) == "player" ) then if ( isPlayerInGroup ( thePlayer ) ) then moveObject ( gate, 2000, 2585.6999511719, -2125.1000976563, 4.1999998092651 ) --The speed in which 7000 is slow and 1000 is fast to open, Co-Ordinates for the gate to close. end end end addEventHandler ( "onColShapeLeave", gatecol, closeagates ) --Event Handler to trigger the function function isPlayerInGroup ( thePlayer ) local accountName = getAccountName ( getPlayerAccount ( thePlayer ) ) if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) or isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Super Moderator" ) ) or isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Moderator" ) ) ) then return true else return false end end That's okay, and if you're making one gate, it does it's job. But I wanted to make more then one gate. I tried to do it like this: But it doesn't work. Every gate has the same code as gate one, except the co-ordinates are different. What happens is, only the last gate actually opens and none others, they are there but stay still. But I've found that if you do each gate separately (EX, removing all the code except what's needed for one gate), then one gate works at a time, but not all together. I've also tried multiple files and putting them into folders. The debugger doesn't give me any errors, and i'm stuck.
-
I figured out where the missing end was! function createVehicleForPlayer(thePlayer, command, vehicleModel) if ( getElementType ( thePlayer ) == "player" ) then if ( isPlayerInGroup ( thePlayer ) ) then local x,y,z = getElementPosition(thePlayer) x = x + 5 local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z) if (createdVehicle == false) then outputChatBox("Lol. Aint this a bitch? The vehicle isn't there..",thePlayer) end end end end addCommandHandler("createvehicle", createVehicleForPlayer) function isPlayerInGroup ( thePlayer ) local accountName = getAccountName ( getPlayerAccount ( thePlayer ) ) if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) or isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Super Moderator" ) ) or isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Moderator" ) ) ) then return true else return false end end
-
Hello again . Still newbie at this script thing. In the wiki tutorial, it showed how you can type /createvehicle 456 and it would create that vehicle for you. I've tried to edit this so that only people with Moderator, Super Moderator or Admins can do this, but I'm stuck. This is what i've got so far: function createVehicleForPlayer(thePlayer, command, vehicleModel) if ( getElementType ( thePlayer ) == "player" ) then if ( isPlayerInGroup ( thePlayer ) ) then local x,y,z = getElementPosition(thePlayer) x = x + 5 local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z) if (createdVehicle == false) then outputChatBox("Lol. Aint this a bitch? The vehicle isn't there..",thePlayer) end end end addCommandHandler("createvehicle", createVehicleForPlayer) function isPlayerInGroup ( thePlayer ) local accountName = getAccountName ( getPlayerAccount ( thePlayer ) ) if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) or isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Super Moderator" ) ) or isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Moderator" ) ) ) then return true else return false end end and this is the debug message it's giving me: ERROR: Loading script failed: [gameplay]\VehicleSpawn\Script.lua:22: 'end' expected (to close 'function' at line 1) near '' If someone could explain what the error is telling me that would help . Thanks again!
-
Thank you! Sorry I'm new and didn't think of using debug. After I had posted this, I had fixed it another way: function deathTimer() player=source setTimer(deathHandler,5000,1,player) --https://wiki.multitheftauto.com/wiki/SetTimer end But the way you put it seems alot simpler! Thank you for your help. Ill be sure to debug next time