-
Posts
1,273 -
Joined
-
Last visited
-
Days Won
1
Everything posted by GTX
-
Test what I gave you, don't create a new post... The code I gave you should do the job... If I understood you correctly...
-
Your code is such a mess. I won't even bother tabulating it. local locations = { { 1463.80, 2823.78, 10.82}, { -1975.6, 1227.14, 31.83 }, { -2285.64, -12.7, 35.53 }, { -2147.59, -139.86, 36.73 }, { -2035.11, -43.72, 35.65 }, { -2120.84, -4.27, 35.53 }, { -2053.64, 82.59, 28.6 }, { -1917.56, 82.59, 28.6 }, { -1481, 686.4, 1.32 } } local pos = locations[math.random(#locations)] local x,y,z = unpack ( pos ) deliveryBaseLV = createPickup(x, y, z, 3, 1210, 222, 1) blip = createBlip(x, y, z, 37, 2, 255, 255, 255, 255, 0, 400) function pickupMallete(player) setElementData(player, "havePickup", true) burger = createObject(1210,0,0,0) myBlip = createBlipAttachedTo ( burger, 37 ) exports.attacher:attachElementToBone(burger,player,12,0,0.1,0.3,0,180,0) if isElement(blip) then destroyElement(blip) end if isElement(deliveryBaseLV) then destroyElement(deliveryBaseLV) end triggerClientEvent(player, "delivery:gotJob",player,pickupMallete) end addEventHandler ( "onPickupHit", deliveryBaseLV , pickupMallete ) local reward = math.random (2999,5300) function deliveryDoneJob() if isElement(burger) then destroyElement(burger) end if isElement(myBlip) then destroyElement(myBlip) end setElementData(source, "reward", reward) givePlayerMoney(source,reward) outputChatBox("You deliveryed the briefcase succesfully,Here's your reward: " ..reward.."$ well done!",source,0,255,231) setElementData(source, "havePickup", false) end addEvent("delivery:doneJob", true) addEventHandler("delivery:doneJob", root, deliveryDoneJob) function pickupthit(player) if getElementData(source, "havePickup") ~= true then return end if isElement(myBlip) then destroyElement(myBlip) end if isElement(deliveryBaseLV) then destroyElement(deliveryBaseLV) end if isElement(blip) then destroyElement(blip) end if isElement(deliveryBase) then destroyElement(deliveryBase) end if isElement(burger) then destroyElement(burger) end local x, y, z = getElementPosition ( source ) deliveryBase = createPickup ( x, y, z, 3, 1210, 200, 1 ) blip = createBlip(x, y, z, 37, 2, 255, 255, 255, 255, 0, 400) addEventHandler("onPickupHit", deliveryBase , goTake) end addEventHandler( "onPlayerWasted", root,pickupthit) function goTake(player) burger = createObject(1210,0,0,0) myBlip = createBlipAttachedTo ( burger, 37 ) exports.attacher:attachElementToBone(burger,player,12,0,0.1,0.3,0,180,0) if isElement(blip) then destroyElement(blip) end destroyElement(source) triggerClientEvent(player, "delivery:gotJob",player,pickupMallete) end
-
Well, if you don't give the necessary part, I can't help you. And about your last post, I didn't get a word you said.
-
Do not put it in a timer and don't trigger it everytime you loop through accounts. Only 1 time. I gave you all info you need in my previous post... function requestAccounts() local accounts = {} for i, v in ipairs(getAccounts()) do if getAccountPlayer(v) then accounts[v] = {getAccountPlayer(v), getAccountName(v)} else accounts[v] = {false, getAccountName(v)} end end triggerClientEvent(source, "sendAccounts", source, accounts) end addEvent("requestData", true) addEventHandler("requestData", root, requestAccounts) addEventHandler("onClientResourceStart", resourceRoot, function() triggerServerEvent("requestData", localPlayer) end ) function addAccountsToGridlist(accounts) for i, v in pairs(accounts) do if v[1] ~= false then -- Account is online, add it to grid list and set as online. Get his player name. local row = guiGridListAddRow(GridList) guiGridListSetItemText(GridList, row, Admin, getPlayerName(v[1]).." - "..v[2], false, false) guiGridListSetItemText(GridList, row, Status, "Online", false, false) else -- Account is offline, add it to grid list (?) and set as offline. Also get his account name instead name. local row = guiGridListAddRow(GridList) guiGridListSetItemText(GridList, row, Admin, v[2], false, false) guiGridListSetItemText(GridList, row, Status, "Offline", false, false) end end end addEvent("sendAccounts", true) addEventHandler("sendAccounts", root, addAccountsToGridlist)
-
Yep. But first send a request from client side because if client doesn't load before server, it'll give you an error (Server triggered client side event but ... is not added client side)
-
Put them in a table and send that table to client. local accounts = {} for i, v in ipairs(getAccounts()) do if getAccountPlayer(v) then accounts[v] = {getAccountPlayer(v), getAccountName(v)} else accounts[v] = {false, getAccountName(v)} end end And then client side loop through. for i, v in pairs(accounts) do if v[1] ~= false then -- Account is online, add it to grid list and set as online. Get his player name. local row = guiGridListAddRow(GridList) guiGridListSetItemText(GridList, row, Admin, getPlayerName(v[1]).." - "..v[2], false, false) guiGridListSetItemText(GridList, row, Status, "Online", false, false) else -- Account is offline, add it to grid list (?) and set as offline. Also get his account name instead name. local row = guiGridListAddRow(GridList) guiGridListSetItemText(GridList, row, Admin, v[2], false, false) guiGridListSetItemText(GridList, row, Status, "Offline", false, false) end end You can use this for colors: guiGridListSetItemColor
-
Nope. for i, v in ipairs(getAccounts()) do if getAccountPlayer(v) then -- ACCOUNT IS ONLINE - Account: v, Player: getAccountPlayer(v) else -- ACCOUNT IS OFFLINE - Account: v, Player: Unable to get player, because he is offline. end end
-
You can't set element data for timer. It's very necessary for you, but at least if you'd tell us why do you want to do that.
-
getAccounts getAccountPlayer
-
This should work fine. -- Source: [url=http://stackoverflow.com/questions/12102222/how-to-test-for-1-ind-indeterminate-in-lua#answer-12103118]http://stackoverflow.com/questions/1210 ... r-12103118[/url] local function isnan(x) if (x ~= x) then return true end if type(x) ~= "number" then return false end if tostring(x) == tostring((-1)^0.5) then return true end return false end
-
That's because you add rows twice for each column. guiGridListSetItemText(GridList, guiGridListAddRow(GridList), plrName, v.name, false, false) guiGridListSetItemText(GridList, guiGridListAddRow(GridList), plrMsg, v.message, false, false) Add it only once. local row = guiGridListAddRow(GridList) guiGridListSetItemText(GridList, row, plrName, v.name, false, false) guiGridListSetItemText(GridList, row, plrMsg, v.message, false, false)
-
There are even more worse things that cause lag. Like looping a table (which may have a lot of data) inside a function which is above event onClientRender.
-
Can you stop bumping the topic after 30 minutes? And a triple post? EDIT YOUR LAST POST. Why did you use onVehicleEnter? Delete it. Read wiki: warpPedIntoVehicle Attention: If you used setElementPosition to spawn the ped/player, this function will not work and returns false.
-
Of course, because it's global. x1=-357.10000610352 y1=1588.0999755859 z1=2683 function gotoloja(thePlayer) local accountname = getAccountName ( getPlayerAccount ( thePlayer )) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" )) or isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "SuperModerator" )) or isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Moderator" )) or isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Helper" )) then if getElementData(thePlayer, "loja") == false then --check if is in loja setElementPosition(thePlayer, x1, y1, z1) setElementData(thePlayer, "loja", true) -- set true setElementData(thePlayer, "vector", {getElementPosition(thePlayer)}) else local x, y, z = unpack(getElementData(thePlayer, "vector")) setElementPosition(thePlayer, x, y ,z) setElementData(thePlayer , "loja", false) -- set false end end end addCommandHandler("loja",gotoloja)
-
*facepalm* What do you expect it to do? if x >= screenW * 0.1875 and y >= screenH * 0.6267 and x <= screenW * 0.1875+screenW * 0.7025 and y <= screenH * 0.6267+screenH * 0.0233 then -- Write whatever you want to do here!!! end
-
I don't understand, why do you bold your text? It's always the same. addEventHandler("onClientResourceStart", resourceRoot, function() Window = guiCreateWindow(373, 189, 519, 426, "..: [ Chat Log v1.0 ] :..", false) guiWindowSetSizable(Window, false) guiSetAlpha(Window, 1.00) guiSetVisible(Window,false) GridList = guiCreateGridList(9, 24, 500, 392, false, Window) plrName = guiGridListAddColumn(GridList, "# Player Name :", 0.4) plrMsg = guiGridListAddColumn(GridList, "# Chat Message :", 0.4) triggerServerEvent("requestData", localPlayer) end ) function Load() local logs = executeSQLQuery("SELECT * FROM logs") if #logs > 0 then triggerClientEvent(source, "addLogs", source, logs) end end addEvent("requestData", true) addEventHandler("requestData", root, Load)
-
Wtf, stop bumping the topic after 1 hour... addEventHandler("onClientClick", root, function(button, state, x, y) if button == "left" and state == "down" then if x >= screenW * 0.1875 and y >= screenH * 0.6267 and x <= screenW * 0.1875+screenW * 0.7025 and y <= screenH * 0.6267+screenH * 0.0233 then -- Do something... end end end )
-
Yes, you can do that. local markerSize = get"markerSize" addEvent("onRequestSettings", true) addEventHandler("onRequestSettings", root, function() triggerClientEvent(source, "receiveSettings", source, markerSize) end ) local MarkerSize = -0.1 addEvent("receiveSettings", true) addEventHandler("receiveSettings", root, function(markerSize) MarkerSize = markerSize end ) addEventHandler("onClientResourceStart", resourceRoot, function() triggerServerEvent("onRequestSettings", localPlayer) end )
-
No... I'm telling your script works fine as it should. x1=-357.10000610352 y1=1588.0999755859 z1=2683 local x, y, z function gotoloja(thePlayer) if getElementData(thePlayer, "loja") == false then --check if is in loja x, y, z = getElementPosition(thePlayer) setElementPosition(thePlayer, x1, y1, z1) setElementData(thePlayer, "loja", true) -- set true else setElementPosition(thePlayer, x, y ,z) setElementData(thePlayer , "loja", false) -- set false end end addCommandHandler("loja",gotoloja)
-
Are you sure you tested it? The code from my post works, unless you have set the script to client side in meta.
-
x1=-357.10000610352 y1=1588.0999755859 z1=2683 function gotoloja(thePlayer) local x, y, z = getElementPosition(thePlayer) if getElementData(thePlayer, "loja") == false then --check if is in loja setElementPosition(thePlayer, x1, y1, z1) setElementData(thePlayer, "loja", true) -- set true else setElementPosition(thePlayer, x, y ,z) setElementData(thePlayer , "loja", false) -- set false end end addCommandHandler("loja",gotoloja)
-
They can be. Do what I said.
-
It may be because of your scripts.
-
Client side must be first in meta to load.
-
You've set relative argument to true, while your positions are absolute. guiCreateEdit(..., "Username...", false)