-
Posts
1,803 -
Joined
-
Last visited
-
Days Won
8
Everything posted by Citizen
-
have a script that does this community! not compiled Would be great if you could post the link then.
-
Sure, everything you need is here: https://wiki.multitheftauto.com/wiki/Sc ... troduction
-
("Uping" this thread as requested in a PM) I need to see the line where the content variable is defined (I'm pretty sure it's a getElementData on "Home" but still want to be sure).
-
Well, normally it should do it itself. Be sure the necessary ports are opened/forwarded correctly. You can use this tool: https://nightly.multitheftauto.com/ports/
-
Lol why are you lying ? onPlayerSpawn is a server side event only ... (or maybe you created one on clientside that is triggered from the server using onPlayerSpawn or client side using onClientPlayerSpawn but I doubt and it would be stupid)
-
All links are dead (image + download). Please reupload it. Thanks
-
All links are dead (image + download). Please reupload it. Thanks
-
All links are dead (image + download). Please reupload it. Thanks
-
Lol why do you need a table ?! Looks like you are coming from SAMP, are you ? @KRZO: First, wtf is that ? local veh = getPedOccupiedVehicle(player) local veh1 = getPedOccupiedVehicle(player) Looks like a random test you did to try fixing this. Please remove the second line. Then if not enginestate then and if enginestate == false then are exactly the same ! And you should use the following "if else" statement, since it's a boolean and that it only can take two value: if enginestate then --means if enginestate == true --instructions to stop the engine else --if not (so if it's equal to false) --instructions to start the engine end You also should take care about what parameters (and default values) a function takes: https://wiki.multitheftauto.com/wiki/TriggerClientEvent By not giving the player as first argument, you will trigger this event for every players ! And you obviously only want to trigger for it for the player who pressed the X key. So please add player before the event name. Now on the client side (everything should be fine server side at this point): I'll first suggest to "sandbox" the Motor global into the current file script. Haha don't worry, nothing that complicated. I mean that if you create the Motor variable like this: function myFunc() Motor = guiCreateStaticImage(blahblabla) end function myOtherFunc() --Using Motor variable end It will works yeah, but this variable will be accessible for all others client sided script files (because we are in a client sided script atm) in your resource. So now imagine that another client sided script file is using the same variable name for some reason ? (ie: an object that will represents an engine/motor) ? Yeah, nothing good will happen So we will just prevent globals to be accessible outside of the current file by doing like this: local Motor --Here I'm saying that this Motor variable will be only available in this file. function myFunc() Motor = guiCreateStaticImage(blahblabla) end function myOtherFunc() --Using Motor variable end And here we go, our script is still working and myOtherFunc can still access the Motor variable. Now let's go back to your actual code: function MotorOn() Motor = guiCreateStaticImage(X1,Y1, Width1, Height1,"data/engine_on", false) end addEvent("OnMotor", true) addEventHandler("OnMotor", root, MotorOn) First you need to specify the file extension so "data/engine_on" should have been "data/engine_on.png" (if it's a png file ofc) Then I already can see a problem that might be not obvious for some scripters. Your function is creating a new image when MotorOn() function is called. Ok right but the problem is that this function is called everytime you start the engine, so you will just stack the same images again and again. To fix that, I suggest you to check if Motor is equal to nil (which means that this variable is not seted so that the image isn't created yet). If it is equal to nil, create it, if not, then it means that the image already exists and it's currently the "engine_off.png" image. So in this case, you will change/switch the image back to the "engine_on.png" image: function MotorOn() if Motor == nil then --you can also do: if not Motor then Motor = guiCreateStaticImage(X1,Y1, Width1, Height1,"data/engine_on.png", false) else guiStaticImageLoadImage(Motor, "data/engine_on.png") end end addEvent("OnMotor", true) addEventHandler("OnMotor", root, MotorOn) And finally use the event onClientVehicleExit to hide/delete the image. If you hide the image, you will have to use onClientVehicleEnter to show it again. (Use guiSetVisible ofc) Finally done, hope it will be usefull
-
We can't reply on such uncomplete question. What resource are you using as car system/management ? Because if you are asking how can you change the owner, then it means there is resource that seted that owner.
-
What do you mean ?
-
I'll just quote manve1: And I'll also add that you have to try first, and then come back here with things you tried. A server owner should know how to script to add/modify stuff in his server. Otherwise, he doesn't deserve to own such server.
-
Read my post above. @SERGEY86RUS: Who dafuq are you ?! Didn't even noticed you weren't the guy I was helping since the begining nor the author of this thread.
-
Well, I didn't ask you to put your wanted level system, I just wanted to see if you have at least 5 stars to make it work. But I asked you to put some outputChatBox functions in your getWantedLevelAndSetCriminal to see where the server was going and where it wasn't. I won't reapeat a third time. It's part of the debugging process, and it has to be done by yourself before asking here. The problem is simple: My code isn't throwing any error but still doesn't work. So there is only two possibilities which are: 1 - The getWantedLevelAndSetCriminal is never called for some reason* 2 - There is an if statement that isn't verified (I mean that the condition isn't ok for the code to go inside) *some reason: This reason can be: 1 - The script file isn't in the meta or has the wrong type (client/server) 2 - The script contains error (like a missing end, parenthesis, comma, etc) => It should be visible in debugscript 3 (and on the server console since it's a server script) at the resource starting time. 3 - Another resource/script is cancelling the event you are using ("onPlayerWasted") That's all the possibilities I can see so far. And all of them can be verified by using outputChatBox functions at the right place.
-
You have to use your setElementData for "Level" on the player element and not the account element to use the code from WASSIm. Please post here the code where you are using setElementData function for "Level".
-
Well, I can't see the problem in your script. It should work. Be sure that this script is in your meta.xml and as server script. Then don't be afraid of using a lot of outputChatBox do debug it. I usually put an output when I enter in function, an if statement, a loop etc and 1 at the end of the function. You should then be able to see in the chatbox where the server is going in your function and where it isn't going. Let us know if you can find it the problem this way. If you still don't see the problem, then post your code again with the ouputChatBox functions and tell us which one are working (I mean which ones really print their message into the chat). EDIT: And hummm where do you use setPlayerWantedLevel to increment his wanted level ??
-
Yeah every gui elements should be relative most of the time. Here is a nice explanation about relative and abosulte: https://wiki.multitheftauto.com/wiki/In ... d_Absolute
-
Please post again the full code now you modified it and quote the line 58 if you are removing useless code from the file when copying-pasting here. Also, be sure you had restarted the resource before testing the code. Since it's a new day, I guess you restarted it.
-
Your window was still in absolute ! And the sizes of the childs was still in absolute: local sWidth, sHeight = guiGetScreenSize() local Width, Height = 0.22, 0.59 local X = 0.5 - Width local Y = 0.5 - Height local gRoot = getRootElement() local player = getLocalPlayer() local lx, ly, lz = 1177.51917, -1324, 14.07470 function Camera() fadeCamera(true) setWeather ( 17 ) showPlayerHudComponent("all", false) showPlayerHudComponent("radar", false) showChat(false) setElementPosition(player, lx, ly, lz) setCameraMatrix(1177.51917, -1324, 450, lx, ly, lz, 270, 100) setTimer(setCameraMatrix, 2500, 1, 1177.51917, -1324, 350, lx, ly, lz, 270, 100) setTimer(setCameraMatrix, 5000, 1, 1177.51917, -1324, 250, lx, ly, lz, 270, 100) setTimer(setCameraMatrix, 10000, 1, 1177.51917, -1324, 150, lx, ly, lz, 270, 100) setTimer(setCameraMatrix, 15000, 1, 1177.51917, -1324, 50, lx, ly, lz, 270, 100) setTimer(setCameraTarget, 20000, 1, player) setWeather(0) end addEvent("Camera", true) addEventHandler("Camera", root, Camera) Login_wnd=guiCreateStaticImage(X, Y, Width, Height, "login/images/login_wnd.png", true) Logo = guiCreateStaticImage(0.65, 0.150, 0.13, 0.08, "login/images/logo_h.png" , true, Login_wnd) Loginbtn = guiCreateStaticImage(0.5, 0.3, 0.212, 0.084, "login/images/login_btn.png", true, Login_wnd) Regbtn = guiCreateStaticImage(0.5, 0.37, 0.212, 0.084, "login/images/reg_btn.png", true, Login_wnd) Eyebtn = guiCreateStaticImage(0.262, 0.245, 0.023, 0.042, "login/images/eye_btn.png", true, Login_wnd) Username_edit = guiCreateEdit(0.10, 0.130, 0.183, 0.065, "", true, Login_wnd) guiEditSetMaxLength(Username_edit, 25) guiEditSetReadOnly(Username_edit, true) Passwort_edit = guiCreateEdit(0.10,0.235, 0.183, 0.065, "", true, Login_wnd) guiEditSetMasked(Passwort_edit, true) guiEditSetMaxLength(Passwort_edit, 25) guiSetVisible(Login_wnd, false) function LoginH () guiStaticImageLoadImage(Loginbtn, "login/images/login_h.png" ) playSound("hover.mp3", false) end function EyeH () guiStaticImageLoadImage(Eyebtn, "login/images/eye_h.png" ) guiEditSetMasked(Passwort_edit, false) playSound("hover.mp3", false) end function RegH () guiStaticImageLoadImage(Regbtn, "login/images/reg_h.png" ) playSound("hover.mp3", false) end function BackN () guiStaticImageLoadImage(Eyebtn, "login/images/eye_btn.png" ) guiEditSetMasked(Passwort_edit, true) guiStaticImageLoadImage(Loginbtn, "login/images/login_btn.png" ) guiStaticImageLoadImage(Regbtn, "login/images/reg_btn.png" ) end function Regklick() playSound("click.mp3", false) local username = guiGetText(Username_edit) local password = guiGetText(Passwort_edit) if username ~= "" and password ~= "" then triggerServerEvent("RegRequest", getLocalPlayer(), getLocalPlayer(), username, password) triggerServerEvent("Spawn", localPlayer) elseif username == "" and password == "" then outputChatBox("Bitte trage dein Passwort und dein Benutzernamen ein!", 125, 0, 0, false) elseif username == "" then outputChatBox("Bitte trage deinen Benutzernamen ein!", 125, 0, 0, false) elseif password == "" then outputChatBox("Bitte trage dein Passwort ein!", 125, 0, 0, false) end end addEventHandler("onClientGUIClick", Regbtn, Regklick, false) function Loginklick() playSound("click.mp3", false) local username = guiGetText(Username_edit) local password = guiGetText(Passwort_edit) if username ~= "" and password ~= "" then triggerServerEvent("LoginRequest",getLocalPlayer(),getLocalPlayer(),username,password) showPlayerHudComponent("all", true) elseif username == "" and password == "" then outputChatBox("Bitte trage dein Passwort und dein Benutzernamen ein!", 125, 0, 0, false) elseif username == "" then outputChatBox("Bitte trage deinen Benutzernamen ein!", 125, 0, 0, false) elseif password == "" then outputChatBox("Bitte trage dein Passwort ein!", 125, 0, 0, false) end end addEventHandler("onClientGUIClick", Loginbtn, Loginklick, false) function OpenLogin() playername = string.gsub ( getPlayerName ( player ), '#%x%x%x%x%x%x', '') guiSetText(Username_edit, playername) showPlayerHudComponent("all", false) setCameraMatrix(1291, -1208, 94, 1503, -1453, 63, 0, 70) showCursor(true) local sx, sy, sw, sh = X*sWidth, (0-Height)*sHeight, 0, 0 local ex, ey, ew, eh = sx, Y, Width, Height exports.gie:guiAddInterpolateEffect(Login_wnd, sx, sy, sw, sh, ex, ey, ew, eh, 2, "InElastic", "OutElastic", true) end addEventHandler("onClientResourceStart", resourceRoot, OpenLogin) function TestCloseLogin() setCameraTarget(player) showPlayerHudComponent("all", true) showCursor(false) guiSetVisible(Login_wnd, false) end addEvent("closeLoginPanel", true) addEventHandler("closeLoginPanel", gRoot, TestCloseLogin) addEventHandler("onClientMouseEnter", Eyebtn, EyeH, false) addEventHandler("onClientMouseLeave", Eyebtn, BackN) addEventHandler("onClientMouseEnter", Loginbtn, LoginH, false) addEventHandler("onClientMouseLeave", Loginbtn, BackN) addEventHandler("onClientMouseEnter", Regbtn, RegH, false) addEventHandler("onClientMouseLeave", Regbtn, BackN)
-
You really can press them ?! Can you post the addEventHandlers ? As you now put Login_wnd as parent, you can just hide (guiSetVisible) the Login_wnd and all childs will be hidden too. So when you want to show them, just show (guiSetVisible) the Login_wnd.
-
Ok so first, you are using absolute positions and sizes which is bad because it won't be the same for all resolutions. It will only be good at the current resolution which is 1366*768. @KRZO: by doing that you should remove X+ and Y+ since it's relative to the parent. I also need to know what are the value of these variables: X, Y, Width and Height
-
A screenshot of the result you have would be great
-
local x, y, z = unpack(poopMarkers[math.random(#poopMarkers)]) local reach = createMarker(x, y, z) guiSetVisible(jobWindow, false) createBlipAttachedTo(reach, 51)