Jump to content

chris1384

Members
  • Posts

    22
  • Joined

  • Last visited

About chris1384

  • Birthday 05/11/2001

Details

  • Location
    România, Focșani

Recent Profile Visitors

886 profile views

chris1384's Achievements

Civilian

Civilian (7/54)

4

Reputation

  1. Oh, now I realised that i didn't wrote the title correctly my bad. Anyway, I want the dxDrawLine3D to be visible through objects, for example: Point A at Caligulas Casino and point B at Grove Street, without dissapearing.
  2. The question is in the title, is it possible? And how?
  3. Learned a lot from your code, I didn't know how to deal with the "onClientRender" and "onClientColshapeHit" events, so I though tables were a good idea for solving this . Thanks!
  4. Hi there! I was working on a custom grenade and got stuck into this issue: addEventHandler("onClientProjectileCreation", root, function(creator) if getProjectileType(source) == 17 then setTimer(markerfunc, 2000, 1, source) end end) ms = 0 mst = 0.5 function markerfunc(elem) local x,y,z = getElementPosition(elem) setElementPosition(elem, 0,0,0) m = createMarker(x,y,z,"cylinder",1,0,255,0,255) col = createColSphere(x,y,z,mst*12) addEventHandler("onClientRender", root, markersize) addEventHandler("onClientColShapeHit", col, colhit) setTimer(function() removeEventHandler("onClientColShapeHit", col, colhit) removeEventHandler("onClientRender", root, markersize) destroyElement(m) destroyElement(col) ms = 0 end, 500, 1) end function markersize() ms = ms + mst setMarkerSize(m, ms) local mx,my,mz = getElementPosition(m) setElementPosition(m, mx, my, mz-mst/1.3) end function colhit(thePlayer, matchingDimension) if getElementType ( thePlayer ) == "player" then outputChatBox(tostring(getPlayerName(thePlayer))) end end - "So.. What's the problem?" you may ask. Well, the problem is when 2 players throw a teargas simultaneously, one of the markers does not dissapear, and a debug error appears that something's wrong with the lines 18 - 21. Maybe a table is needed..? Someone?
  5. Getting a vehicle health when using setCameraTarget on a different player I meant, not from localPlayer. Nevermind, solved
  6. Hi there! I'm working at the race resource and I was wondering if I can get the spectator target's health and nitro and other elements data (like.. I'm spectating a player and I want to know how much nitro he has left). Is it possible? And how?
  7. Sorry for the late response, but before making this topic I edited something in the LUA code and I didn't noticed it was wrong edited. However, this is the part that really kills me and I still didn't figured out how to fix it: if getElementData(source, "zp_Class") == "Zombie" and #table_allZombiesAlive == 1 then outputChatBox("true", root) end When the player is infected by a zombie, (using onPlayerDamage) I use again updateTeamTables() to update the tables, but as it mentioned before, it doesn't update correctly so after the zombie is killed nothing happens, but after the round start and the zombie choosed infects another player, triggers the outputChatBox function.s. Edit: Maybe the updateTeamTables() isn't necessary, but I don't know an alternative to that. Someone?
  8. Did it with a tester Before round start (or resource start): 0 humans alive , 0 zombies alive After round start (choosing random zombie): 2 humans alive, 0 zombies alive After zombie killed (onPlayerWasted): 1 human alive, 1 zombie alive
  9. Hi there. Recently I have this issue with this part of the code, I'm trying to trigger something with onPlayerWasted, but it looks like the updateTeamTables() is not updated as it should be. To be more explicit, if there's only one zombie in the team, it should trigger the outputChatBox function, but that doesn't happen. Can someone help? Thanks. function updateTeamTables() table_allHumans = {} table_allHumansAlive = {} table_allZombies = {} table_allZombiesAlive = {} for k,v in ipairs(getElementsByType("player")) do if isPlayerInTeam(v, team_Humans) then table.insert(table_allHumans, v) if getElementData(v, "State") == "Alive" then table.insert(table_allHumansAlive, v) end elseif isPlayerInTeam(v, team_Zombies) then table.insert(table_allZombies, v) if getElementData(v, "State") == "Alive" then table.insert(table_allZombiesAlive, v) end end end end addEventHandler("onPlayerWasted", root, function(ammo, attacker, weapon, bodypart) updateTeamTables() for k,v in ipairs(getElementsByType("player")) do if getElementData(v, "zp_Class") == "Spectator" then setspectator(v) end end if getElementData(source, "zp_Class") == "Zombie" then if attacker ~= nil and isElement(attacker) then setspectator(source) local scr = getElementData(attacker, "Score") setElementData(attacker, "Score", tonumber(getElementData(attacker, "Score")+2)) end end local dths = getElementData(source, "Deaths") setElementData(source, "Deaths", tonumber(dths + 1)) setElementData(source, "State", "Dead") setElementData(source, "zp_Class", "None (Dead)") local allHumans = getPlayersInTeam(team_Humans) local allZombies = getPlayersInTeam(team_Zombies) elseif getElementData(source, "zp_Class") == "Zombie" and #table_allZombiesAlive == 1 then outputChatBox("true", root) end end)
  10. Oh I didn't know about this function .Thank you!
  11. Is there a way to check if the player has the chatbox opened? I'm using onClientKey for choosing things and I want to cancel it if the player pressed 'T' for chatbox.
  12. Hi there! Recently I have this problem with knockbacking the victim and instantaneosly stop the victim from walking/running. 1. I tried using spawnPlayer with current coordinates and position, but for a second it can be seen that once spawned it turns smoothly from 0 to 90 degrees. I wonder if there's an alternative for this: function cancelrun ( attacker, weapon, bodypart, loss ) if attacker ~= nil then if isPedOnGround(source) then local x,y,z = getElementPosition(source) local r = getElementRotation(source) local skin = getElementModel(source) local h = getElementHealth(source) spawnPlayer(source, x,y,z,r) setElementModel(source, skin) setElementHealth(source, h) end end end addEventHandler ( "onPlayerDamage", getRootElement(), cancelrun ) 2. With 'knockback' I mean if the victim is getting damage I want him to be pushed back. An example might be very helpful. Thanks!
×
×
  • Create New...