Jump to content

novo

Members
  • Content Count

    325
  • Joined

  • Last visited

Community Reputation

0 Neutral

About novo

  • Rank
    Prankster
  • Birthday 02/05/1998

Details

  • Location
    United States

Recent Profile Visitors

776 profile views
  1. local players = getElementsByType('player') table.sort( players, function(a, b) return getPlayerMoney(a) > getPlayerMoney(b) end )
  2. novo

    getCursorMoveOn

    First error is caused by the function getCursorMoveOn, as it does not return any value in case isCursorShowing() returns false at line 2. Second error is because outputChatBox only accepts a player as second argument server-side (visibleTo), whilst client does not and thus expects a number (r).
  3. You get that error because number is an undefined variable, and thus equals to nil. Now, you can do table.test with alphabetical keys only - you have to do table[123] for numbers. local table = { test = 'a', ['something'] = 'b', [1] = 'c', ['test2'] = 'd', } print(table.test) -- a print(table.something) -- b print(table[1]) -- c print(table['test2']) -- d ---------------------------- local players = {} local player = getRandomPlayer() players[player] = { name = getPlayerName(player), } print(players[player].name)
  4. Only predefined variables are these, and thus what you are trying to achieve is not possible.
  5. It indeed does not check if given projectile has a target, but still does work with static elements. Now, you might instead do a per-frame check and find out whether an element interferes with the projectile, or through loop as in your code. I would do some sort of sight check around the projectile and check if there is any nearby approaching element that might end up colliding given its velocity within a certain distance. Also, I had a few issues calculating what the final position is going to be and dividing by 10 worked just fine there for testing, though you might want to replace this wit
  6. local vx, vy, vz = getElementVelocity(veh) setElementVelocity( veh, -vx, -vy, vz )
  7. function collision (projectile) local time = projectile.counter / 10 local velocity = projectile.velocity velocity = velocity * time -- local position = projectile.position + velocity local sight, x, y, z = processLineOfSight( projectile.position, position, true, true, true, true, true, true, true, false, nil, true ) position = (sight and Vector3(x, y, z)) or position -- Marker( position, 'corona', 3 )
  8. toptimes = { {32423,"nickname"}, {12313,"nickname"}, }; table.sort(toptimes, function(a, b) return a[1] < b[1] end ) table.sort basically needs minimum two values inside the input table, toptimes in this case, and then does compare these values and thus determines their order. We have got two sub-tables inside toptimes, and those tables are the ones being compared through table.sort. This is why [1] is used, we retrieve those table's index 1 value and then check which one is smaller/bigger. However, here is a similar thing I found you may have a look at.
  9. novo

    Anti teamkill

    addEventHandler("onClientVehicleDamage", root, function(attacker) if getElementModel(source) ~= 432 then return end -- avoid this function from executing in case the vehicle that is being damaged is not a tank(?) if getElementModel(getPedOccupiedVehicle(attacker)) == 432 then -- in case attacker's model is equal to 432 if attacker == localPlayer then -- in case the attacker tank's driver is the localPlayer outputChatBox("Don't attack friendly tanks!", 255, 0, 0) -- a warning message is output end cancelEvent()
  10. I do not know, you probably ran those resources before. Err.. either way I did not check it out for a long while, they probably implemented it - quite a big security hole though.
  11. That is what I meant, you can not manipulate files outside a resource itself.
  12. Are those files even being written/created? I am not sure it is possible to actually write into a different resource location from where you are running the functions.
  13. novo

    Anti teamkill

    It is not working because you are using onClientVehicleDamage's arguments in a wrong way. Either way, you are using attacter at isPedInVehicle - a non-defined variable. addEventHandler("onClientVehicleDamage", root, function(attacker) if getElementModel(source) ~= 432 then return end -- avoid this function from executing in case the vehicle that is being damaged is not a tank(?) if getElementModel(attacker) == 432 then -- in case attacker's model is equal to 432 if getVehicleController(attacker) == localPlayer then -- in case the attacker tank's driver
  14. Well, you can this way avoid loaded scripts from executing your actual wrappered functions. Which means that if you have set a wrapper to _triggerServerEvent and not using an environment, it can be called from inside the loaded script. And you are avoiding this by using an own environment.
×
×
  • Create New...