-
Posts
1,312 -
Joined
-
Last visited
Everything posted by KariiiM
-
It should works, replace the server side code with this one --// Made by: MoPoMaN --// © 2014 Pelinurkka Servers clientIsReady = false addCommandHandler("speakers", function (thePlayer) local account = getPlayerAccount(thePlayer) if not account or isGuestAccount(account) then return false end local accountName = getAccountName(account) if ( isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Owner" ) ) or isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Co-Owner" ) ) or isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Staff Manager" ) ) or isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Administrator" ) ) or isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Super Moderator" ) ) or isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Senior Moderator" ) ) ) then triggerClientEvent(thePlayer,"openGUI",thePlayer) end end) function startScript () addEvent ("onSpeakerCreate", true) addEventHandler ("onSpeakerCreate", getRootElement(), onSpeakerCreate) addEvent ("onSpeakerDestroy", true) addEventHandler ("onSpeakerDestroy", getRootElement(), onSpeakerDestroy) addEvent ("clientIsReady", true) addEventHandler ("clientIsReady", getRootElement(), enableClientIsReady) addEvent ("saveLinks", true) addEventHandler ("saveLinks", getRootElement(), saveLinks) linkTimer = setTimer (enableLinksForPlayers, 500, 0) end addEventHandler ("onResourceStart", getResourceRootElement(), startScript) function onSpeakerCreate (player, url, distance) if getPedOccupiedVehicle (player) then if getPedOccupiedVehicleSeat (player) > 0 then outputChatBox ("You can't create speaker as a passenger!", player, 255, 0, 0) return false end end local x, y, z = getElementPosition (player) local z = z - 1 local rx, ry, rz = getElementRotation (player) local rz = rz + 90 local rz = 0.0174532925 * rz local x = (math.cos(rz) * 1.5) + x local y = (math.sin(rz) * 1.5) + y local ox, oy, oz = getElementPosition (player) local rotation = findRotation(x, y, ox, oy) local rotation = rotation + 180 triggerClientEvent ("speakerStuffFromServer", getRootElement(), player, url, distance, x, y, z, rotation) end function onSpeakerDestroy (player) triggerClientEvent ("destroySpeaker", getRootElement(), player) end function onPlayerQuit () local player = source triggerClientEvent ("onPQuit", getRootElement(), player) end addEventHandler ("onPlayerQuit", getRootElement(), onPlayerQuit) function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end; return t; end function getLinks (player) local account = getPlayerAccount (player) if getAccountData (account, "urlLinks") then linkJSONTable = getAccountData (account, "urlLinks") linkTable = fromJSON (linkJSONTable) else linkTable = {{}, {}, {}, {}, {}, {}, {}, {}, {}, {}} linkTable[1]["name"] = "" linkTable[1]["link"] = "" linkTable[2]["name"] = "" linkTable[2]["link"] = "" linkTable[3]["name"] = "" linkTable[3]["link"] = "" linkTable[4]["name"] = "" linkTable[4]["link"] = "" linkTable[5]["name"] = "" linkTable[5]["link"] = "" linkTable[6]["name"] = "" linkTable[6]["link"] = "" linkTable[7]["name"] = "" linkTable[7]["link"] = "" linkTable[8]["name"] = "" linkTable[8]["link"] = "" linkTable[9]["name"] = "" linkTable[9]["link"] = "" linkTable[10]["name"] = "" linkTable[10]["link"] = "" end local tableoflinks = linkTable triggerClientEvent (player, "createMyLinksGUI", getRootElement(), tableoflinks) end function onLogin () local player = source getLinks (player) end addEventHandler ("onPlayerLogin", getRootElement(), onLogin) function onLogout () local player = source triggerClientEvent (player, "onPlayerLogout", getRootElement()) end addEventHandler ("onPlayerLogout", getRootElement(), onLogout) function saveLinks (player, linkTable) local account = getPlayerAccount (player) local linkTable = toJSON (linkTable) setAccountData (account, "urlLinks", linkTable) end function enableClientIsReady () clientIsReady = true end function enableLinksForPlayers () if clientIsReady == true then local players = getElementsByType ("player") for k, player in ipairs (players) do local account = getPlayerAccount (player) if isGuestAccount (account) == false then getLinks (player) end end killTimer (linkTimer) end end
-
copy my code it should works correctly with your resolution and why you did to some numbers -1 since they're numbers able to edit not like a string, anyway i calculed them to keep your code simply and clear local sx,sy = guiGetScreenSize () function LT() dxDrawLine((73/1024)*sx, (268/768)*sy, (73/1024)*sx, (993/768)*sy, tocolor(255, 9, 9, 255), 1, false) dxDrawLine((325/1024)*sx, (268/768)*sy, (73/1024)*sx, (268/768)*sy, tocolor(255, 9, 9, 255), 1, false) dxDrawLine((73/1024)*sx, (993/768)*sy, (325/1024)*sx, (993/768)*sy, tocolor(255, 9, 9, 255), 1, false) dxDrawLine((325/1024)*sx, (993/768)*sy, (325/1024)*sx, (268/768)*sy, tocolor(255, 9, 9, 255), 1, false) dxDrawRectangle((74/1024)*sx, (269/768)*sy, (251/1024)*sx, (724/768)*sy, tocolor(0, 0, 0, 176), false) -------------------------------------- dxDrawRectangle((76/1024)*sx, (287/768)*sy, (248/1024)*sx, (40/768)*sy, tocolor(255, 0, 0, 175), false) dxDrawText("Introduction",(75/1024)*sx, (287/768)*sy, (324/1024)*sx, (326/768)*sy, tocolor(0, 0, 0, 255), 1.10, "bankgothic", "left", "top", false, false, false, false, false) dxDrawRectangle((76/1024)*sx, (367/768)*sy, (248/1024)*sx, (40/768)*sy, tocolor(255, 0, 0, 175), false) dxDrawText("NGG Features", (75/1024)*sx, (367/768)*sy, (324/1024)*sx, (406/768)*sy, tocolor(0, 0, 0, 255), 1.09, "bankgothic", "left", "top", false, false, false, false, false) dxDrawRectangle((75/1024)*sx, (451/768)*sy, (248/1024)*sx, (40/768)*sy, tocolor(255, 0, 0, 175), false) dxDrawText("NGG Forum", (74/1024)*sx, (452/768)*sy, (323/1024)*sx, (491/768)*sy, tocolor(0, 0, 0, 255), 1.09, "bankgothic", "left", "top", false, false, false, false, false) end
-
Yes my bad, replace this client with your client --// Made by: MoPoMaN --// © 2014 Pelinurkka Servers --//You can edit these defaultlinks = {} defaultlinks[1] = {"", "Edit these from client.lua file"} defaultlinks[2] = {"", ""} defaultlinks[3] = {"", ""} defaultlinks[4] = {"", ""} defaultlinks[5] = {"", ""} defaultlinks[6] = {"", ""} defaultlinks[7] = {"", ""} defaultlinks[8] = {"", ""} openKey = "f5" maxdistance = 100 defaultdistance = 50 --//Dont edit these! triggerServerEvent ("clientIsReady", getRootElement()) width, height = guiGetScreenSize () speakers = {} linkTable = {} selectedURLName = "N/A" function startScript () --//Create main GUI mainWindow = guiCreateWindow ((width/2) - (500/2), (height/2) - (417/2), 500, 417, "Speaker system", false) guiWindowSetSizable (mainWindow, false) --Buttons and event handlers closeButton = guiCreateButton (450, 25, 40, 35, "Close", false, mainWindow) addEventHandler ("onClientGUIClick", closeButton, closeGUI) createButton = guiCreateButton (30, 87, 80, 40, "Create speaker", false, mainWindow) addEventHandler ("onClientGUIClick", createButton, onCreateSpeakerKlick) destroyButton = guiCreateButton (130, 87, 80, 40, "Destroy speaker", false, mainWindow) addEventHandler ("onClientGUIClick", destroyButton, onDestroySpeakerClick) myLinksButton = guiCreateButton (420, 114, 70, 35, "My links", false, mainWindow) addEventHandler ("onClientGUIClick", myLinksButton, onMyLinksButtonClick) guiSetEnabled (myLinksButton, false) --URL Stuff guiCreateLabel (90, 23, 100, 30, "Radio URL:", false, mainWindow) urlEdit = guiCreateEdit (22, 44, 200, 35, "", false, mainWindow) --50 --Max distance guiCreateLabel (259, 23, 200, 30, "Max distance (1 - " .. tostring(maxdistance) .. "):", false, mainWindow) distanceEdit = guiCreateEdit (290, 44, 50, 35, tostring(defaultdistance), false, mainWindow) -- nowPlayingText = guiCreateLabel (34, 133, 70, 30, "Now playing:", false, mainWindow) guiSetVisible (nowPlayingText, false) nowPlayingEditLabel = guiCreateLabel (112, 133, 288, 30, "-", false, mainWindow) guiSetVisible (nowPlayingEditLabel, false) guiCreateLabel (25, 145, 600, 30, "_______________________________________________________________", false, mainWindow) --Links --Edit 1 edit1 = guiCreateEdit (105, 168, 313, 23, defaultlinks[1][2], false, mainWindow) guiCreateLabel (30, 170, 200, 30, defaultlinks[1][1], false, mainWindow) guiEditSetReadOnly (edit1, true) defaultUseButton1 = guiCreateButton (423, 168, 40, 23, "use", false, mainWindow) --Edit 2 edit2 = guiCreateEdit (105, 198, 313, 23, defaultlinks[2][2], false, mainWindow) guiCreateLabel (30, 200, 200, 30, defaultlinks[2][1], false, mainWindow) guiEditSetReadOnly (edit2, true) defaultUseButton2 = guiCreateButton (423, 198, 40, 23, "use", false, mainWindow) --Edit 3 edit3 = guiCreateEdit (105, 228, 313, 23, defaultlinks[3][2], false, mainWindow) guiCreateLabel (30, 230, 200, 30, defaultlinks[3][1], false, mainWindow) guiEditSetReadOnly (edit3, true) defaultUseButton3 = guiCreateButton (423, 228, 40, 23, "use", false, mainWindow) --Edit 4 edit4 = guiCreateEdit (105, 258, 313, 23, defaultlinks[4][2], false, mainWindow) guiCreateLabel (30, 260, 200, 30, defaultlinks[4][1], false, mainWindow) guiEditSetReadOnly (edit4, true) defaultUseButton4 = guiCreateButton (423, 258, 40, 23, "use", false, mainWindow) --Edit 5 edit5 = guiCreateEdit (105, 288, 313, 23, defaultlinks[5][2], false, mainWindow) guiCreateLabel (30, 290, 200, 30, defaultlinks[5][1], false, mainWindow) guiEditSetReadOnly (edit5, true) defaultUseButton5 = guiCreateButton (423, 288, 40, 23, "use", false, mainWindow) --Edit 6 edit6 = guiCreateEdit (105, 318, 313, 23, defaultlinks[6][2], false, mainWindow) guiCreateLabel (30, 320, 200, 30, defaultlinks[6][1], false, mainWindow) guiEditSetReadOnly (edit6, true) defaultUseButton6 = guiCreateButton (423, 318, 40, 23, "use", false, mainWindow) --Edit 7 edit7 = guiCreateEdit (105, 348, 313, 23, defaultlinks[7][2], false, mainWindow) guiCreateLabel (30, 350, 200, 30, defaultlinks[7][1], false, mainWindow) guiEditSetReadOnly (edit7, true) defaultUseButton7 = guiCreateButton (423, 348, 40, 23, "use", false, mainWindow) --Edit 8 edit8 = guiCreateEdit (105, 378, 313, 23, defaultlinks[8][2], false, mainWindow) guiCreateLabel (30, 380, 200, 30, defaultlinks[8][1], false, mainWindow) guiEditSetReadOnly (edit8, true) defaultUseButton8 = guiCreateButton (423, 378, 40, 23, "use", false, mainWindow) --//-- guiSetVisible (mainWindow, false) --Add some events addEvent ("speakerStuffFromServer", true) addEventHandler ("speakerStuffFromServer", getRootElement(), createSpeaker) addEvent ("destroySpeaker", true) addEventHandler ("destroySpeaker", getRootElement(), destroySpeaker) addEvent ("onPQuit", true) addEventHandler ("onPQuit", getRootElement(), onPlayerQuit) addEvent ("createMyLinksGUI", true) addEventHandler ("createMyLinksGUI", getRootElement(), createMyLinksGUI) addEvent ("onPlayerLogout", true) addEventHandler ("onPlayerLogout", getRootElement(), onPlayerLogout) end addEventHandler ("onClientResourceStart", getResourceRootElement(), startScript) addEvent("openGUI",true) addEventHandler("openGUI",getRootElement(), function () if guiGetVisible (mainWindow) then guiSetVisible (mainWindow, false) guiSetVisible (linkWindow, false) showCursor (false) else guiSetVisible (mainWindow, true) showCursor (true) end end) bindKey (openKey, "down", openOrCloseGUI) function closeGUI () if source == closeButton then guiSetVisible (mainWindow, false) showCursor (false) end end function createMyLinksGUI (tableoflinks) linkTable = tableoflinks guiSetEnabled (myLinksButton, true) --//Create my links window linkWindow = guiCreateWindow ((width/2) - (483/2), (height/2) - (375/2), 483, 375, "My links", false) guiWindowSetSizable (linkWindow, false) --guiSetAlpha (linkWindow, 0. guiSetVisible (linkWindow, false) saveLinksButton = guiCreateButton (428, 25, 40, 35, "Close", false, linkWindow) guiCreateLabel (63, 48, 100, 30, "Name", false, linkWindow) guiCreateLabel (260, 48, 100, 30, "Link", false, linkWindow) --Link pad 1 linkname1 = guiCreateEdit (17, 70, 125, 23, linkTable[1]["name"], false, linkWindow) linkedit1 = guiCreateEdit (145, 70, 253, 23, linkTable[1]["link"], false, linkWindow) linkUseButton1 = guiCreateButton (428, 70, 40, 23, "use", false, linkWindow) removeButton1 = guiCreateButton (400.5, 70, 23, 23, "X", false, linkWindow) --Link pad 2 linkname2 = guiCreateEdit (17, 100, 125, 23, linkTable[2]["name"], false, linkWindow) linkedit2 = guiCreateEdit (145, 100, 253, 23, linkTable[2]["link"], false, linkWindow) linkUseButton2 = guiCreateButton (428, 100, 40, 23, "use", false, linkWindow) removeButton2 = guiCreateButton (400.5, 100, 23, 23, "X", false, linkWindow) --Link pad 3 linkname3 = guiCreateEdit (17, 130, 125, 23, linkTable[3]["name"], false, linkWindow) linkedit3 = guiCreateEdit (145, 130, 253, 23, linkTable[3]["link"], false, linkWindow) linkUseButton3 = guiCreateButton (428, 130, 40, 23, "use", false, linkWindow) removeButton3 = guiCreateButton (400.5, 130, 23, 23, "X", false, linkWindow) --Link pad 4 linkname4 = guiCreateEdit (17, 160, 125, 23, linkTable[4]["name"], false, linkWindow) linkedit4 = guiCreateEdit (145, 160, 253, 23, linkTable[4]["link"], false, linkWindow) linkUseButton4 = guiCreateButton (428, 160, 40, 23, "use", false, linkWindow) removeButton4 = guiCreateButton (400.5, 160, 23, 23, "X", false, linkWindow) --Link pad 5 linkname5 = guiCreateEdit (17, 190, 125, 23, linkTable[5]["name"], false, linkWindow) linkedit5 = guiCreateEdit (145, 190, 253, 23, linkTable[5]["link"], false, linkWindow) linkUseButton5 = guiCreateButton (428, 190, 40, 23, "use", false, linkWindow) removeButton5 = guiCreateButton (400.5, 190, 23, 23, "X", false, linkWindow) --Link pad 6 linkname6 = guiCreateEdit (17, 220, 125, 23, linkTable[6]["name"], false, linkWindow) linkedit6 = guiCreateEdit (145, 220, 253, 23, linkTable[6]["link"], false, linkWindow) linkUseButton6 = guiCreateButton (428, 220, 40, 23, "use", false, linkWindow) removeButton6 = guiCreateButton (400.5, 220, 23, 23, "X", false, linkWindow) --Link pad 7 linkname7 = guiCreateEdit (17, 250, 125, 23, linkTable[7]["name"], false, linkWindow) linkedit7 = guiCreateEdit (145, 250, 253, 23, linkTable[7]["link"], false, linkWindow) linkUseButton7 = guiCreateButton (428, 250, 40, 23, "use", false, linkWindow) removeButton7 = guiCreateButton (400.5, 250, 23, 23, "X", false, linkWindow) --Link pa d8 linkname8 = guiCreateEdit (17, 280, 125, 23, linkTable[8]["name"], false, linkWindow) linkedit8 = guiCreateEdit (145, 280, 253, 23, linkTable[8]["link"], false, linkWindow) linkUseButton8 = guiCreateButton (428, 280, 40, 23, "use", false, linkWindow) removeButton8 = guiCreateButton (400.5, 280, 23, 23, "X", false, linkWindow) --Link pad 9 linkname9 = guiCreateEdit (17, 310, 125, 23, linkTable[9]["name"], false, linkWindow) linkedit9 = guiCreateEdit (145, 310, 253, 23, linkTable[9]["link"], false, linkWindow) linkUseButton9 = guiCreateButton (428, 310, 40, 23, "use", false, linkWindow) removeButton9 = guiCreateButton (400.5, 310, 23, 23, "X", false, linkWindow) --Link pad 10 linkname10 = guiCreateEdit (17, 340, 125, 23, linkTable[10]["name"], false, linkWindow) linkedit10 = guiCreateEdit (145, 340, 253, 23, linkTable[10]["link"], false, linkWindow) linkUseButton10 = guiCreateButton (428, 340, 40, 23, "use", false, linkWindow) removeButton10 = guiCreateButton (400.5, 340, 23, 23, "X", false, linkWindow) end function onMyLinksButtonClick () if source == myLinksButton then guiSetVisible (linkWindow, true) guiMoveToBack (mainWindow) end end function closeLinkWindow () if source == closeLinkWindowButton then guiSetVisible (linkWindow, false) reloadLinkPads () end end function onCreateSpeakerKlick () if source == createButton then if speakers[player] then outputChatBox ("You already have a speaker!", 255, 0, 0) else local guiText = guiGetText (urlEdit) if guiText == "" then outputChatBox ("You need to type radio url!", 255, 0, 0) else local distance = guiGetText (distanceEdit) distance = tonumber (distance) if type (distance) ~= "number" then outputChatBox ("Distance have to be number!", 255, 0, 0) else if distance > maxdistance then outputChatBox ("Distance have to be between 1 - " .. maxdistance .. "!", 255, 0, 0) return false else if distance < 1 then
-
--Server side: --// Made by: MoPoMaN --// © 2014 Pelinurkka Servers clientIsReady = false addCommandHandler("speakers", function (thePlayer) local account = getPlayerAccount(thePlayer) if not account or isGuestAccount(account) then return end local accountName = getAccountName(account) if ( isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Owner" ) )) then triggerClientEvent(thePlayer,"openGUI",thePlayer) end end) function startScript () addEvent ("onSpeakerCreate", true) addEventHandler ("onSpeakerCreate", getRootElement(), onSpeakerCreate) addEvent ("onSpeakerDestroy", true) addEventHandler ("onSpeakerDestroy", getRootElement(), onSpeakerDestroy) addEvent ("clientIsReady", true) addEventHandler ("clientIsReady", getRootElement(), enableClientIsReady) addEvent ("saveLinks", true) addEventHandler ("saveLinks", getRootElement(), saveLinks) linkTimer = setTimer (enableLinksForPlayers, 500, 0) end addEventHandler ("onResourceStart", getResourceRootElement(), startScript) function onSpeakerCreate (player, url, distance) if getPedOccupiedVehicle (player) then if getPedOccupiedVehicleSeat (player) > 0 then outputChatBox ("You can't create speaker as a passenger!", player, 255, 0, 0) return false end end local x, y, z = getElementPosition (player) local z = z - 1 local rx, ry, rz = getElementRotation (player) local rz = rz + 90 local rz = 0.0174532925 * rz local x = (math.cos(rz) * 1.5) + x local y = (math.sin(rz) * 1.5) + y local ox, oy, oz = getElementPosition (player) local rotation = findRotation(x, y, ox, oy) local rotation = rotation + 180 triggerClientEvent ("speakerStuffFromServer", getRootElement(), player, url, distance, x, y, z, rotation) end function onSpeakerDestroy (player) triggerClientEvent ("destroySpeaker", getRootElement(), player) end function onPlayerQuit () local player = source triggerClientEvent ("onPQuit", getRootElement(), player) end addEventHandler ("onPlayerQuit", getRootElement(), onPlayerQuit) function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end; return t; end function getLinks (player) local account = getPlayerAccount (player) if getAccountData (account, "urlLinks") then linkJSONTable = getAccountData (account, "urlLinks") linkTable = fromJSON (linkJSONTable) else linkTable = {{}, {}, {}, {}, {}, {}, {}, {}, {}, {}} linkTable[1]["name"] = "" linkTable[1]["link"] = "" linkTable[2]["name"] = "" linkTable[2]["link"] = "" linkTable[3]["name"] = "" linkTable[3]["link"] = "" linkTable[4]["name"] = "" linkTable[4]["link"] = "" linkTable[5]["name"] = "" linkTable[5]["link"] = "" linkTable[6]["name"] = "" linkTable[6]["link"] = "" linkTable[7]["name"] = "" linkTable[7]["link"] = "" linkTable[8]["name"] = "" linkTable[8]["link"] = "" linkTable[9]["name"] = "" linkTable[9]["link"] = "" linkTable[10]["name"] = "" linkTable[10]["link"] = "" end local tableoflinks = linkTable triggerClientEvent (player, "createMyLinksGUI", getRootElement(), tableoflinks) end function onLogin () local player = source getLinks (player) end addEventHandler ("onPlayerLogin", getRootElement(), onLogin) function onLogout () local player = source triggerClientEvent (player, "onPlayerLogout", getRootElement()) end addEventHandler ("onPlayerLogout", getRootElement(), onLogout) function saveLinks (player, linkTable) local account = getPlayerAccount (player) local linkTable = toJSON (linkTable) setAccountData (account, "urlLinks", linkTable) end function enableClientIsReady () clientIsReady = true end function enableLinksForPlayers () if clientIsReady == true then local players = getElementsByType ("player") for k, player in ipairs (players) do local account = getPlayerAccount (player) if isGuestAccount (account) == false then getLinks (player) end end killTimer (linkTimer) end end --Client side: --// Made by: MoPoMaN --// © 2014 Pelinurkka Servers --//You can edit these defaultlinks = {} defaultlinks[1] = {"", "Edit these from client.lua file"} defaultlinks[2] = {"", ""} defaultlinks[3] = {"", ""} defaultlinks[4] = {"", ""} defaultlinks[5] = {"", ""} defaultlinks[6] = {"", ""} defaultlinks[7] = {"", ""} defaultlinks[8] = {"", ""} openKey = "f5" maxdistance = 100 defaultdistance = 50 --//Dont edit these! triggerServerEvent ("clientIsReady", getRootElement()) width, height = guiGetScreenSize () speakers = {} linkTable = {} selectedURLName = "N/A" function startScript () --//Create main GUI mainWindow = guiCreateWindow ((width/2) - (500/2), (height/2) - (417/2), 500, 417, "Speaker system", false) guiWindowSetSizable (mainWindow, false) --Buttons and event handlers closeButton = guiCreateButton (450, 25, 40, 35, "Close", false, mainWindow) addEventHandler ("onClientGUIClick", closeButton, closeGUI) createButton = guiCreateButton (30, 87, 80, 40, "Create speaker", false, mainWindow) addEventHandler ("onClientGUIClick", createButton, onCreateSpeakerKlick) destroyButton = guiCreateButton (130, 87, 80, 40, "Destroy speaker", false, mainWindow) addEventHandler ("onClientGUIClick", destroyButton, onDestroySpeakerClick) myLinksButton = guiCreateButton (420, 114, 70, 35, "My links", false, mainWindow) addEventHandler ("onClientGUIClick", myLinksButton, onMyLinksButtonClick) guiSetEnabled (myLinksButton, false) --URL Stuff guiCreateLabel (90, 23, 100, 30, "Radio URL:", false, mainWindow) urlEdit = guiCreateEdit (22, 44, 200, 35, "", false, mainWindow) --50 --Max distance guiCreateLabel (259, 23, 200, 30, "Max distance (1 - " .. tostring(maxdistance) .. "):", false, mainWindow) distanceEdit = guiCreateEdit (290, 44, 50, 35, tostring(defaultdistance), false, mainWindow) -- nowPlayingText = guiCreateLabel (34, 133, 70, 30, "Now playing:", false, mainWindow) guiSetVisible (nowPlayingText, false) nowPlayingEditLabel = guiCreateLabel (112, 133, 288, 30, "-", false, mainWindow) guiSetVisible (nowPlayingEditLabel, false) guiCreateLabel (25, 145, 600, 30, "_______________________________________________________________", false, mainWindow) --Links --Edit 1 edit1 = guiCreateEdit (105, 168, 313, 23, defaultlinks[1][2], false, mainWindow) guiCreateLabel (30, 170, 200, 30, defaultlinks[1][1], false, mainWindow) guiEditSetReadOnly (edit1, true) defaultUseButton1 = guiCreateButton (423, 168, 40, 23, "use", false, mainWindow) --Edit 2 edit2 = guiCreateEdit (105, 198, 313, 23, defaultlinks[2][2], false, mainWindow) guiCreateLabel (30, 200, 200, 30, defaultlinks[2][1], false, mainWindow) guiEditSetReadOnly (edit2, true) defaultUseButton2 = guiCreateButton (423, 198, 40, 23, "use", false, mainWindow) --Edit 3 edit3 = guiCreateEdit (105, 228, 313, 23, defaultlinks[3][2], false, mainWindow) guiCreateLabel (30, 230, 200, 30, defaultlinks[3][1], false, mainWindow) guiEditSetReadOnly (edit3, true) defaultUseButton3 = guiCreateButton (423, 228, 40, 23, "use", false, mainWindow) --Edit 4 edit4 = guiCreateEdit (105, 258, 313, 23, defaultlinks[4][2], false, mainWindow) guiCreateLabel (30, 260, 200, 30, defaultlinks[4][1], false, mainWindow) guiEditSetReadOnly (edit4, true) defaultUseButton4 = guiCreateButton (423, 258, 40, 23, "use", false, mainWindow) --Edit 5 edit5 = guiCreateEdit (105, 288, 313, 23, defaultlinks[5][2], false, mainWindow) guiCreateLabel (30, 290, 200, 30, defaultlinks[5][1], false, mainWindow) guiEditSetReadOnly (edit5, true) defaultUseButton5 = guiCreateButton (423, 288, 40, 23, "use", false, mainWindow) --Edit 6 edit6 = guiCreateEdit (105, 318, 313, 23, defaultlinks[6][2], false, mainWindow) guiCreateLabel (30, 320, 200, 30, defaultlinks[6][1], false, mainWindow) guiEditSetReadOnly (edit6, true) defaultUseButton6 = guiCreateButton (423, 318, 40, 23, "use", false, mainWindow) --Edit 7 edit7 = guiCreateEdit (105, 348, 313, 23, defaultlinks[7][2], false, mainWindow) guiCreateLabel (30, 350, 200, 30, defaultlinks[7][1], false, mainWindow) guiEditSetReadOnly (edit7, true) defaultUseButton7 = guiCreateButton (423, 348, 40, 23, "use", false, mainWindow) --Edit 8 edit8 = guiCreateEdit (105, 378, 313, 23, defaultlinks[8][2], false, mainWindow) guiCreateLabel (30, 380, 200, 30, defaultlinks[8][1], false, mainWindow) guiEditSetReadOnly (edit8, true) defaultUseButton8 = guiCreateButton (423, 378, 40, 23, "use", false, mainWindow) --//-- guiSetVisible (mainWindow, false) --Add some events addEvent ("speakerStuffFromServer", true) addEventHandler ("speakerStuffFromServer", getRootElement(), createSpeaker) addEvent ("destroySpeaker", true) addEventHandler ("destroySpeaker", getRootElement(), destroySpeaker) addEvent ("onPQuit", true) addEventHandler ("onPQuit", getRootElement(), onPlayerQuit) addEvent ("createMyLinksGUI", true) addEventHandler ("createMyLinksGUI", getRootElement(), createMyLinksGUI) addEvent ("onPlayerLogout", true) addEventHandler ("onPlayerLogout", getRootElement(), onPlayerLogout) end addEventHandler ("onClientResourceStart", getResourceRootElement(), startScript) addEvent("openGUI",true) addEventHandler("openGUI",getRootElement(), function openOrCloseGUI () if guiGetVisible (mainWindow) then guiSetVisible (mainWindow, false) guiSetVisible (linkWindow, false) showCursor (false) else guiSetVisible (mainWindow, true) showCursor (true) end end) bindKey (openKey, "down", openOrCloseGUI) function closeGUI () if source == closeButton then guiSetVisible (mainWindow, false) showCursor (false) end end function createMyLinksGUI (tableoflinks) linkTable = tableoflinks guiSetEnabled (myLinksButton, true) --//Create my links window linkWindow = guiCreateWindow ((width/2) - (483/2), (height/2) - (375/2), 483, 375, "My links", false) guiWindowSetSizable (linkWindow, false) --guiSetAlpha (linkWindow, 0. guiSetVisible (linkWindow, false) saveLinksButton = guiCreateButton (428, 25, 40, 35, "Close", false, linkWindow) guiCreateLabel (63, 48, 100, 30, "Name", false, linkWindow) guiCreateLabel (260, 48, 100, 30, "Link", false, linkWindow) --Link pad 1 linkname1 = guiCreateEdit (17, 70, 125, 23, linkTable[1]["name"], false, linkWindow) linkedit1 = guiCreateEdit (145, 70, 253, 23, linkTable[1]["link"], false, linkWindow) linkUseButton1 = guiCreateButton (428, 70, 40, 23, "use", false, linkWindow) removeButton1 = guiCreateButton (400.5, 70, 23, 23, "X", false, linkWindow) --Link pad 2 linkname2 = guiCreateEdit (17, 100, 125, 23, linkTable[2]["name"], false, linkWindow) linkedit2 = guiCreateEdit (145, 100, 253, 23, linkTable[2]["link"], false, linkWindow) linkUseButton2 = guiCreateButton (428, 100, 40, 23, "use", false, linkWindow) removeButton2 = guiCreateButton (400.5, 100, 23, 23, "X", false, linkWindow) --Link pad 3 linkname3 = guiCreateEdit (17, 130, 125, 23, linkTable[3]["name"], false, linkWindow) linkedit3 = guiCreateEdit (145, 130, 253, 23, linkTable[3]["link"], false, linkWindow) linkUseButton3 = guiCreateButton (428, 130, 40, 23, "use", false, linkWindow) removeButton3 = guiCreateButton (400.5, 130, 23, 23, "X", false, linkWindow) --Link pad 4 linkname4 = guiCreateEdit (17, 160, 125, 23, linkTable[4]["name"], false, linkWindow) linkedit4 = guiCreateEdit (145, 160, 253, 23, linkTable[4]["link"], false, linkWindow) linkUseButton4 = guiCreateButton (428, 160, 40, 23, "use", false, linkWindow) removeButton4 = guiCreateButton (400.5, 160, 23, 23, "X", false, linkWindow) --Link pad 5 linkname5 = guiCreateEdit (17, 190, 125, 23, linkTable[5]["name"], false, linkWindow) linkedit5 = guiCreateEdit (145, 190, 253, 23, linkTable[5]["link"], false, linkWindow) linkUseButton5 = guiCreateButton (428, 190, 40, 23, "use", false, linkWindow) removeButton5 = guiCreateButton (400.5, 190, 23, 23, "X", false, linkWindow) --Link pad 6 linkname6 = guiCreateEdit (17, 220, 125, 23, linkTable[6]["name"], false, linkWindow) linkedit6 = guiCreateEdit (145, 220, 253, 23, linkTable[6]["link"], false, linkWindow) linkUseButton6 = guiCreateButton (428, 220, 40, 23, "use", false, linkWindow) removeButton6 = guiCreateButton (400.5, 220, 23, 23, "X", false, linkWindow) --Link pad 7 linkname7 = guiCreateEdit (17, 250, 125, 23, linkTable[7]["name"], false, linkWindow) linkedit7 = guiCreateEdit (145, 250, 253, 23, linkTable[7]["link"], false, linkWindow) linkUseButton7 = guiCreateButton (428, 250, 40, 23, "use", false, linkWindow) removeButton7 = guiCreateButton (400.5, 250, 23, 23, "X", false, linkWindow) --Link pa d8 linkname8 = guiCreateEdit (17, 280, 125, 23, linkTable[8]["name"], false, linkWindow) linkedit8 = guiCreateEdit (145, 280, 253, 23, linkTable[8]["link"], false, linkWindow) linkUseButton8 = guiCreateButton (428, 280, 40, 23, "use", false, linkWindow) removeButton8 = guiCreateButton (400.5, 280, 23, 23, "X", false, linkWindow) --Link pad 9 linkname9 = guiCreateEdit (17, 310, 125, 23, linkTable[9]["name"], false, linkWindow) linkedit9 = guiCreateEdit (145, 310, 253, 23, linkTable[9]["link"], false, linkWindow) linkUseButton9 = guiCreateButton (428, 310, 40, 23, "use", false, linkWindow) removeButton9 = guiCreateButton (400.5, 310, 23, 23, "X", false, linkWindow) --Link pad 10 linkname10 = guiCreateEdit (17, 340, 125, 23, linkTable[10]["name"], false, linkWindow) linkedit10 = guiCreateEdit (145, 340, 253, 23, linkTable[10]["link"], false, linkWindow) linkUseButton10 = guiCreateButton (428, 340, 40, 23, "use", false, linkWindow) removeButton10 = guiCreateButton (400.5, 340, 23, 23, "X", false, linkWindow) end function onMyLinksButtonClick () if source == myLinksButton then guiSetVisible (linkWindow, true) guiMoveToBack (mainWindow) end end function closeLinkWindow () if source == closeLinkWindowButton then guiSetVisible (linkWindow, false) reloadLinkPads () end end function onCreateSpeakerKlick () if source == createButton then if speakers[player] then outputChatBox ("You already have a speaker!", 255, 0, 0) else local guiText = guiGetText (urlEdit) if guiText == "" then outputChatBox ("You need to type radio url!", 255, 0, 0) else local distance = guiGetText (distanceEdit) distance = tonumber (distance) if type (distance) ~= "number" then outputChatBox ("Distance have to be number!", 255, 0, 0) else if distance > maxdistance then outputChatBox ("Distance have to be between 1 - " .. maxdistance .. "!", 255, 0, 0) return false else if distance < 1 then outputChatBox ("Distance have to be between 1 - " .. maxdistance .. "!", 255, 0, 0) return false
-
Well, can you post the code, i just formated my PC i can't download stuffs at this moment
-
And what do you want to change?
-
There's a timer you must wait untill it complet or edit it from meta.xml setting value setTimer ( sendTurfPayout, (1*tonumber(get("*PAYOUT_TIME")))*1000, 0 )
-
I already solved your problem Here
-
Thanks for your attention, i didn't take care about this point addCommandHandler ("speakers", function (player) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup("Owner")) then triggerClientEvent(player,"onSpeakerCreate",player) end --end of if end --end of the function )
-
Dude use your LOGIC, like that you will never successfull in scripting, always you will need someone to help you This code is totally messy, where's the function of the commandHandler? Also, player is not defined in your code.. addCommandHandler ("speakers", openGUI) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup("Owner")) then triggerServerEvent(player,"onSpeakerCreate",player) end end Try that, addCommandHandler ("speakers", function (player) if ( getElementType ( player ) == "player" ) then --Checking the player who use the command if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup("Owner")) then triggerServerEvent(player,"onSpeakerCreate",player) end --end of if end --end of if end --end of the function )
-
Use Lua tag's on your code [lua--]youcode [/lua]
-
Yes this function what i was searching for, thanks !
-
Hey guys, Anyone know a LUA Function that is able to make a list of numbers in order , like 1,2,3,4... For example, i have a table looking like that: local aTable= { {4, "row4"}, {2, "row2"}, {1, "row1"}, {3, "row3"}, } and after using this function it should be in order like this example below: (im sure there's a lua function for that just i didn't search well) local aTable= { {1, "row1"}, {2, "row2"}, {3, "row3"}, {4, "row4"}, }
-
lill Today's admin panel is with more features and usefull plus your look with the same features as Lill today's panel just the design changed with the directX, where's the resources part ,Acl management..etc Anyway good luck
-
function open() if (guiGetVisible (buttons) == false) then guiSetVisible(buttons, true) addEventHandler("onClientRender", root, dxPanel) showCursor(true) else guiSetVisible(buttons, false) removeEventHandler("onClientRender", root, dxPanel) showCursor(false) end end bindKey ("F1", "down", open)
-
Use dxDrawImage function, and i still have no idea about what does this script
-
You want it like Kill reward system? each kill get the money for it
-
I know it will works i just tried to tell you no need to do a double targets since it the client side work with one target
-
You could use the event onClientKey or you could use the function bindKey it's your choice.
-
AH, so you've to add your resource name in the mtaserver.conf