Snoozy
Members-
Posts
79 -
Joined
-
Last visited
Everything posted by Snoozy
-
What I'm trying to do is to at server start, I have a vehicle system made that I'm attempting to load every vehicle into it's very own string/variable/whatever (Vehicles have NOT been spawned). So I'm able to store every vehicle that I'm loading over a MySQL database into a variable each like for example vehicleInfo[VEHICLEID][owner] In the kinda same way as that, but I need the variable to be accessible outside of that function which the VehicleInfo[idx] = {}; Wouldn't do.
-
I get a error when using setElementData tbh and wont it only work on vehicles that are spawned?
-
Posting only some of the code but this should be enough to get the idea. At start of the lua file: VehicleInfo = {}; Now after that the function starts for loading vehicles Then later up after some queries and some if statements to check if query was successfully this comes: for idx=1, maxve do Then inside the code above there VehicleInfo[idx] = {}; Is located. Means its running through that like 5 times as that's what I got in the database right now creating VehicleInfo[1,2,3,4,5] = {}; However it's located in the for idx=1,maxve do so it seems to be limited to the function Now to test it I made: function Test(theVehicle, seat, jacked) idx = theVehicle VehicleInfo[idx] = {}; outputChatBox("Vehicle: "..theVehicle.."Information:"..VehicleInfo[idx].VehID,source) end addEventHandler("onPlayerVehicleEnter", getRootElement(), Test) This is a new function so it seems that the VehicleInfo doesn't work here. I do get an error but I don't really think it's that important here.
-
Already done that but the problem is that the table VehicleInfo[idx] is required to be inside the loading, else it wouldn't work just tried, the other part is outside of the function but the VehicleInfo[idx] = {}; is inside of the for idx=i,maxve do right after that the VehicleInfo[idx] = {}; is located. Therefore it seems to not work in a function I just added to test which is supposed to output some information when a player enters a vehicle.
-
Okay so I'm rather confused on this, I've now finished my loading system, but after that I just discovered that the stuff that I load into: VehicleInfo = {}; AND VehicleInfo[idx] = {}; Now I'm confused cause I just discovered that this "VehicleInfo" is limited to the function is this cause I placed them inside the function? I'm wondering how to make it like "global" not kinda "local"(Limited to function)
-
Doh... just doh didn't notice that it was [VehID] and not ["VehID"] haha sorry. Thanks
-
Just tried to do following, don't know if that's what you mean tho: for idx=1, maxve do VehicleInfo[idx] = {}; A bit later up in the script after a few querys and if statements VehicleInfo[idx][VehID] = row[1] Tho now I receive the error: table index is nil EDIT: and also VehicleInfo = {}; is at start of the whole function
-
Do I have to define VehicleInfo[idx] of some sort? If so mind showing me how or giving me a hint?
-
I got a problem with attempting to store data. VehicleInfo = {}; I'm currently creating a vehicle loading system but have been having problems making it work so I've debugged every single line in the loading and now I have reached a part I'm unable to fix. The location that I receive this error is: VehicleInfo[idx].VehID = row[1] There are serveral of those ofcourse but that is the first and that's where the error starts. The loading is all fine I tried outputting to chatbox the value of row[1] and it was 1 as supposed.
-
Go into your mysql database and edit the table where user information is stored, change admin level there? To open the mysql database I prefer using heidiSQL, so I suggest getting that if you don't have a tool to open a MySQL db
-
go into your acl.xml file, ? add that at the name="Admin">....-- Add here> You mean like that?
-
Maybe just use createPickup()? think that's the name, it got the green house and that other house icons
-
Well if it's just admins you need to add you can do it through your console -> addaccount
-
Nice man I really love the GUI design for it.
-
I'm having problems since my fuction charaSelected does not seem to work as supposed. I'm first calling the ServerEvent. triggerServerEvent("charSelected",getLocalPlayer()) then it's supposed to: I don't get my name changed, neither does it change the skin, I do however spawn. function charaSelected() spawnPlayer(source, 1910.55, -1714.46, 10, 0,getElementData(source,"CharacterSkin")) setPlayerName(source,getElementData(source,"CharacterName")) fadeCamera(source, true) setCameraTarget(source) end addEvent("charSelected",true) addEventHandler("charSelected",getRootElement(),charaSelected) No errors nor warnings in /debugscript 3. I'm guessing it has something to do with getElementData as the things not working is setPlayerName, which got getElementData same goes for spawnPlayer, it does spawn but doesn't change skin.
-
Is there a /deubscript 3 builtin function for ingame testing? Are you serious? I need to learn to actually read the wiki instead of just flashing through it I guess
-
Okay uhm it did to some extent help I believe however it's not fully working yet, the problem right now is that When It's supposed to run the triggerClientEvent() I don't know whether it run it or not or what's going on but nothing that is supposed to happen charSelect function doesn't happen I'm sure the code before triggerClientEvent works cause right before that trigger function is starting a output code: outputChatBox("Logged into account, redirecting to Character Select",source) And that is being shown on screen right after that the code: (triggerClientEvent()) is triggerClientEvent(source,"onCharSelect",getRootElement()) The function charSelect is looking as you made it up in above post.
-
Hey uhm so I'm having this issue, first it seems that some functions are just auto running when a player joins the server (Client side) is there a way to prevent the function from just running until it have been called, for example this one: function charSelect() createCharWindow() guiSetVisible(windowLogin, false) if (charWindow ~= nil) then guiSetVisible(charWindow,true) else outputChatBox("Problem! (For scripting testing purposes)",getLocalPlayer()) end end addEvent("onCharSelect",true) addEventHandler("onCharSelect",getRootElement(),charSelect()) That thing is already running before even being called from server And the strange thing is it's giving the error meaning the window was not successfully made what I don't get is, why? function createCharWindow() local charWindow = guiCreateWindow ( 0, 0, 0.5, 0.4, "Information", true ) local tabPanel = guiCreateTabPanel ( 0, 0.1, 1, 1, true, charWindow ) local inf1 = guiCreateTab(getElementData(getLocalPlayer(),"tabinf1"), tabPanel ) local inf2 = guiCreateTab(getElementData(getLocalPlayer(),"tabinf2"), tabPanel ) guiSetVisible(charWindow,false) end Now this is the two serverside functions, the problem was that the upper lua code was already executed at start which not really is what I'm trying to do. Heres serverside to just trigger triggerClientEvent("onCharSelect",getRootElement())
-
Found solution to it
-
I keep getting the warning/error ERROR: Client triggered serverside event accLog, but event is not added serverside I once didn't have this problem but then I coded a bit here and there got ingame to try my script and wupti it didn't work and now I can't find the problem anymore and like I've looked through all code 3 times now with no luck. Starting Server Event:(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("accLog",getLocalPlayer(),username,password) else outputChatBox("Please enter a username and/or password.") end end end Server code: function loginHandler(username,password) -- Mysql Stuff as well as setElementData stuff and getElementData end addEvent("accLog",true) addEventHandler("accLog",getRootElement(),loginHandler) Please tell me if the problem could be in loginHandler I will put that code in if required. Thank you.
-
Ah okay think I'm getting it now, that was quite a huge help since I didn't know that and it will sure come handy later on, thank you SDK for the help
-
If you don't mind I'm gonna ask a last question to you about events and so on, does this mean you can't have two events named the same cause like every event is like in a way getting connected to one big server when you start the script? Also it's working now, got a few bugs but that's some missing scripting I haven't added
-
Yea I did get lines from wiki as I'm just trying to get the basics of how it all should work before going on my own anyways. So uhm are you able to call a function that will then go onto another script? I didn't know that like call a event that actually is on another lua file?
-
="client/login.lua" type="client" />
