Jump to content

pa3ck

Members
  • Posts

    1,141
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by pa3ck

  1. setDevelopmentMode(true) function createCol() local x, y, z, width, depth, height = 0, 0, 0, 10, 5, 10 -- Define its position and size. tCol = createColCuboid( x, y, z, width, depth, height) end addEventHandler('onClientResourceStart', getResourceRootElement(getThisResource()), createCol) addEventHandler('onClientColShapeHit', getRootElement(), function() if (source == tCol) then outputChatBox('Hit') -- Put GUI here. end end) Use /showcol to see the colshape.
  2. pa3ck

    Health bar

    Is phealth defined in your script?
  3. Use createColCuboid onClientColShapeHit
  4. getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) But it wont work, as it will not update the position of the player. I would use col shape instead.
  5. Good evening, I've some problems with guiGridListGetSelectedItem. My code is: addEventHandler('onClientGUIClick', button1, function() local tp = guiGridListGetItemText ( gridlist, guiGridListGetSelectedItem ( gridlist ), 1 ) local selp = getPlayerFromName(tp) if (source == button1) then if selp then guiSetVisible(panelEHealth, true) guiBringToFront(panelEHealth) guiSetText(panelEdit, "") addEventHandler('onClientGUIClick', panelEButton, function() if source == panelEButton then hp = guiGetText (panelEdit) hpp = tonumber(hp) guiSetVisible(panelEHealth, false) triggerServerEvent("sethp", getRootElement(), tp, selp, thePlayer, hpp) end end) else outputChatBox('Select a player to set his health.', 255, 0, 0) end end end) My problem is, it works, but when I click on a player, then select an other player, both of their health power will be changed, I don't know why. So it will update the selected row but it keeps the previous player too.
  6. pa3ck

    GUI Problem

    addEventHandler("onClientGUIClick",loginButton2, function() if (source == loginButton2) then tryLogin() end, false) As far as I understood your actual problem, thats what you need.
  7. You should post the line which shows the error.
  8. pa3ck

    a question

    Did you attach the blip to the player? If so, there should be only one blip for each player.
  9. Then you need getElementData as solidsnake said.
  10. What way are you saving their levels?
  11. If you used setElementData then use getElementData to get his level.
  12. Try this: function nn() if isTransferBoxActive() then fadeCamera(false) else fadeCamera(true) end end addEventHandler("onClientPlayerJoin",getRootElement(), nn)
  13. Hi guys, I was looking at the interpolateBetween function, but I did not get it, I can't understand how it works. The example was: local g_Window = nil addCommandHandler("window", function () if g_Window then return end g_Window = {} local screenWidth, screenHeight = guiGetScreenSize() g_Window.windowWidth, g_Window.windowHeight = 400, 315 local left = screenWidth/2 - g_Window.windowWidth/2 local top = screenHeight/2 - g_Window.windowHeight/2 g_Window.window = guiCreateWindow(left, top, g_Window.windowWidth, g_Window.windowHeight, "Interpolation on GUI", false) g_Window.closeBtn = guiCreateButton(320, 285, 75, 23, "Close", false, g_Window.window) guiWindowSetSizable(g_Window.window, false) guiWindowSetMovable(g_Window.window, false) guiSetEnabled(g_Window.window, false) guiSetVisible(g_Window.window, false) g_Window.startTime = getTickCount() g_Window.startSize = {0, 0} g_Window.endSize = {g_Window.windowWidth, g_Window.windowHeight} g_Window.endTime = g_Window.startTime + 1000 addEventHandler("onClientRender", getRootElement(), popWindowUp) end) function on_closeBtn_clicked(button, state, absoluteX, absoluteY) if (button ~= "left") or (state ~= "up") then return end if not g_Window then return end showCursor(false) guiSetEnabled(g_Window.window, false) guiWindowSetMovable(g_Window.window, false) local screenWidth, screenHeight = guiGetScreenSize() local posX, posY = guiGetPosition(g_Window.window, false) g_Window.startTime = getTickCount() g_Window.startSize = {g_Window.windowWidth, g_Window.windowHeight} g_Window.startCenter = { posX + g_Window.windowWidth/2, posY + g_Window.windowHeight/2, } g_Window.endSize = {0, 0} g_Window.endTime = g_Window.startTime + 1000 g_Window.endCenter = { screenWidth, screenHeight } addEventHandler("onClientRender", getRootElement(), popWindowDown) end function popWindowUp() local now = getTickCount() local elapsedTime = now - g_Window.startTime local duration = g_Window.endTime - g_Window.startTime local progress = elapsedTime / duration local width, height, _ = interpolateBetween ( g_Window.startSize[1], g_Window.startSize[2], 0, g_Window.endSize[1], g_Window.endSize[2], 0, progress, "OutElastic") guiSetSize(g_Window.window, width, height, false) local screenWidth, screenHeight = guiGetScreenSize() guiSetPosition(g_Window.window, screenWidth/2 - width/2, screenHeight/2 - height/2, false) if not guiGetVisible(g_Window.window) then guiSetVisible(g_Window.window, true) guiBringToFront(g_Window.window) end if now >= g_Window.endTime then guiSetEnabled(g_Window.window, true) guiBringToFront(g_Window.window) removeEventHandler("onClientRender", getRootElement(), popWindowUp) addEventHandler("onClientGUIClick", g_Window.closeBtn, on_closeBtn_clicked, false) showCursor(true) guiWindowSetMovable(g_Window.window, true) end end function popWindowDown() local now = getTickCount() local elapsedTime = now - g_Window.startTime local duration = g_Window.endTime - g_Window.startTime local progress = elapsedTime / duration local width, height, _ = interpolateBetween ( g_Window.startSize[1], g_Window.startSize[2], 0, g_Window.endSize[1], g_Window.endSize[2], 0, progress, "InQuad") guiSetSize(g_Window.window, width, height, false) local centerX, centerY, _ = interpolateBetween ( g_Window.startCenter[1], g_Window.startCenter[2], 0, g_Window.endCenter[1], g_Window.endCenter[2], 0, progress, "InQuad") guiSetPosition(g_Window.window, centerX - width/2, centerY - height/2, false) if now >= g_Window.endTime then removeEventHandler("onClientRender", getRootElement(), popWindowDown) destroyElement(g_Window.window) g_Window = nil end end I would need further explanation on this example code... Could anyone explain it further more please?
  14. What you mean by "this is for money"? What's for money? Portforwarding? No, its all free...
  15. You need to open your ports. Go to http://portforward.com/english/routers/port_forwarding/ then select your modem / router then select the game ( in this case its MTA )
  16. getVehicleController or the 'onPlayerVehicleEnter' event do the same ( vehicle theVehicle, int seat, player jacked )
  17. I'll use that, thanks again!
  18. Oh, okay, thanks for the quick help.
  19. Its the 18th line. The one with the onClientGUIDoubleClick
  20. Hello there, my problem is that I can't get this damn thing work. Here is the code addEventHandler("onClientResourceStart", resourceRoot, function() jobGui = guiCreateWindow(673, 235, 247, 345, "Jobs ~ pa3ck", false) guiWindowSetSizable(jobGui, false) guiSetVisible(jobGui, false) jobGrid = guiCreateGridList(9, 21, 228, 314, false, jobGui) guiGridListAddColumn(jobGrid, "Job: Payment:", 0.9) jobTrucker = guiGridListAddRow(jobGrid) guiGridListSetItemText(jobGrid, 0, 1, "Trucker 20 dollars", false, false) jobClose = guiCreateButton(14, 277, 200, 27, "Close", false, jobGrid) jobQuit = guiCreateButton(14, 240, 200, 27, "Quit job", false, jobGrid) jobTake = guiCreateButton(14, 203, 200, 27, "Take job", false, jobGrid) addEventHandler('onClientGUIClick', jobClose, function() if (source == jobClose) then guiSetVisible(jobGui, false) showCursor(false) end end) addEventHandler('onClientGUIDoubleClick', jobTrucker, function() if (source == jobTrucker) then outputChatBox('Test.') end end) end ) Debugscript error: Bad argument at line 27, expected element at argument 2 got number "0". The row itself shows up without a problem, I can even click it, but does not do anything. I can't figure out what's the problem... Any idea?
  21. Don't set its position to the first marker, because the player's gonna hit it and will be teleported back to the stadium. Use different variables as well like marker1 and marker2.
  22. Yea, thats what I thought of, but I did not know it takes the markers that are created in that resource only. Thanks for the answer!
  23. Hello there, I'm making a little job ( I'm bored ) and was wondering if I could simplify my code, but I could not find a way. Here is the code: marker1 = createMarker (2363.59326, -1667.18665, 12.6, "cylinder", 0.8, 0, 255, 0) marker2 = createMarker (2363.97681, -1650.78491, 12.6, "cylinder", 0.8, 0, 255, 0) marker3 = createMarker (2383.69360, -1667.21069, 12.6, "cylinder", 0.8, 0, 255, 0) marker4 = createMarker (2395.30908 ,-1650.56726, 12.6, "cylinder", 0.8, 0, 255, 0) marker5 = createMarker (2408.49097, -1667.32104, 12.6, "cylinder", 0.8, 0, 255, 0) marker6 = createMarker (2415.36792, -1650.27344, 12.9, "cylinder", 0.8, 0, 255, 0) addEventHandler('onClientMarkerHit', marker1, function(hitPlayer) if hitPlayer == getLocalPlayer() then hitMarker = setTimer(function() outputChatBox('You got your money.') givePlayerMoney(hitPlayer, 500) destroyElement(marker1) end, 5000, 1) end end) addEventHandler('onClientMarkerLeave', marker1, function(leavingPlayer) if leavingPlayer == getLocalPlayer() and isTimer(hitMarker) then outputChatBox('Wait a few seconds please!') killTimer(hitMarker) end end) I don't want to write a 'onClientMarkerHit' function for each of the markers, is there anyway to do this? I don't know if you get what I'm trying to say here.
  24. You forgot to 'end' the function. Just write 1 more end at the end.
  25. pa3ck

    ColRadar

    Actually the other one is pretty straight forward, just like cuboid, X, Y the pos you want to place the rectangle at, the width is the width and the height is the length I think, as you can not set its height. So pos, length and width.
×
×
  • Create New...