Jump to content

Bean666

Members
  • Posts

    732
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Bean666

  1. addEventHandler ( "onPlayerWasted", root, function ( ) playerSkin = tonumber(getElementModel(source)) if ( not playerWeapons [ source ] ) then playerWeapons [ source ] = { } end for slot = 0, 12 do local weapon = getPedWeapon ( source, slot ) if ( weapon > 0 ) then local ammo = getPedTotalAmmo ( source, slot ) if ( ammo > 0 ) then if (weapon == 37) then ammo = ammo/10 end playerWeapons [ source ] [ weapon ] = ammo end end end end ) addEventHandler ( "onPlayerSpawn", root, function ( ) if ( playerWeapons [ source ] ) then if getElementData(source, "selecting") == nil then setElementModel(source, playerSkin) for weapon, ammo in pairs ( playerWeapons [ source ] ) do giveWeapon ( source, tonumber ( weapon ), tonumber ( ammo ) ) end end end playerWeapons [ source ] = nil end ) This code has save weapons, including skin on death, then load on spawn, they work perfectly, but there's one issue, when both players like die together, when they spawn, they dont get the correct skin, one player gets the skin of the other player, and it's weird, how do I fix it? is the getElementModel(source) triggering when another player dies when the other player just died? thats why he's getting the skin of the player that died after him? if so how do I fix it, the code looks fine though.
  2. Bean666

    [HELP] F11 Map

    use createRadarArea and use /getpos to get your coordinates and place them in the float x and y , then the size u adjust yourself note: getpos is only available (if play resource is started) or you could just download from the community.
  3. why is my health stat not saving, this is the only thing that's not saving on my savesystem, health, datas, etc work, but this don't. onLogin - local purifierHealth = getAccountData( theCurrentAccount, "purifierhealth") setTimer (setPedStat, 500, 1, source, purifierHealth) onQuit - setAccountData(account, "purifierhealth", getPedStat(source, 24)) I even tried putting tonumber on the getPedStat(source, 24) but it still didnt work
  4. Hello, how do I define a position in the table , regarding the marker, whatever marker i go i always get to be on the last x,y,z on the table, how do I fix this. Markers = { [1] = { 2104.484375, 900.0869140625, 10.8203125 }, [2] = { 2103.78125, 898.1884765625, 20.021923065186 } } destination = { [1] = { 2109.7099609375, 898.2939453125, 20.085845947266, 184.77 }, [2] = { 2102.515625, 901.998046875, 10.8203125, 13.2 } } function onstart() for i, m in ipairs(Markers) do themarker = createMarker ( m[1], m[2], m[3]-1, "cylinder", 2, 25, 205, 100, 150 ) end end addEventHandler("onClientResourceStart", getRootElement(), onstart) addEventHandler ( "onClientMarkerHit", resourceRoot, function(hitPlayer) if ( hitPlayer == localPlayer ) and getElementType(hitPlayer) == "player" then for _, l in ipairs ( destination ) do setElementPosition ( hitPlayer, l[1], l[2], l[3]) end end end)
  5. sadly I didn't see any huds in the texture names on shaders, and I meant for the server as well, not only my blips so txd workshop and replacing my own hud textures wont do great, anyway , closed. thanks everyone
  6. missed somethings serverside, forgot to add the check on some parts, thats why they were acting crazy, but thankyou you helped me once again
  7. function chase_move(ped, oldTx, oldTy, oldTz, oldPx, oldPy, oldPz) if isElement(ped) then local thetarget = getElementData(ped, "target") if (getElementData(ped, "status") == "chasing") and (isElement(thetarget)) and (getElementData(ped, "slothbot") == true) then local pedhp = getElementHealth(ped) local tarhp = getElementHealth(thetarget) if pedhp > 0 and tarhp > 0 then local tx, ty, tz = getElementPosition(thetarget) local px, py, pz = getElementPosition(ped) local isclear = isLineOfSightClear(px, py, pz + .6, tx, ty, tz + .6, true, false, false, true, false, false, false) local angle = (360 - math.deg(math.atan2((tx - px), (ty - py)))) % 360 --set the peds angle to the target setPedRotation(ped, angle) if (isclear == true) then -- if the ped can see the target local angle = (360 - math.deg(math.atan2((tx - px), (ty - py)))) % 360 --set the peds angle to the target setPedRotation(ped, angle) setElementData(ped, "seestarget", true) setTimer(chase_move, 700, 1, ped, tx, ty, tz, px, py, pz) if oldTx and oldTy and oldTz and oldPx and oldPy and oldPz then local angle = (360 - math.deg(math.atan2((oldTx - px), (oldTy - py)))) % 360 --set the peds angle to the target setPedRotation(ped, angle) setElementData(ped, "seestarget", false) setTimer(chase_move, 700, 1, ped, oldTx, oldTy, oldTz, px, py, pz) end end end end end end just did this, its fine at the start, no errors, but hell after a few seconds it gives massive lag. they also go crazy EDIT: oops my bad i removed the else, but no lags now, but they go crazy after a player dies, if htey just spawned they're fine, but when player dies and comes back, they dont shoot anymore,
  8. it gave no more errors, but they don't move anymore. anyway the error of those boolean numbers only happens when close with the bots but it spams
  9. this fixed the error but now idk why i'm getting these when they start chasing me i've never modified anything just those u sent me, and i did it well, no bugs, but now those error shows up, there seems to be nothing wrong as well The clientside that has error on line 97 function chase_move(ped, oldTx, oldTy, oldTz, oldPx, oldPy, oldPz) if (isElement(ped)) then local thetarget = getElementData(ped, "target") if (getElementData(ped, "status") == "chasing") and (isElement(thetarget)) and (getElementData(ped, "slothbot") == true) then local pedhp = getElementHealth(ped) local tarhp = getElementHealth(thetarget) if pedhp > 0 and tarhp > 0 then local tx, ty, tz = getElementPosition(thetarget) local px, py, pz = getElementPosition(ped) local isclear = isLineOfSightClear(px, py, pz + .6, tx, ty, tz + .6, true, false, false, true, false, false, false) local angle = (360 - math.deg(math.atan2((tx - px), (ty - py)))) % 360 --set the peds angle to the target setPedRotation(ped, angle) if (isclear == true) then -- if the ped can see the target local angle = (360 - math.deg(math.atan2((tx - px), (ty - py)))) % 360 --set the peds angle to the target setPedRotation(ped, angle) setElementData(ped, "seestarget", true) setTimer(chase_move, 700, 1, ped, tx, ty, tz, px, py, pz) else --THIS IS LINE 97 local angle = (360 - math.deg(math.atan2((oldTx - px), (oldTy - py)))) % 360 --set the peds angle to the target setPedRotation(ped, angle) setElementData(ped, "seestarget", false) setTimer(chase_move, 700, 1, ped, oldTx, oldTy, oldTz, px, py, pz) end end end end end also in server this is line 251 and 252, there really seems to be nothing wrong: function chase_move(ped, oldTx, oldTy, oldTz, oldPx, oldPy, oldPz) -- function name that has the oldTx variable, i cant post the full chase move function ,its too long, but if u insist i can send it local pdistance = (getDistanceBetweenPoints3D(oldPx, oldPy, oldPz, px, py, pz)) -- line 251 if (pdistance < 1.2) then -- line 252
  10. i'm always getting a debug output "expected element at argument 1, got boolean", whenever a bot spawns with "chasing" mode, although there's not any problems with it but it's kinda irritating everytime a botspawns it gives an output warning, is there anyway to remove this warning? , its the getElementPosition(player) line, this is from slothbot function changestatus(dataName) if getElementType(source) == "ped" and dataName == "status" and (getElementData(source, "slothbot") == true) then if (getElementData(source, "status") == "chasing") then local player = getElementData(source, "target") local oldTx, oldTy, oldTz = getElementPosition(player) local oldPx, oldPy, oldPz = getElementPosition(source) setTimer(chase_aim, 80, 1, source) setTimer(chase_move, 700, 1, source, oldTx, oldTy, oldTz, oldPx, oldPy, oldPz) setTimer(chase_shoot, 1500, 1, source) elseif (getElementData(source, "status") == "hunting") then local oldPx, oldPy, oldPz = getElementPosition(source) setTimer(enemy_check, 600, 1, source) -- starts scanning for enemies setTimer(hunt_move, 800, 1, source, oldPx, oldPy, oldPz, oldPx, oldPy, oldPz) elseif (getElementData(source, "status") == "following") then local player = getElementData(source, "leader") local oldTx, oldTy, oldTz = getElementPosition(player) local oldPx, oldPy, oldPz = getElementPosition(source) setTimer(follow_enemy_check, 500, 1, source) setTimer(follow_move, 800, 1, source, oldPx, oldPy, oldPz, oldPx, oldPy, oldPz) elseif (getElementData(source, "status") == "waiting") then setTimer(wait_enemy_check, 500, 1, source) elseif (getElementData(source, "status") == "guarding") then setTimer(guard_enemy_check, 800, 1, source) -- starts scanning for enemies setTimer(guard_move, 400, 1, source) end end end addEventHandler("onClientElementDataChange", getRootElement(), changestatus)
  11. okay but what is the name of the blips on the textures? where do i see the list that has the textures list or something help would be appreciated, thanks.
  12. Hello is there anyway to change the blip texture / look without using the customblips resource by talidan? I dont want to create new customblips, I just want to change the texture of the current / vanilla ones, does anyone know how to? if there's no other way i guess i'll just use his resource, but I just want to know if there's a way
  13. the event "showheli" is still being triggered despite someone in the blueteam is in the colshape and the outputChatBox doesnt output as well.
  14. this is a different topic but I wonder if you could help me with these. Basically I want the "showheli" event triggered if there's no Blue Team player present in the colshape and "showheli" will not be triggered if there's a blueteam player present in the colshape, but on the first code the showheli event doesnt trigger even tho theres no people with blue team on the colshape, on the second code, even if a player in blue team is in colshape it triggers, so how do I make it work? I've been struggling with this "getElementsWithinColShape" thing. function stage100() setTimer(stage110, 10000, 1) for i, c in ipairs(alliedteams) do for k, v in ipairs(getPlayersInTeam(getTeamFromName((c)[1]))) do if isElementWithinColShape(v, rc) then local theVehicle = getPedOccupiedVehicle ( v ) if theVehicle then outputChatBox("#54F764[Rescue-Mission]: #FF0000Warning! You are in a vehicle, get off your vehicle to earn progress!", v, 255, 0, 0, true) else triggerClientEvent("draw100", v) end end end end for i, r in ipairs(getPlayersInTeam(getTeamFromName("Blue Team"))) do if isElementWithinColShape(r, rc) then outputChatBox("Can't trigger event, blue team is in colshape", root) return end local players = getElementsWithinColShape(rc, "player") if #players >= 1 then triggerClientEvent("showheli", root, hiddenmarker) helicopter = true; end end end second: function stage100() setTimer(stage110, 10000, 1) for i, c in ipairs(alliedteams) do for k, v in ipairs(getPlayersInTeam(getTeamFromName((c)[1]))) do if isElementWithinColShape(v, rc) then local theVehicle = getPedOccupiedVehicle ( v ) if theVehicle then outputChatBox("#54F764[Rescue-Mission]: #FF0000Warning! You are in a vehicle, get off your vehicle to earn progress!", v, 255, 0, 0, true) else triggerClientEvent("draw100", v) end end end end local players = getElementsWithinColShape(rc, "player") if ( players and getTeamName ( players ) == "Blue Team" ) then outputChatBox("Can't trigger event, blue team is in colshape", root) return end if #players >= 1 then triggerClientEvent("showheli", root, hiddenmarker) helicopter = true; end end
  15. Is there anyway i can check time rather than making an unlimited timer? which I think would case a lil bit of a lag?( i think ) nighttime = false; function change() local timehour, timeminute = getTime() if timehour == 21 or timehour == 22 or timehour == 23 or timehour == 0 or timehour == 1 or timehour == 2 or timehour == 3 or timehour == 4 then if nighttime == true then return end nighttime = true; chaseanim = "sprint_panic" outputChatBox("Night", root, 255, 0, 0) else if nighttime == false then return end chaseanim = "run_1armed" nighttime = false; outputChatBox("Day", root, 0, 255, 0) end end setTimer(change, 1000, 0)
  16. i tried aim_weapon and jump together as they are right click and shift, but it didn't work as well. i could still block the punches damage, i guess i can do nothing, but good idea for disabling the jump control if i disable jump control serverside when entering colshape serverside(hitElement), will it disable it for other players not in the colshape as well? cuz if that happens i'll just do triggerClientEvent and toggle the jump to false from client. @Addlibs
  17. does aim_weapon control state affect the player blocking punches? the rightclick + shift as I can see its not. how do i disable this? since i'm having a bot system that punches 1 hit, but when doing the blocking animation the punches dont deal damage.
  18. so basically like this? local lowspawn = {}; local lowspawnrates = { locations } function lowspawnzones() for i, z in ipairs(lowspawnrates) do lowspawn[#lowspawn + 1] = createColRectangle(z[1], z[2], z[3], z[4]); end end addEventHandler("onResourceStart", resourceRoot, lowspawnzones) EDIT: it worked, thank you verymuch, understand what u mean now, got it, thanks again!
  19. Alright thank you so much again tekken, so you gave all the locations inside the table a variable(?)? or what do you call that, then you did a loop on the onColShapeHit starting from the first line of the table until all the numbers inside the table, so that all locations inside the table are recognized? EDIT: im getting an error for i,z in ipairs(lowspawn) do lowspawn[#lowspawn + 1] = createColRectangle(z[1], z[2], z[3], z[4]); end attempt to index local z(a user data value)
  20. hi, i created colshapes via table, but there's a problem with the onColShapeHit that i dont know how to fix. the onColShapeHit functions dont work whenever i hit it. but when i leave one colshape on the table it works, how do i trigger it for all the colshapes inside the table? local lowspawnrates = { { 1690.6787109375, 182.8291015625, 100, 100 }, { 1379.966796875, -127.736328125, 100, 100}, {1026.0546875, 15.234375, 400, 150} } function lowspawnzones() for i, z in ipairs(lowspawnrates) do lowspawn = createColRectangle ( z[1], z[2], z[3], z[4]) lowspawnradar = createRadarArea ( z[1], z[2], z[3], z[4], 200, 150, 0, 200) end end addEventHandler("onResourceStart", resourceRoot, lowspawnzones) addEventHandler ( "onColShapeHit", resourceRoot, function ( hitElement ) if source == lowspawn then if getElementType( hitElement ) == "player" then setElementData(hitElement, "threat", "low") end end end )
  21. that's what I thought but I was too lazy for it, I just asked here to see if would be an easier way, anyway thanks!
  22. how do you add a zombie spawnpoint in the map editor?
  23. Hello how do I make weapons that has different ammos? since some players can exploit weapon shop, EX: player buys a lot cheaper uzis then buys just 1 round of mp5, all uzi bullets get replaced with mp5 rounds, how do I prevent that from happening? What functions do I need to use? thanks!, edit: nvm it still does, how to fix this? especially with the SMGs
×
×
  • Create New...