Jump to content

idarrr

Members
  • Posts

    133
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by idarrr

  1. The problem is on client side code. You are trying to set an element data for another player on client side.
  2. idarrr

    can't store data

    mg is not an element, mg is a lua table. You can't set an element data of a lua table. Post your full code so we can help.
  3. Then use this setElementVelocity
  4. idarrr

    Blip show

    setElementVisibleTo
  5. @raysmta Sorry made a mistake, I was sleepy last night. local x, y = interpolateBetween ( x1, y1, 0, -- Start point x, y x2, y2, 0, -- End point x, y progress, "Linear")
  6. startLogin = getTickCount() function dxDrawLogin() -- ANIMATION -- local now = getTickCount() local elapsedTime = now - startLogin local duration = 1000 -- Duration 1 second or you can change it local progress = elapsedTime / duration local x1, y1 = 0, 0 -- Start point x and y anim local x2, y2 = 400, 400 -- End point x and y anim local x, y = interpolateBetween ( x1, x1, 0, -- Start point x, y x2, x2, 0, -- End point x, y progress, "Linear") -- You can change the "Linear" string with another easing type -- ANIMATION -- dxDrawImage(x*0,y*0,x*1280,y*720, "bg.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText(guiGetText(edit_username), x*504, y*321, x*714, y*341, tocolor(255, 255, 255, 255), 1.00, "default", "left", "center", false, false, true, false, false) dxDrawText(string.rep ( "*", string.len ( guiGetText(edit_password) ) ), x*504, y*369, x*714, y*389, tocolor(255, 255, 255, 255), 1.00, "default", "left", "center", false, false, true, false, false) dxDrawText("Remember Credentials", x*560, y*416, x*700, y*438, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, true, false, false) local r,g,c if isMouseInPosition(x*452, y*448, x*335, y*41) then r,g,c = 0, 96, 93 else r,g,c = 127, 169, 168 end dxDrawRectangle(x*452, y*448, x*335, y*41, tocolor(r,g,c, 127), true) dxDrawText("Sign In", x*451, y*448, x*787, y*489, tocolor(255, 255, 255, 255), 1.40, "default", "center", "center", false, false, true, false, false) local r,g,c if isMouseInPosition(x*452, y*499, x*335, y*41) then r,g,c = 0, 96, 93 else r,g,c = 127, 169, 168 end dxDrawRectangle(x*452, y*499, x*335, y*41, tocolor(r,g,c, 127), true) dxDrawText("Play As Guest", x*451, y*499, x*787, y*540, tocolor(255, 255, 255, 255), 1.40, "default", "center", "center", false, false, true, false, false) end addEventHandler("onClientRender", root, dxDrawLogin) Don't forget to change x1, y1, x2, y2 value. That's just an example. More details on wiki: interpolateBetween Easing
  7. You can use setElementInterior setElementDimension See here for the list of Interior IDs This is example how to move a player using pick up hit: local warehouse = createPickup ( 10.0, 10.0, 10.0, 3, 1273) -- Create a House Pick Up -- Event if Player hit the pick up, we move that player to interior -- According to Interior list, Warehouse 1 is in coordinate {1405.3120, -8.2928, 1000.9130} and in interior id 1 addEventHandler ( "onPickupHit", warehouse, function(player) setElementPosition(player, 1405.3120, -8.2928, 1000.9130) setElementInterior(player, 1) setElementDimension(player, 1) end )
  8. Not sure if it's gonna work. This function will return the closest spawn point coordinate from the player coordinate nearSP = {} function getSpawnpointPosition(player) -- The argument her is the player, cuz we need to get their coor local px, py, pz = getElementPosition(player) for i, v in ipairs(allSpawnpoints) do -- Loop all spawn point to get closest sp local x = tonumber(getElementData(v, 'posX')) local y = tonumber(getElementData(v, 'posY')) local z = tonumber(getElementData(v, 'posZ')) local dist = getDistanceBetweenPoints3D(x, y, z, px, py, pz) if not nearSP[player] then nearSP[player] == {v, dist} elseif nearSP[player][2] > dist then -- If the distance is closest then the other, store it here nearSP[player] == {v, dist} -- v = the spawn point element, dist = the distance end end local id = getElementID(nearSP[player][1]) local vehID = tonumber(getElementData(nearSP[player][1], 'vehicle')) local rot = tonumber(getElementData(nearSP[player][1], 'rotation') or getElementData(nearSP[player][1], 'rotZ')) nearSP[player] = nil return x, y, z, id, vehID, rot end -- Then call this getSpawnpointPosition(player)
  9. -- Client Side addEvent("onBotSpawn1",true) addEventHandler("onBotSpawn1",root, function () playSound("BotSpawn.ogg") end ) Also read this from wiki about triggerClientEvent: function Bot1 () exports [ "slothBot" ]:spawnBot ( x, y, z, rotation, skin1, intr, dims, team, wep, "hunting", true ) for _, player in ipairs(getElementsByType("player")) do triggerClientEvent( player,"onBotSpawn1",player) end outputChatBox ("Bot Spawned",getRootElement(), 255, 255, 255, true ) end
  10. Maybe this payphones[_]["PosX"] = row[column]["PosX"] -- or payphones[_]["PosX"] = value["PosX"] Depend on table structure. This error "attempt to index field '?' (a nil value)" means that the index or the table doesnt exist. You can try this. for _, row in ipairs (result) do payphones[_] = {["PosX"] = row[_]["PosX"], ["PosY"] = row[_]["PosY"], ["PosZ"] = row[_]["PosZ"]} outputChatBox(inspect(payphones[_])) end Not sure what are you trying to do with that.
  11. idarrr

    Help

    try this? function onClientResourceStart () setPlayerHudComponentVisible("radar", false) end addEventHandler("onClientResourceStart",resourceRoot,onClientResourceStart)
  12. function withdraw(player,cmd,number) if not number then -- This block should be in the first place before variable number defined. outputChatBox("#27B86C[USE]: #ffffff/" .. cmd .. " [Ammount]", player, 38, 194, 129, true) else local number = math.abs(tonumber(number)) local bankbalance = tonumber(getElementData(player, "account:bankbalance")) or 0 if number > bankbalance then outputChatBox("#B1092D[Error]: #ffffffYour bank balance is "..bankbalance..".", player, 177,9,45, true) elseif bankbalance >= number then givePlayerMoney(player,number) setElementData(player, "account:bankbalance", bankbalance - number) --qoutputChatBox("#B1092D[Error] #ffffffYou dont have enough money.", player, 177,9,45, true) end end end addCommandHandler("withdraw",withdraw)
  13. Sure, this may work, im not testing it yet. -- Use this format -- {marker X, Y, Z, Type, Size, R, G, B, A, Dimension, Interior, Warp point X, Y, Z, Dimension, Interior }, data = { {2412.501953125 , 1123.806640625 , 10.8203125 +1 ,"arrow" ,1.8, 255, 255, 0, 255, 0, 0, 388.8701171875 , 173.806640625 , 1008.3828125 , 0, 3}, {390.76953125 , 173.7890625 , 1008.3828125 +1 ,"arrow" ,1.8, 255, 255, 0, 255, 0, 3, 2414.3779296875, 1123.6572265625, 10.8203125 , 0, 0}, {368.4228515625 , 194.0439453125 , 1008.3828125 +1 ,"arrow" ,1.4, 255, 50 , 0, 255, 0, 3, 2147.8505859375, 1601.66796875 , 1006.1677246094, 0, 1}, } markers = {} -- Table to store the element markers here for i, v in pairs(data) do local marker = createMarker(v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8], v[9]) setElementDimension(marker, v[10]) setElementInterior(marker, v[11]) markers[marker] = {v[12], v[13], v[14], v[15], v[16]} -- Store the warp point addEventHandler("onMarkerHit", marker, warp) -- Attach an event to every marker end function warp (player) if markers[source] and isElement(player) and getElementType(player) == "player" then -- Make sure the element is a player and hit the right marker setElementPosition(player, markers[source][1], markers[source][2], markers[source][3]) setElementDimension(player, markers[source][4]) setElementInterior(player, markers[source][5]) end end
  14. function pedLoad () local ped1 = createPed ( 105, 2144.974609375, 1633.62890625, 993.57611083984 ) setElementInterior(ped1, 1) end addEventHandler ( "onResourceStart", getResourceRootElement(), pedLoad ) Replace the pedLoad function with this.
  15. Where is WrapedPlayers table?
  16. idarrr

    help

    addEventHandler("onClientGUIClick",GUIEditor_Button[1], function (button) if (source == GUIEditor_Button[1]) and (button == "left") then guiSetVisible (GUIEditor_Window[1],false) showCursor (false) triggerServerEvent ("satw", getLocalPlayer(),satw) end end) addEventHandler("onClientGUIClick",GUIEditor_Button[30], function (button) if (source == GUIEditor_Button[30]) and (button == "left") then guiSetVisible (GUIEditor_Window[1],false) showCursor (false) end end)
  17. Use this event may help. OnClientPlayerChangeNick OnPlayerChangeNick
  18. Is that client side or server side code? If client side: function zombieChange() local timehour, timeminute = getTime() if timehour == 12 then outputChatBox( "works", 255, 0, 255 ) -- No need to add player here, as it a client script it will only show the output for the client it self. end end If server side: function zombieChange(player) -- Add player argument here local timehour, timeminute = getTime() if timehour == 12 then outputChatBox( "works", player, 255, 0, 255 ) -- Show the output only for the player who called the function. end end And also if its a server side code, where did you call it?
  19. Maybe the WrapedPlayers is the problem, the eventPlayers is nil.
  20. This problem already solved in here.
×
×
  • Create New...