Jump to content

Peti

Members
  • Posts

    82
  • Joined

  • Last visited

Everything posted by Peti

  1. function playerPressedKey(button, press) if press then if button == "w" then setPedAnimation(localPlayer) end end end addEventHandler("onClientKey", root, playerPressedKey) I think this should work.
  2. Well I don't have the warnings anymore, but it keeps triggering 4 times. Thank you nonetheless! BTW, how do you guys check if a table is empty?
  3. function crearPuntoEntrega(tabla) local RADIO_ENTREGA = 1 local X = tabla[1].x local Y = tabla[1].y local Z = tabla[1].z local zonaEntrega = createMarker(X, Y, Z, 'checkpoint', RADIO_ENTREGA, 255, 0, 0, 255, player) local zonaEntregaIcono = createBlip(X, Y, 0, player) addEventHandler('onMarkerHit', zonaEntrega, function() destroyElement(zonaEntrega) destroyElement(zonaEntregaIcono) table.remove(tabla, 1) local next = next if next(tabla) == nil then recargarPizzas() else crearPuntoEntrega(tabla) end end) end As you can see, "crearPuntoEntrega" gets a table with coordinates, then it creates checkpoints according to those coordinates. If the table is empty, the script triggers "recargarPizzas". I don't know if this is correct, I've done some improvisation using my previous knowledge about languages. Of course, here you go: function crearPuntoEntrega(tabla) local RADIO_ENTREGA = 1 local X = tabla[1].x local Y = tabla[1].y local Z = tabla[1].z local zonaEntrega = createMarker(X, Y, Z, 'checkpoint', RADIO_ENTREGA, 255, 0, 0, 255, player) local zonaEntregaIcono = createBlip(X, Y, 0, player) addEventHandler('onMarkerHit', zonaEntrega, function() destroyElement(zonaEntrega) destroyElement(zonaEntregaIcono) table.remove(tabla, 1) local next = next if next(tabla) == nil then recargarPizzas() else crearPuntoEntrega(tabla) end end) end And here you have an example: After hitting that marker, it triggers "crearPuntoEntrega()" that it has the event "onMarkerHit".
  4. Peti

    Help Jobs bugged

    Are you exports defined correctly? <export function="functionName" type="theType"/> BTW, try this: function firstscript (player) if not getElementData(player, "Clan") then if getElementData(player, "Job") == "CIA" then exports.Messages:sendClientMessage( "You Have to be part in gang for take it ",player, 255, 0, 0) return end end end OR function firstscript (player) if getElementData(player, "Clan") ~= "None" then if getElementData(player, "Job") == "CIA" then exports.Messages:sendClientMessage( "You Have to be part in gang for take it ",player, 255, 0, 0) return end end end I don't really understand what are you trying to do, so I don't guaranteed that my suggestion will work
  5. You need to define the player. https://wiki.multitheftauto.com/wiki/GetPlayerMoney I think that this: local money = getPlayerMoney(theplayer) is returning "false".
  6. Hi, I'm learning how to script and I've this problem: When this code is running, it triggers "cargarRecorrido()" 4 times function recargarPizzas() local X = 201.400390625 local Y = -178.943359375 local Z = 1.174932718277 local RADIO_RECARGA = 2 local zonaRecarga = createMarker(X, Y, Z, 'checkpoint', RADIO_RECARGA, 255, 0, 0, 255, player) local zonaRecargaIcono = createBlip(X, Y, 0, player) addEventHandler('onMarkerHit', zonaRecarga, function() destroyElement(zonaRecarga) destroyElement(zonaRecargaIcono) cargarRecorrido() end) cargarRecorrido(): local seleccionarSitio = 'SELECT * FROM coords_pizzero ORDER BY random() LIMIT 1' -- CAMBIAR function cargarRecorrido() local tablaRecorrido = { } dbQuery(function(queryHandle) local resultados = dbPoll(queryHandle, 0) for indice, puntoEntrega in pairs(resultados) do table.insert(tablaRecorrido, resultados[indice]) crearPuntoEntrega(tablaRecorrido) end end, db, seleccionarSitio) end I don't know why, but when I try to destroy markers, 'onMarkerHit' triggers a lot of times (at least 2). Why is this happening? Thank you in advance.
×
×
  • Create New...