Master_11

Members
  • Content Count

    37
  • Joined

  • Last visited

Everything posted by Master_11

  1. Thanks! It's fixed.
  2. I made a simple GUI to warp player (It's not yet completed) but the thing is, I made it so like, It is only opened whenever it is used and does not stays open in the background. The problem is, if you just logged in, you will have to step inside the marker twice, Eg > You logged in > You hit the marker for the first time and it won't open, but when you hit the marker for the second time, it will open imminently, and then again if you reconnect or logout it happens again, why is that so? I don't understand what wrong code I have made. Client: function MakeJPanel() if (JoinPanel) then return true end local screenW, screenH = guiGetScreenSize() JoinPanel = guiCreateWindow((screenW - 665) / 2, (screenH - 350) / 2, 665, 350, "Welcome To The MTA Server!", false) guiWindowSetSizable(JoinPanel, false) guiSetProperty(JoinPanel, "CaptionColour", "FFD1039E") WelcomeLable = guiCreateLabel(8, 19, 647, 60, "Blah BLah", false, JoinPanel) guiLabelSetColor(WelcomeLable, 150, 251, 89) LSClothButton = guiCreateButton(155, 164, 112, 22, "Cloth Shop", false, JoinPanel) guiSetProperty(LSClothButton, "NormalTextColour", "FFAAAAAA") LSVehicleButton = guiCreateButton(399, 164, 112, 22, "Vehicle Shop", false, JoinPanel) guiSetProperty(LSVehicleButton, "NormalTextColour", "FFAAAAAA") LVbutton = guiCreateButton(277, 132, 112, 22, "LV", false, JoinPanel) guiSetProperty(LVbutton, "NormalTextColour", "FF9B0DA7") LSButton = guiCreateButton((665 - 112) / 2, (350 - 22) / 2, 112, 22, "LS", false, JoinPanel) guiSetProperty(LSButton, "NormalTextColour", "FF1122A2") SFButton = guiCreateButton(277, 196, 112, 22, "SF", false, JoinPanel) guiSetProperty(SFButton, "NormalTextColour", "FFE9F038") CloseButton = guiCreateButton(296, 320, 73, 20, "Close", false, JoinPanel) guiSetProperty(CloseButton, "NormalTextColour", "FFAAAAAA") InfoLable = guiCreateLabel(9, 228, 646, 85, "Blah Blah", false, JoinPanel) guiLabelSetColor(InfoLable, 255, 0, 0) addEventHandler("onClientGUIClick", CloseButton, closeJGUI, false) end function openJPanel() if (not JoinPanel) then MakeJPanel() end local visible = not guiGetVisible(JoinPanel) guiSetVisible(JoinPanel, visible) showCursor(visible) end addEvent("startJPanel", true) addEventHandler("startJPanel", localPlayer, openJPanel) function closeJGUI(button) if (button ~= "left") then return false end openJPanel() end Server: local theMarker = createMarker(497.16632080078, -75.45479309082, 997.7378125, "cylinder", 1.6, 0, 120, 200, 255) function Markers() setElementDimension(theMarker, 99) setElementInterior(theMarker, 11) end addEventHandler("onResourceStart", resourceRoot, Markers) function openJGUI(client) if (isGuestAccount(getPlayerAccount(client))) then return false end if (getElementDimension(client) ~= 99 or getElementInterior(client) ~= 11) then return false end triggerClientEvent(client, "startJPanel", client) end addEventHandler("onMarkerHit", theMarker, openJGUI)
  3. Very well then, looks like I need to restart my server. I'll check your script again tonight. Thanks!
  4. Well, checked them all, HassoN's script isn't working, same problem as mine. Rockyz's script is working, however, thanks Holuzs for helping, but I guess, Rockyz script is more stable to use, however, I would like to see if HassoN's script is fixable too, as his scripting style matches with mine the most, would be easy for me to make further changes in future. Thanks all! Good work, Rockyz.
  5. Well, while testing this script, and making a few changes to it (With or without making changes) when the player is wasted, it makes the player re-spawn to only one location (Jefferson) out of the 8 provided in the table. I don't understand what's wrong with this script, would be very helpful if you guys give me a hand in checking. Also, this script isn't showing any debug error/warning in both In game debugger and on the console. (Most annoying) hosp_loc = { {-2655, 635, 14, 180}, -- San Fierro {2038, -1411, 17, 130}, --Jefferson {1173, -1323, 15, 270}, -- All Saints {1242, 327, 19, 340}, -- Red County {1609, 1816, 12, 360}, -- Las Venturas {-2200, -2311, 30, 320}, -- Angel Pine {-320, 1049, 20, 0}, --Fort Carson - Bone County {-1514.5, 2524, 56, 0} --Tierra Robada } function getDistance(thePlayer) local px, py, pz = getElementPosition(thePlayer) local closestDistance local closestPoint for i = 1, #hosp_loc do local hx, hy, hz = hosp_loc[i][1], hosp_loc[i][2], hosp_loc[i][3] local distance = getDistanceBetweenPoints3D(hx, hy, hz, px, py, pz) if (not closestDistance or distance < closestDistance) then closestDistance = distance closestPoint = hosp_loc[i] end end local x = (tostring(closestPoint[1])) --x local y = (tostring(closestPoint[2])) --y local z = (tostring(closestPoint[3])) --z local r = (tostring(closestPoint[4])) --rotation skin = getElementData(thePlayer, "respawn-skin") spawnPlayer(thePlayer, x, y, z, r, skin) setElementModel(thePlayer, skin) fadeCamera(thePlayer, true, 2.5) end function Respawn() local skinid = getElementModel(source) setElementData(source, "respawn-skin", skinid) setTimer(getDistance, 7500, 1, source) end addEventHandler("onPlayerWasted", root, Respawn)
  6. Hey, @LopSided_ I read the tutorial, did some changes in my code, but I am pretty much confused, I might need some help in person, is it okay if I PM you?
  7. Salh, your help is really appreciated but I guess, LopSided is right, the username and password are stored in the plain text. I'll check the tutorial provided by LopSided_, looks safer. Thank-you both.
  8. Hello, I have been working on a login panel, and I need to know, how can one make a functioning "Remember Credentials" checkbox which will then auto write username in the username text box and password in the password text box. What user have to do next is just click the login button instead of typing all the stuff again. Now... How?
  9. Change the x, y, z once again and check if it makes a difference.
  10. Nothing is wrong with the script I gave you. Try using this command in game: "/debugscript 3"
  11. marker1 = createMarker(648.93481445313, -2883.2438964844, 52.553970336914, "arrow", 1.5, 230, 251, 3, 153) marker2 = createMarker(636.20654296875, -2847.8757324219, 1637.8680419922, "arrow", 1.5, 230, 251, 3, 153) Use the space after coma ", " Also, try changing the coords. And provide SetElementPosition line too
  12. Just change the x, y, z in the code. if you have already changed, show me the edited code.
  13. Try copying from here: Server: https://pastebin.com/EME9GTj3 Client: https://pastebin.com/n8hdWAfD @RandomRambo
  14. Hello, @RandomRambo Server: marker1 = createMarker(1800.4868164063, -2141.1555175781, 14.146875, "arrow", 1.5, 0, 250, 0, 153) marker2 = createMarker(1801.6746826172, -2137.8212890625, 14.146875, "arrow", 1.5, 250, 0, 0, 153) function teleport(client) if (source == marker1 and getElementType(client) == "player") then setElementPosition(client, 1793.2797851563, -2151.337890625, 13.681822776794) setElementFrozen(client, false) setTimer(setElementFrozen, 1000, 1, client, false) triggerClientEvent(client, "onPlayerTP", client) elseif (source == marker2 and getElementType(client) == "player") then setElementPosition(client, 1793.4161376953, -2124.8742675781, 13.546875) setElementFrozen(client, false) setTimer(setElementFrozen, 1000, 1, client, false) triggerClientEvent(client, "onPlayerTP", client) end end addEventHandler("onMarkerHit", resourceRoot, teleport) Client: local screenW, screenH = guiGetScreenSize() mainWindow = guiCreateWindow((screenW - 1546) / 2, (screenH - 834) / 2, 1546, 834, "News", false) guiWindowSetSizable(mainWindow, false) --GUI Objects-- closeButton = guiCreateButton(9, 770, 1527, 54, "Close", false, mainWindow) newsLogo = guiCreateStaticImage(9, 32, 1527, 733, ":news/logotip.png", false, mainWindow) function resStarts() guiSetVisible(mainWindow, false) showCursor(false) end addEventHandler("onClientResourceStart", resourceRoot, resStarts) function openNewsPanel() guiSetVisible(mainWindow, true) showCursor(true) end addEvent("onPlayerTP", true) addEventHandler("onPlayerTP", localPlayer, openNewsPanel) function closeNewsPanel(button) if (button ~= "left") then return false end guiSetVisible(mainWindow, false) showCursor(false) end addEventHandler("onClientGUIClick", closeButton, closeNewsPanel, false) Meta: <meta> <script src="client.lua" type="client" /> <script src="server.lua" type="server" /> <file src="logotip.png" /> </meta> Remember, check the full code and see what I have changed and think why I did that. Also, change the image location at client.lua: line 6 {":news/logotip.png"} in this case, my script folder name was "news". I had to create a new client program as your one was pretty much buggy and unorganized. If you still find any problem, let us know.
  15. If you want to keep your server side as a server instead of the client then use this: triggerClientEvent If you didn't understand, let us know.
  16. client.lua local effectNames = { "blood_heli","boat_prop","camflash","carwashspray","cement","cloudfast","coke_puff","coke_trail","cigarette_smoke", "explosion_barrel","explosion_crate","explosion_door","exhale","explosion_fuel_car","explosion_large","explosion_medium", "explosion_molotov","explosion_small","explosion_tiny","extinguisher","flame","fire","fire_med","fire_large","flamethrower", "fire_bike","fire_car","gunflash","gunsmoke","insects","heli_dust","jetpack","jetthrust","nitro","molotov_flame", "overheat_car","overheat_car_electric","prt_blood","prt_boatsplash","prt_bubble","prt_cardebris","prt_collisionsmoke", "prt_glass","prt_gunshell","prt_sand","prt_sand2","prt_smokeII_3_expand","prt_smoke_huge","prt_spark","prt_spark_2", "prt_splash","prt_wake","prt_watersplash","prt_wheeldirt","petrolcan","puke","riot_smoke","spraycan","smoke30lit","smoke30m", "smoke50lit","shootlight","smoke_flare","tank_fire","teargas","teargasAD","tree_hit_fir","tree_hit_palm","vent","vent2", "water_hydrant","water_ripples","water_speed","water_splash","water_splash_big","water_splsh_sml","water_swim","waterfall_end", "water_fnt_tme","water_fountain","wallbust","WS_factorysmoke" } function createEffects(_, effectIndex) local effectIndex = tonumber(effectIndex) if (not effectIndex and (not type(effectIndex) == "number")) then return false end if (effectIndex ~= 0 and effectIndex <= #effectNames) then createEffect(effectNames[effectIndex], Vector3(getElementPosition(getLocalPlayer())), Vector3(getElementRotation(getLocalPlayer()))) end end addCommandHandler("createEffect", createEffects) meta.xml <meta> <script src="client.lua" type="client" /> </meta>
  17. Master_11

    help

    That to check if the player is in a vehicle or not and use this to teleport the player to you. https://wiki.multitheftauto.com/wiki/SetElementPosition
  18. @Peti Sorry, I was very busy with some other work, so couldn't make a reply. Yes, I missed defining the parameter on the client side. Thanks for that. However, about the main issue, the problem was with this triggerServerEvent As I forgot to change the extra element "localPlayer" which was passing the player data to the server-side function. Also, "getAccountFromName" was not really useful in the whole function so I replaced it with "getAccount(accName)" which works perfectly fine as expected. Also, there were a few typing mistakes in the code too, I've fixed them. I don't know what happened that day maybe I was just way too tired to check the code carefully. Thanks anyways. Pasting the fixed code for anyone who needs a reference in future. Client: function getMailFromAccount(accName) local accName = guiGetText(acceditbox) triggerServerEvent("getMail", resourceRoot, accName) end addEventHandler("onClientGUIClick", searchButton, getMailFromAccount, false) function getMailID(mailID) local eMail = mailID if (mailID) then guiSetText(mailoutput, mailID) end end addEvent("setMailOnLable", true) addEventHandler("setMailOnLable", resourceRoot, getMailID) function invalidAcc() guiSetText(mailoutput, "Invalid Account.") end addEvent("mailAccInvalid", true) addEventHandler("mailAccInvalid", resourceRoot, invalidAcc) Server: function getMailFromAccount(accName) local account = getAccount(accName) if (not account) then triggerClientEvent(client, "mailAccInvalid", resourceRoot) return false end local eMail = getAccountData(account, "accounts.email") triggerClientEvent(client, "setMailOnLable", resourceRoot, eMail) end addEvent("getMail", true) addEventHandler("getMail", resourceRoot, getMailFromAccount) This topic can be locked now.
  19. @Peti function getAccountFromName(name) return getAccount(name) or false end function getMailFromAccount(accName, eMail) if (accName) then local account = getAccountFromName(accName) end if (account) then local eMail = getAccountData(account, "accounts.email") triggerClientEvent(client, "setMailOnLable", client, eMail) end end addEvent("getMail", true) addEventHandler("getMail", getRootElement(), getMailFromAccount) Before using the first function, the value from "getAccountFromName" was (nil) Aslo, Do you need the full client code too?
  20. Hello, Currently, I am working on a script of Player's Email. Its work is to retrieve the player's Email from his/her account name using "getAccountData" Client: function getMailFromAccount(accName) local accName = guiGetText(acceditbox) triggerServerEvent("getMail", resourceRoot, localPlayer, accName) end function getMailID() if (eMail) then guiSetText(resultmail, "Result: "..eMail..".") end addEvent("setMailOnLable", true) addEventHandler("setMailOnLable", localPlayer, getMailID) end Server: function getMailFromAccount(accName, eMail) if (accName) then local account = getAccountFromName(accName) end if (account) then local eMail = getAccountData(account, "accounts.email") triggerClientEvent(client, "setMailOnLable", client, eMail) end end addEvent("getMail", true) addEventHandler("getMail", getRootElement(), getMailFromAccount) However, this code isn't working and I cannot find any other way to make it work. Any Ideas? Also, I keep getting this errors: [20:10:08] WARNING: NTsGetMailID\server.lua:19: Bad argument @ 'getAccount' [Expected string at argument 1, got player]
  21. Nothing, it's fine thanks!
  22. Thanks! it works but is it possible to make the rectangle size same as the ped size on movement?
  23. Hey, I am facing some problem with the Peds health bar, like when the PED is my target the bar is visible, but when I move back or forward the size of the bar changes. Any suggestion regarding this problem? (It's client) local PedA = createPed(285, 1571.49634, -1664.07715, 28.39561, 90) function healthbar() local plr = localPlayer local x, y, z = getElementPosition(PedA) target = getPedTarget(plr) if (not target) then return false end if (not getElementType(target) == "ped" ) then return false end if (not isElementOnScreen(PedA)) then return false end local X, Y = getScreenFromWorldPosition(x, y, z) if (X) then local healthA = dxDrawRectangle(X - 50, Y - 50, 270, 27, tocolor(241, 236, 253, 114), false) local health = getElementHealth(PedA) local lineLength = 256 * (health / 100) local healthB = dxDrawRectangle(X - 44, Y - 44, lineLength, 17, tocolor(9, 172, 213, 254), false) end end addEventHandler("onClientRender", root, healthbar)
  24. Thanks, pal, it worked. For those who may use this as a reference, I replaced client with: function OutputAdminList(list, name) adminlist = list guiGridListClear(AccountList) for i, name in ipairs(adminlist) do local row = guiGridListAddRow(AccountList, name) end end addEvent("GetAdminList", true) addEventHandler("GetAdminList", resourceRoot, OutputAdminList)