• Content count

  • Joined

  • Last visited

  • Days Won


pa3ck last won the day on July 10

pa3ck had the most liked content!

Community Reputation

198 Celebrity

About pa3ck

  • Rank
  • Birthday 01/01/17


  • Occupation
    Software Developer

Recent Profile Visitors

2,017 profile views
  1. Script not working

    setPedArmor is server side only, you can't use it client side.
  2. Ask ID

    local targetPlayer, tinta =, targerPlayer) ---> local targetPlayer, tinta =, targetPlayer) targerPlayer --> targetPlayer, just a small typo in your code.
  3. Team Base

    Well, it depends how you want it to work. If you only want it to open then close after X amount of time, throw in two moveObjects, but you also have to think about the marker, what should happen if the gate is moving and somebody else (or the same guy) enters the marker again. You can put a "state" variable as the 4th argument of the table and when it opens/closes update it's state.
  4. Team Base

    Because you keep overwriting the variables, if you have 5 gates, which gate do you think will open? Always the last one, since every time you go into the loop, a new value is assigned. for k, v in ipairs(TeamTable) do counter = counter + 1 TableTeamName = TeamTable[k][1] -- theGate and teamMarker are the variables being overwritten theGate = createObject(988, TeamTable[k][2], TeamTable[k][3], TeamTable[k][4], TeamTable[k][8], TeamTable[k][9], TeamTable[k][10]) teamMarker = createMarker(TeamTable[k][2], TeamTable[k][3], TeamTable[k][4] - 2, "cylinder", 5, 255, 0, 0, 150) end Since you have multiple markers and gates, you should store them in a table. local availableGates = {} for k, v in ipairs(TeamTable) do counter = counter + 1 local team = TeamTable[k][1] local theGate = createObject(988, TeamTable[k][2], TeamTable[k][3], TeamTable[k][4], TeamTable[k][8], TeamTable[k][9], TeamTable[k][10]) local teamMarker = createMarker(TeamTable[k][2], TeamTable[k][3], TeamTable[k][4] - 2, "cylinder", 5, 255, 0, 0, 150) table.insert(availableGates, {theGate, teamMarker, team}) end function getTeamGateMarker( markerElement ) for k, v in ipairs(availableGates) do if(v[2] == markerElement) then return v end end return false end addEventHandler("onMarkerHit", resourceRoot, function(player) local gate = getTeamGateMarker(source) if (gate and getElementType(player) == "player") then local playerTeam = getPlayerTeam(player) if playerTeam then outputChatBox("team") local teamName = getTeamName(playerTeam) if teamName == gate[3] then outputChatBox("yee") else outputChatBox("You are not in this team") end else outputChatBox("not in team") end end end) Try something like that, keep in mind I haven't touched MTA or LUA in ages..
  5. BTW: When you use getElementsByType on client side, there's an optional argument, "streamedIn", if you set this to true, only the streamed in vehicles will be returned.
  6. Binds

    You don't need to write your own function. You can use guiSetInputMode, it doesn't have to be a GUI if you use "no_binds" instead of "no_binds_when_editing". guiSetInputMode("no_binds") guiSetInputEnabled(true)
  7. ElementData

    Zombies aren't just appearing randomly, some part of the code is spawning them.. go there, add an if statement to check whether a boss is spawned and that's it. There's more than likely a timer or something already there that keeps the code running over and over again, so a simple if statement should be enough.
  8. Is not played playSound3D inside the player

    That is because you're getting the X, Y, Z position of localPlayer, which is basically every single player. You would want to trigger the event like: triggerClientEvent ( playerSource, "onSay1", root) -- server local x, y, z = getElementPosition(source) -- client OR local x, y, z = getElementPosition(playerSource) -- server triggerClientEvent ( root, "onSay1", root, x, y, z) -- server, use X, Y, Z on client side But I think it would be more efficient if you didn't use triggerClientEvent this way. What you could do is, create a colSphere, get the list of players inside it and use triggerClientEvent for those players only.
  9. Strings as variables?

    If you're using the default MTA siren system, there are no siren objects that you need to reference in order to remove them from a vehicle. You just do: removeVehicleSirens(source) If you have your own objects that you attach, you can use the same concept idarrr suggested: local sirens = {} addCommandHandler("addsirens", function(p) local veh = getPedOccupiedVehicle(p) local obj1 = createObject(..) local obj2 = createObject(..) attachElements(obj1, veh) attachElements(obj2, veh) sirens[veh] = { obj1, obj2 } end) addCommandHandler("removesirens", function(p) local veh = getPedOccupiedVehicle(p) if sirens[veh] then for k, obj in ipairs(sirens[veh]) do destroyElement(obj) end sirens[veh] = null end end)
  10. Screenshot problem

    That's right, it only goes as far as fase 1, the reason is, triggerServerEvent requires an element (player or root). Try this: triggerServerEvent('fotofalla', localPlayer, x, y) BTW: variable "secondi" is already the timestamp, you don't really need to get the getRealTime().timestamp, since it's already there.
  11. table.concat with a boolean value inside a table

    I don't think it will be as simple as using table.concat.. You'd probably need to implement your own way of string, boolean and number concatenation eg. looping thru the data. local tablaPrueba = { {"object1","valor1","valor1","valor1"}, {"object2","valor2","valor2","valor2"}, {"object3","valor3","valor3","valor3"}, {"object4","valor4","valor4","valor4"}, {"object5","valor5","valor5","valor5"}, {"object6","valor6","valor6","valor6"}, {"object7","valor7","valor7",true}, } local myStr for k, v in ipairs(tablaPrueba) do local myStr = "{" for x, y in ipairs(v) do if type(y) == "string" then myStr = myStr .. '"'..y..'", ' elseif type(y) == "number" then myStr = myStr .. y..', ' elseif type(y) == "boolean" then myStr = myStr .. tostring(y) .. ", " end end myStr = myStr:sub(1, -3) .. "}," outputChatBox(myStr) end But using toJSON and fromJSON would be your best option.
  12. I never actually used this function, always wondered how it worked, maybe it's something you can use?
  13. How to make the progress for interpolateBetween

    I would use the easing type SineCurve, this way probably: | ---------------- | ----------------- | your line 0,,,,,,,,,,,,,,,,,,150px,,,,,,,,,,,,,,,,,,300px the arrow pointer 0,,,,,,,,,,,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,0 color progress Red - > Green -> Red Red < - Green < - Red In theory if you start the interpolation from Red to Green (with half the duration of the interpolation of the arrow pointer) with SineCurve, it should automatically start reversing back to 0 (Red) from 1 (Green). Then it should start over. Also, the little arrow pointer should have an interpolation for itself, you can get the progress by using the variable you set up as the progress parameter and when you click, you'd check if the progress is between 0.4 and 0.6, confirming that the pointer is in the green zone. So let's say if the arrow pointer takes 5 seconds to reach the end, you'd have the color interpolation set to 2.5 half second with SineCurve going from 255, 0, 0 (red) to 0, 255, 0 (green) and it should reverse from 0, 255, 0 (green) to 255, 0, 0 (red) by itself. You can use the same SineCurve for the arrow, from 0px to 300px (or w/e size you bar is) then it should reverse from 300px to 0px by itself.
  14. destroyElement..

    You're welcome.
  15. destroyElement..

    You're using the events onResourceStart and onResourceStop with "source" --> source is never going to be a player, it will always be the resource. What you should do is, when a resource starts, use a for loop to loop through every player.