Jump to content

Bonus

Members
  • Posts

    297
  • Joined

  • Last visited

Everything posted by Bonus

  1. Save it in a table like in Nokis first code. local markers = {} ... for i=1, #robmarkers do markers[i] = createMarker ... end -- to destroy all -- for i=1, #markers do if isElement ( markers[i] ) then destroyElement ( markers[i] ) end end markers = {}
  2. I think there are no peds for the markers. Just use a table and loop it. In your code I can't see what you are exactly doing. But notice: If you create the markers clientsided, only the client will see and use it.
  3. Use /timer 5 I expected you to know how to use commands. Oh and use tonumber ( timeinsec ) there endtime = getTickCount() + tonumber ( timeinsec ) * 1000
  4. 1. You can create your own system with onClientPlayerWeaponFire, onClientPlayerWeaponSwitch, toggleControl to deactivate it, bindKey and toggleControl together to activate it, getTickCount() to get the time past till the last shot. 2. Don't think so, not sure
  5. The function targetPed is really useless. You are using storePed, what is that? local shoprobped = nil addEventHandler("onClientPlayerTarget", client, function (target) if isElement ( target ) and peds[target] then if isTimer(cooldown) then return end triggerServerEvent("onRob", client) setPedAnimation(target, "shop", "SHP_Rob_HandsUp", -1, false) cooldown = setTimer(function() end, 300000, 1) shoprobped = target -- save the ped end end) ... function renderDistanceCheck () if ((not isPedDead(client)) and getElementInterior(client) == 0) and isElement ( shoprobped ) then local ox, oy, oz = peds[shoprobped][1], peds[shoprobped][2], peds[shoprobped][3] -- use the ped local x, y, z = getElementPosition(client) if (getDistanceBetweenPoints2D(ox, oy, x, y) >= 300) then triggerServerEvent("robstore:giveReward", client, client) addEventHandler("onClientRender", root, render) -- I hope render is "local" here removeEventHandler ("onClientRender", root, renderDistanceCheck) setTimer(function() removeEventHandler("onClientRender", root, render) end, 5000,1) end end end end
  6. Yes, thats not the way I meant. You are using onClientPlayerTarget on the ped, right? Just save the ped there and use it in renderDistanceCheck.
  7. Because you can't use "test" in an addCommandHandler ... "Note: You cannot use "list" or "test" as command name."
  8. Dont change the fontsize. Just -1 on x and +1 on y. dxDrawText ( playerName, sx-1, sy - offset+1, sx-1, sy - offset+1, tocolor(0,0,0,200), textScale*Nametags_Size*0.7, myfont, "center", "bottom", false, false, false, true, true ) dxDrawText ( playerName, sx, sy - offset, sx, sy - offset, tocolor(r,g,b,255), textScale*Nametags_Size*0.7, myfont, "center", "bottom", false, false, false, true, true )
  9. local peds = { [createPed(205, 376.51, -65.84, 1001.50, 180)] = {1199.13, -918.07, 43.12, 1, 10}, [createPed(205, 376.51, -65.84, 1001.50, 180)] = {-1912.27, 828.02, 35.21, 2, 10}, [createPed(205, 376.51, -65.84, 1001.50, 180)] = {-2336.94, -166.64, 35.55, 3, 10}, } for ped, array in pairs ( peds ) do setElementFrozen ( ped, true ) setElementInterior ( ped, array[5] ) setElementDimension ( ped, array[4] ) end Dont need to put it into onClientResourceStart or any other function.
  10. You have to loop the table with pairs.
  11. Oh sure, I let you try with deleting the first thePlayer, but not the second thePlayer -.-' The player element doesnt exist on connect, so you can't use getPlayerFromName.
  12. I had the problem too, but in my case the vehicles just fall through the ground and spawned at the next lower place. So I just had to freeze them with setElementFrozen. Are you guys sure with the desync? Never had this problem after I froze the vehicles. But with "the vehicles" I talk about like 15. Never tested with more vehicles and tosfera is talking about "sh*tload", so maybe its normal, that I never experienced that.
  13. You shouldn't get the position of the ped, because the ped is in another interior and other position. If the player goes out of the interior he could be somewhere far away from the ped position. There are 2 easy ways: 1. Save the peds in a table with the coordinates of the shop in interior 0. Like that: local shoppeds = { [createPed ( ... )] = { 123, 1512, 10.2 }, {createPed ( ... )] = { 556, -234, 5.6 }, .... } Then you can get the position with: local x, y, z = shoppeds[ped][1], shoppeds[ped][2], shoppeds[ped][3] You are using onClientPlayerTarget for your shoprob, right? So you get the ped in that function, no need for getPedTarget 2. Not sure if it will work: When the shoprob starts, create an addEventHandler ( "onClientMarkerLeave", root, asdasda ). There you can ask, if getElementInterior == 0. If its true, you can remove this event handler and get the position of source. source has to be the marker in interior 0 to get into the shop, the entrance for the shop. But care: You have to remove the onClientMarkerLeave Event when the player dies or the shoprobs stops.
  14. debugscript doesnt show any errors? Even not in script restart? I don't see any problem here Try to trigger the event one time to all (delete the first thePlayer) to test it. Does it work?
  15. Show me what you did. It should have worked.
  16. try root instead of localPlayer in lines 25 and 26.
  17. getDistanceBetweenPoints3D or 2D
  18. This code shouldn't cause lag.
  19. 1. The 2. line isn't needed, delete it. 2. You use client? Why? It's clientsided, why not use localPlayer? Does it even work with client? Maybe its working and I never knew that client == localPlayer 3. The distance is in 3D. If you fly high, you got a distance too.
  20. local endtime = 0 local function renderCountdown ( ) local lefttime = endtime - getTickCount() if lefttime > 0 then dxDrawText ( math.ceil ( lefttime ) ... elseif lefttime >= -3000 then dxDrawText ( "GO!" ... ) else removeEventHandler ( "onClientRender", root, renderCountdown ) end end addCommandHandler ( "startcountdown", function ( _, timeinsec ) endtime = getTickCount() + timeinsec * 1000 -- To save the time when the countdown will end addEventHandler ( "onClientRender", root, renderCountdown ) end )
  21. 1. The button got the name button, but you use the addEventHandler on gomb ... what is gomb? 2. You use the function Sleuth, but the function is called sleuth (case-sensitiv) 3. You use the function before it's created. 4. You use killer, but where do you get him?! 5. You use gyilkos, but where do you get him?! 6. You don't even use killername and gyilkos in Server.lua 7. You use jatekos, what is that? 8. You use killer, what is that here? You didnt use the killer of Client.lua
  22. local limit = tonumber(limit)+1 That is better But care: The countdown will finish in under 50 milliseconds.
  23. Bonus

    MTA SQL

    Don't use free_result on a boolean (dbExec gives you boolean). Did you look into debugscript? And he is right, better use db functions.
  24. Your code: local currentCount = getTickCount() currentCount - systemUpTime + getTickCount() What it does: getTickCount() some ms ago - 120000 + getTickCount() now example: 199 - 120000 + 200 It will always be something like -199999.
×
×
  • Create New...