Jump to content

nurfaizfy19

Members
  • Posts

    12
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

nurfaizfy19's Achievements

Square

Square (6/54)

0

Reputation

  1. thanks for the advice but i need this, because i also use the function in server side. any idea? thanks
  2. hello, sorry for my bad english i want to get data from server side with database in client side i have server side function: function getPulsa(phone) local phoneSettings = mysql:query_fetch_assoc("SELECT * FROM `phones` WHERE `phonenumber`='"..mysql:escape_string(tostring(phone)).."' LIMIT 1") local pulsa = 0 if not phoneSettings then outputChatBox("ERROR", source, 255, 0, 0) else pulsa = tonumber(phoneSettings["pulsa"]) or 0 end return pulsa end addEvent("getPulsa", true) addEventHandler("getPulsa", root, getPulsa) and then i want to call the function in client side function: function getPulsa(nomor) return triggerServerEvent("getPulsa", localPlayer, tonumber(nomor)) end function testPulsa(commandName, nomoer) local pulsa = getPulsa(nomoer) outputChatBox(pulsa or "ERROR") end addCommandHandler("getpulsa", testPulsa, false, false) when i try to execute the command "/getpulsa", the output is boolean. i need the output in number thanks
  3. Wow, amazing. It work fine. Thank you. One more, there are close button, when I or player click close button the window will destroyed or disappeared, but when I or player reopen the register_panel the browser can't load anything, how to reset the browsergui after click close button?
  4. Hello, sorry for my bad English I'm looking for a way to load a website in the game, for example a website that I have forum.javaliferoleplay.web.id I have a code like this function register_panel( ) local screenWidth, screenHeight = guiGetScreenSize() local windowWidth, windowHeight = 1280, 720 local left = screenWidth/2 - windowWidth/2 local top = screenHeight/2 - windowHeight/2 local window = guiCreateWindow( left, top, windowWidth, windowHeight , "Register", false ) local browser = guiCreateBrowser( 0, 28, windowWidth, windowHeight -60, false, false, false, window ) local theBrowser = guiGetBrowser( browser ) guiWindowSetSizable(window, false) requestBrowserDomains({ "forum.javaliferoleplay.web.id" }) addEventHandler( "onClientBrowserCreated", theBrowser, function( ) loadBrowserURL( source, "http://forum.javaliferoleplay.web.id/" ) end ) local close = guiCreateButton(0, 700, 1280, 50, "CLOSE", false, window) addEventHandler ( "onClientGUIClick", close, function() guiSetVisible(window, false) end ) end In the code above, the website I intended to load does not appear, but there is a dialog box asking for permission to open the link. But when opening youtube for example, the website opens normally. Can someone help me? Thanks before
  5. Hello, sorry for my bad english I want to make water elements in the gutter like in the screenshot, I use the function below function setWater() setWaterLevel(10) end addEventHandler("onResourceStart", root, setWater) the function above changes all elements of water including the sea, so buildings near the sea will be submerged in water. how to make the water level only in the gutter? Thanks
  6. Oke, i solve this problem. I just add setElementVisibleTo to root and player, and now its work normally. Thanks for your helping
  7. how can it work for you? i tried your suggest but i've got error function checkPlayersInTeam() for _, player in ipairs(exports.pool:getPoolElementsByType("player")) do if getElementData(player, "loggedin") then local Team = getPlayerTeam(player) local factionType = getElementData(Team, "type") or 99 for key, pArea in ipairs(pArea) do if (factionType==0) then setElementVisibleTo(pArea[key], player, true) else setElementVisibleTo(pArea[key], player, false) -- line 87 end end end end end function hideTurf() setTimer(checkPlayersInTeam, 5000, 0) end
  8. Hello, sorry for my bad english i have turf war script, for example i have function to create area turf mysql = exports.mysql local pCuboid = nil local pArea = nil function loadAllTurf(res) local result = mysql:query("SELECT id FROM `turf` ORDER BY `id` ASC") if (result) then local run = true while run do local row = mysql:fetch_assoc(result) if not row then break end if res then loadOneTurf(row['id'], true) else loadOneTurf(row['id']) end end end mysql:free_result(result) exports['global']:sendMessageToAdmins("All area turf loaded") end addEventHandler("onResourceStart", getResourceRootElement(), loadAllTurf) function loadOneTurf(id, state) local row = mysql:query_fetch_assoc("SELECT * FROM turf WHERE id = '"..mysql:escape_string(id).."'") if row then local id = tonumber(row['id']) local name = row['turf_name'] local owner = tonumber(row['owner_id']) local r, g, b = tonumber(row['r']), tonumber(row['g']), tonumber(row['b']) local x, y, z = tonumber(row['turfx']), tonumber(row['turfy']), tonumber(row['turfz']) local long, width = tonumber(row['turflong']), tonumber(row['turfwidth']) local ownerName = exports.factions:getFactionName(owner) pCuboid = createColCuboid(x, y, z-10, long, width, z+30) pArea = createRadarArea(x, y, long, width, r, g, b, 100 ) hideTurf(pArea) exports.pool:allocateElement(pCuboid) setElementInterior(pCuboid, 0) setElementDimension(pCuboid, 0) addEventHandler("onColShapeHit", pCuboid, onTurfEnter) addEventHandler("onColShapeLeave", pCuboid, onTurfLeave) exports.anticheat:changeProtectedElementDataEx(pCuboid, "turf", true, false) exports.anticheat:changeProtectedElementDataEx(pCuboid, "id", id, false) exports.anticheat:changeProtectedElementDataEx(pCuboid, "x", x, false) exports.anticheat:changeProtectedElementDataEx(pCuboid, "y", y, false) exports.anticheat:changeProtectedElementDataEx(pCuboid, "z", z-10, false) exports.anticheat:changeProtectedElementDataEx(pCuboid, "name", name, false) exports.anticheat:changeProtectedElementDataEx(pCuboid, "owner", owner, false) exports.anticheat:changeProtectedElementDataEx(pCuboid, "long", long, false) exports.anticheat:changeProtectedElementDataEx(pCuboid, "width", width, false) exports.anticheat:changeProtectedElementDataEx(pCuboid, "friendly", owner, false) exports.anticheat:changeProtectedElementDataEx(pCuboid, "radar", pArea, false) exports.anticheat:changeProtectedElementDataEx(pCuboid, "payment", math.floor((long*width)/20), false) exports.anticheat:changeProtectedElementDataEx(pArea, "turf", true, false) exports.anticheat:changeProtectedElementDataEx(pArea, "x", x, false) exports.anticheat:changeProtectedElementDataEx(pArea, "y", y, false) exports.anticheat:changeProtectedElementDataEx(pArea, "long", long, false) exports.anticheat:changeProtectedElementDataEx(pArea, "width", width, false) exports.anticheat:changeProtectedElementDataEx(pArea, "owner", owner, false) exports.anticheat:changeProtectedElementDataEx(pArea, "r", r, false) exports.anticheat:changeProtectedElementDataEx(pArea, "g", g, false) exports.anticheat:changeProtectedElementDataEx(pArea, "b", b, false) end end and I want to hide the turf area on players who are not in faction by checking every 5 seconds, I've tried using the script below but it doesn't work function checkPlayersInTeam(area) for _, player in ipairs(exports.pool:getPoolElementsByType("player")) do if getElementData(player, "loggedin") then local Team = getPlayerTeam(player) local factionType = getElementData(Team, "type") or 99 if (factionType==0) then setElementVisibleTo(area, player, true) -- i want to show the area to player who factiontype is 0 (when i change player with root it works show the area) else setElementVisibleTo(area, player, false) -- i want to hide the area to player who factiontype is not 0 (when i change player with root it works hide the area) end end end end function hideTurf(area) setTimer(checkPlayersInTeam, 5000, 0, area) end can anyone help me? thank you very much
  9. i tried it but still got boolean It works for me, thank you very much
  10. I think your code is correct, but you missed one string
  11. sorry for my bad english i want to get cursor position, but in debug show me an error got boolean. I have the code below .... local sx,sy = guiGetScreenSize() local cx,cy = getCursorPosition() local cx,cy = cx*sx,cy*sy -- line 222 .... error message how to solve this? thank you very much
  12. Hello MTA, sorry if my English is bad I'm looking for a way to load a website in the game, for example a website that I have forums.javaliferoleplay.web.id I have a code like this function register_panel( ) local screenWidth, screenHeight = guiGetScreenSize() local windowWidth, windowHeight = 1280, 720 local left = screenWidth/2 - windowWidth/2 local top = screenHeight/2 - windowHeight/2 local window = guiCreateWindow( left, top, windowWidth, windowHeight , "Register", false ) local browser = guiCreateBrowser( 0, 28, windowWidth, windowHeight -60, false, false, false, window ) local theBrowser = guiGetBrowser( browser ) guiWindowSetSizable(window, false) requestBrowserDomains({ "forums.javaliferoleplay.web.id" }) addEventHandler( "onClientBrowserCreated", theBrowser, function( ) loadBrowserURL( source, "http://forums.javaliferoleplay.web.id/" ) end ) local close = guiCreateButton(0, 700, 1280, 50, "CLOSE", false, window) addEventHandler ( "onClientGUIClick", close, function() guiSetVisible(window, false) end ) end In the code above, the website I intended to load does not appear, but there is a dialog box asking for permission to open the link. But when opening youtube for example, the website opens normally. Can someone help me? Thanks before
×
×
  • Create New...