Jump to content

kewizzle

Members
  • Posts

    164
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by kewizzle

  1. it works now except when a zombie is killed within the col shape it resets the timer and speeds it up lol im getting there also maybe has something with the Leave function so ima mess with it HAHAHAHAHA idk if you remember the drop system i made lmaooo i had to fix the supply run to include those if (getElementType(source) == "ped") or (getElementType(source) == "pickup") or (getElementType(source) == "marker") then return end i could probably do instead if not (getElementType(source) == "player") then return end
  2. sooo i wrote this script tonight all works well until i add zombies they keep triggering the functions and causing the timer to not work as intendded. function dxDrawTextOnElement(TheElement,text,height,distance,R,G,B,alpha,size,font,...) local x, y, z = getElementPosition(TheElement) local x2, y2, z2 = getCameraMatrix() local distance = distance or 20 local height = height or 1 if (isLineOfSightClear(x, y, z+2, x2, y2, z2, ...)) then local sx, sy = getScreenFromWorldPosition(x, y, z+height) if(sx) and (sy) then local distanceBetweenPoints = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) if(distanceBetweenPoints < distance) then dxDrawText(text, sx+2, sy+2, sx, sy, tocolor(R or 255, G or 255, B or 255, alpha or 255), (size or 1)-(distanceBetweenPoints / distance), font or "arial", "center", "center") end end end end --Warehouse Zones createBlip(2577, 2822, 11, 22) WarehouseCol1 = createColRectangle( 2535, 2796, 80, 50 ) WarehouseArea1 = createRadarArea( 2535, 2796, 80, 50, 0, 0, 255, 90, root ) setElementData(WarehouseCol1, "warehoue", true) setElementData(WarehouseArea1, "warehoue", true) --Leaving the warehouse function warehouseLeave() if (getElementType(getRootElement()) == "ped") then return end --thought maybe this would work if isElementWithinColShape(localPlayer, WarehouseCol1) == true then timertxt = getElementData(localPlayer, "timer") Wtimer = dxDrawTextOnElement(localPlayer, "Defend Warehouse: "..timertxt, 1, 20, 255, 0, 255, 255, 5, "arial") elseif Wtimer == nil then return else destroyElement(Wtimer) end end addEventHandler("onClientRender", getRootElement(), warehouseLeave) addEventHandler("onClientElementColShapeLeave", getRootElement(), warehouseLeave) --warehouse timer function warehoueTimer() if (getElementType(getRootElement()) == "ped") then return end --thought maybe this would work timerW = getElementData(localPlayer, "timer") if isElementWithinColShape(localPlayer, WarehouseCol1) == true and getElementData(localPlayer, "timer") >= 1 then setElementData(localPlayer, "timer", timerW-1) elseif isElementWithinColShape(localPlayer, WarehouseCol1) == true and getElementData(localPlayer, "timer") == 0 then triggerServerEvent("doSupplyTruck", localPlayer) end end --Entering warehouse function warehoueEnter() if (getElementType(getRootElement()) == "ped") then return end --thought maybe this would work if isElementWithinColShape(localPlayer, WarehouseCol1) == true then setElementData(localPlayer, "timer", 60) :O = setTimer(warehoueTimer, 1000, 61) else killTimer(:O) end end addEventHandler("onClientElementColShapeLeave", getRootElement(), warehoueEnter) addEventHandler("onClientElementColShapeHit", getRootElement(), warehoueEnter) --switch from destroyed element source to player source function switchh() triggerServerEvent("switch2", localPlayer) end addEvent( "switch", true ) addEventHandler( "switch", localPlayer, switchh )
  3. i tried a few things but when i reach 1200 zombie kills it doesnt change my label text to Level: 7 onClientPedWasted only changes when i logout and back in also yes i do have it so it sets element data on server side. this is my client script. i also tried setting element data on client side too. didnt work. level = guiCreateLabel(1449, 313, 85, 17, "Level:", false) guiSetFont(level, "default-bold-small") guiLabelSetColor(level, 255, 255, 0) zombiekills = guiCreateLabel(1449, 340, 202, 17, "Zombie Kills:", false) guiSetFont(zombiekills, "default-bold-small") guiLabelSetColor(zombiekills, 255, 255, 0) function zlevelkills(zlk) zkills = tonumber(getElementData(localPlayer, "Zombie kills"))+1 if (getElementData(localPlayer, "level")) == 1 then zlk = "Zombie Kills: "..tostring(zkills).."/20" return zlk elseif (getElementData(localPlayer, "level")) == 2 then zlk = "Zombie Kills: "..tostring(zkills).."/50" return zlk elseif (getElementData(localPlayer, "level")) == 3 then zlk = "Zombie Kills: "..tostring(zkills).."/100" return zlk elseif (getElementData(localPlayer, "level")) == 4 then zlk = "Zombie Kills: "..tostring(zkills).."/200" return zlk elseif (getElementData(localPlayer, "level")) == 5 then zlk = "Zombie Kills: "..tostring(zkills).."/500" return zlk elseif (getElementData(localPlayer, "level")) == 6 then zlk = "Zombie Kills: "..tostring(zkills).."/1200" return zlk elseif (getElementData(localPlayer, "level")) == 7 then zlk = "Zombie Kills: "..tostring(zkills).."/1500" return zlk end end function updatekillslevels(killer) zkills = tonumber(getElementData(localPlayer, "Zombie kills"))+1 guiSetText(zombiekills, tostring(zlevelkills(zlk))) zlevel = getElementData(localPlayer, "level") guiSetText(level, "Level: " .. zlevel) end addEventHandler( "onClientPedWasted", getRootElement(), updatekillslevels) addEvent("updates1", true) addEventHandler("updates1", getRootElement(), updatekillslevels)
  4. HAHAHA aye everything is working i just rescripted it it was apart of the 2017 version. its looking good.
  5. nvm i got it to work using dxDrawTextOnElement
  6. okay so buddy check this out i tried to do the same with my 3DText but it doesnt work properly i want them to destroy with weapons but i had to put it on client side also i removed what i tried cuz it didnt work i tried to use a table and your dtimer example again client function pickupT() local x, y, z = getElementPosition ( localPlayer ) chicken = call(getResourceFromName("texts"), "dxDraw3DText", "Press 'L' to pickup!", x, y, z, 2, "default", 255, 0, 255 ) end addEvent( "pickuptxt", true ) addEventHandler( "pickuptxt", localPlayer, pickupT ) server addEventHandler("onMarkerHit", dropmarker, function(player) if isElement(player) and getElementType(player) == 'player' then triggerClientEvent("pickuptxt", player) setElementData(player,"pickup",dropped) end end)
  7. thank you buddy lol this script was made in 2017 with lots of help i lost my fixed one i appreciate you
  8. so i have my drop system i fixed it a while ago then i lost everything in a hard drive wipe and cant seem to fix again but it all works except when i kill multiple zombies and theres multiple drops it only picks up the last dropped item and not the one im standing on heres my script: outputServerLog ( "***Drop System Loaded ***" ) local state = {} local function bindState(player) bindKey(player, "l", "down", function(player) if isElement(getElementData(player,"pickup")) then usePickup(getElementData(player,"pickup"),player) removeElementData(player,"pickup") end end) end function getElementsWithinMarker(marker) if (not isElement(marker) or getElementType(marker) ~= "marker") then return false end local markerColShape = getElementColShape(marker) local elements = getElementsWithinColShape(markerColShape) return elements end addEventHandler("onResourceStart", resourceRoot, function() for _, player in pairs(getElementsByType ("player")) do bindState(player) end end) addEventHandler("onPlayerJoin", root, function() bindState(source) end) function createDeathPickup ( totalammo, killer, killerweapon, bodypart ) --when a player dies if ( killer ) then if ( getElementType ( killer ) == "player" ) then x, y, z = getElementPosition ( source ) --get the position of the person who died and define it as x, y and z dropped = createPickup ( x, y, z, 2, math.random(22, 34), 15000, math.random(1,3)) dropmarker = createMarker ( x, y, z-0.5, "cylinder", 1, math.random(1, 255), math.random(1, 255), math.random(1, 255), 255) addEventHandler("onPickupHit", dropped, HitPick) addEventHandler("onMarkerHit", dropmarker, function(player) if isElement(player) and getElementType(player) == 'player' then setElementData(player,"pickup",dropped) end end) setTimer(destroyElement, 15000, 1, dropped) setTimer(destroyElement, 15000, 1, dropmarker) end end end addEventHandler("onPedWasted", getRootElement(), createDeathPickup) function HitPick ( ) if isElement ( dropped ) then cancelEvent() end end i tried some things i think it may have something to do with my onMarkerHit Handler
  9. so when i deliver the ped to the marker it spawns two instead of one local avaibleSkins = { 0, 104 } local spawnPoints = { { -1221.7, 457.3, 7.2, 90.0 }, { -1388.8, 440.8, 7.2, 180.0 }, { -1676.1, 413.4, 7.2, 180.0 }, } function createMarkerAttachedTo(element, mType, size, r, g, b, a, visibleTo, xOffset, yOffset, zOffset) mType, size, r, g, b, a, visibleTo, xOffset, yOffset, zOffset = mType or "checkpoint", size or 4, r or 0, g or 0, b or 255, a or 255, visibleTo or getRootElement(), xOffset or 0, yOffset or 0, zOffset or 0 assert(isElement(element), "Bad argument @ 'createMarkerAttachedTo' [Expected element at argument 1, got " .. type(element) .. "]") assert(type(mType) == "string", "Bad argument @ 'createMarkerAttachedTo' [Expected string at argument 2, got " .. type(mType) .. "]") assert(type(size) == "number", "Bad argument @ 'createMarkerAttachedTo' [Expected number at argument 3, got " .. type(size) .. "]") assert(type(r) == "number", "Bad argument @ 'createMarkerAttachedTo' [Expected number at argument 4, got " .. type(r) .. "]") assert(type(g) == "number", "Bad argument @ 'createMarkerAttachedTo' [Expected number at argument 5, got " .. type(g) .. "]") assert(type(b) == "number", "Bad argument @ 'createMarkerAttachedTo' [Expected number at argument 6, got " .. type(b) .. "]") assert(type(a) == "number", "Bad argument @ 'createMarkerAttachedTo' [Expected number at argument 7, got " .. type(a) .. "]") assert(isElement(visibleTo), "Bad argument @ 'createMarkerAttachedTo' [Expected element at argument 8, got " .. type(visibleTo) .. "]") assert(type(xOffset) == "number", "Bad argument @ 'createMarkerAttachedTo' [Expected number at argument 9, got " .. type(xOffset) .. "]") assert(type(yOffset) == "number", "Bad argument @ 'createMarkerAttachedTo' [Expected number at argument 10, got " .. type(yOffset) .. "]") assert(type(zOffset) == "number", "Bad argument @ 'createMarkerAttachedTo' [Expected number at argument 11, got " .. type(zOffset) .. "]") local m = createMarker(0, 0, 0, mType, size, r, g, b, a, visibleTo) if m then if attachElements(m, element) then return m end end return false end function killedPed() outputChatBox("The Survivor Was Killed! New One Spawning!", server, 255, 0, 0) destroyElement(survivorMarker) destroyElement(survivorBlip) destroyElement(survivorPed) destroyElement(toMarker) destroyElement(saveBlip) setTimer(spawnSurvivor, 30000, 1) end function hitSurv(playerSource, thePlayer) local theVehicle = getPedOccupiedVehicle ( playerSource ) if theVehicle then outputChatBox(getPlayerName(playerSource).." Has Collected The Survivor!", server, 0, 255, 0) destroyElement(survivorMarker) destroyElement(survivorBlip) setElementData(playerSource, "hasSurv", true) toMarker = createMarker(-719, 951, 11, "cylinder", 3, 255, 0, 255, 150, playerSource) saveBlip = createBlipAttachedTo( toMarker, 22 ) warpPedIntoVehicle ( survivorPed, theVehicle, 1 ) else outputChatBox("You Need A Vehicle!", playerSource, 255, 0, 0) end addEventHandler("onMarkerHit", toMarker, hitSurvDes) end function hitSurvDes(playerSource) destroyElement(toMarker) destroyElement(survivorPed) destroyElement(saveBlip) givePlayerMoney(playerSource, math.random(500, 1000)) outputChatBox("Survivor Saved Spawning New One In 30 Secs.", server, 0, 255, 0) setElementData(playerSource, "hasSurv", false) setTimer(spawnSurvivor, 30000, 1) end function spawnSurvivor() local random1 = math.random(1, #avaibleSkins) local random2 = math.random(1, #spawnPoints) survivorPed = createPed(avaibleSkins[random1], spawnPoints[random2][1], spawnPoints[random2][2], spawnPoints[random2][3], spawnPoints[random2][4]) survivorMarker = createMarkerAttachedTo ( survivorPed, "cylinder", 4.0, 0, 0, 255, 255 ) survivorBlip = createBlipAttachedTo( survivorPed, 47 ) addEventHandler("onPedWasted", survivorPed, killedPed) addEventHandler("onMarkerHit", survivorMarker, hitSurv) outputChatBox("New Survivor Spawned! Save him for cash.", server, 0, 255, 0) end addEventHandler("onResourceStart", root, function() spawnSurvivor() end) function pedEnter() vehicle = getPlayerVehicle(source) warpPedIntoVehicle(survivorPed, vehicle) end addEventHandler("onClientVehicleEnter", root, pedEnter)
  10. addEventHandler("onZombieSpawned",root, function ( ) setElementHealth ( source, math.random(10, 150 ) ) if getElementHealth(source) <= 49 then setElementData(source, "medium", true) setElementHealth(source, 25) elseif getElementHealth(source) >= 50 and getElementHealth(source) <= 99 then setElementData(source, "easy", true) setElementHealth(source, 75) elseif getElementHealth(source) >= 100 then setElementData(source, "hard", true) setElementHealth(source, 125) end end) fixed it
  11. kewizzle

    im blind af

    addEventHandler("onZombieSpawned",root, function ( ) setElementHealth ( source, math.random(10, 150 ) ) if getElementHealth(source) >= 10 and getElementHealth(source) <= 50 then setElementData(source, "easy", true) elseif getElementHealth(source) >= 51 and getElementHealth(source) <= 69 then setElementData(source, "medium", true) elseif getElementHealth(source) > 70 then setElementData(source, "hard", true) end if getElementData(source, "easy", true) then setElementHealth(source, 50) elseif getElementData(source, "medium", true) then setElementHealth(source, 100) elseif getElementData(source, "hard", true) then setElementHealth(source, 150) end end) sooo idk if im blind or stupid prolly a lil of both but i coded this from scratch twice and took 2 different approaches and neither worked right but they came close. yes i have a reason for elementdata they direct to what difficulty a zombie is by a colored dot but that aint my issue that all works but for some reason "easy" has the health of "hard" and they both have the same 150 health but medium is correct and only has 100 health. How do i make easy work and only have 50 health?
  12. thanks ill use your example to learn from. works. i see what you did here neat function createDrops() if not isElement(supplyVehicle) then local randomPoint = math.random(1, #spawnPoints) supplyVehicle = createVehicle(spawnPoints[randomPoint][1], spawnPoints[randomPoint][2], spawnPoints[randomPoint][3], spawnPoints[randomPoint][4], spawnPoints[randomPoint][5], spawnPoints[randomPoint][6], spawnPoints[randomPoint][7]) supplyVehicle_blip = createBlipAttachedTo(supplyVehicle, 0) outputChatBox("Supply Drop Spawned! Go capture it and return it to the safezone.", root, 0, 255, 0) addEventHandler("onVehicleEnter", supplyVehicle, enterToSupplyVehicle) end end createDrops()
  13. Didn't solve my problem. Same exact thing happens, when i deliver the vehicle to the marker three things happen I want to fix. outputChatBox("Supplies have been delivered. New supplies spawn in 5 minutes.", server, 0, 255, 0) appears twice outputChatBox("Supply Drop Spawned! Go capture it and return it to the safezone.", server, 0, 255, 0) appears twice and then two supply vehicles appear.
  14. local spawnPoints = { { 416, 2066.1, 1396, 10.9, 0, 0, 127 }, { 416, -678.5, 977.4, 12.1, 0, 0, 127 } } function createDrops() local random2 = math.random(1, #spawnPoints) supplyveh1 = createVehicle ( spawnPoints[random2][1], spawnPoints[random2][2], spawnPoints[random2][3], spawnPoints[random2][4], spawnPoints[random2][5], spawnPoints[random2][6], spawnPoints[random2][7]) suppliez = createBlipAttachedTo( supplyveh1, 0 ) outputChatBox("Supply Drop Spawned! Go capture it and return it to the safezone.", server, 0, 255, 0) end addEventHandler("onResourceStart", root, function() createDrops() end) addEventHandler("onVehicleEnter", root, function(thePlayer) if getPedOccupiedVehicle ( thePlayer ) == supplyveh1 then outputChatBox("You have collected the supplies! Get to the safezone!", root, 0, 255, 0) safeZone = createMarker ( -687.2, 956.5, 12.1, "corona", 4, 255, 0, 255, 255, thePlayer ) addEventHandler("onMarkerHit", safeZone, function() destroyElement(safeZone) destroyElement(supplyveh1) destroyElement(suppliez) outputChatBox("Supplies have been delivered. New supplies spawn in 5 minutes.", server, 0, 255, 0) setTimer(createDrops, 300000, 1) end) end end) addEventHandler("onVehicleStartExit", root, function(thePlayer) if getPedOccupiedVehicle ( thePlayer ) == supplyveh1 then outputChatBox("Woah :O you need dem supplies! Get da :O back in da car hoe.", root, 0, 255, 0) destroyElement(safeZone) end end) SO YEAH WHAT THE FRICKEN FRACK AM I DOING WRONG HOMITO???? ahhhh essay? I KNOW HAAAH!!! its spawning two supplyveh1 after i deliver it to the drop off point safeZone and waiting 5 mins for the next to spawn.
  15. Would it be possible to kill all zombies within a certain distance of you? if so how would i go about it? coding wise? I wanna use a dildo onWeaponFire cancels and does an animation with an createExplosion and kills zombies around me.
  16. Hello Multi Theft Auto Community! Today is the day I have decided to release my new Zombies mode. It is a LARGE edit of the zombies resource that we all know and love. Includes a shopping system, a save system, money earning, exp, leveling and unlock system, reset system, zombie difficulty system, safe zones, little bit of mapping, special areas, scoreboard counts, drop system and much more. THIS IS NOT A COMPLETE RESOURCE. I decided that I would go ahead and release it so that the community can help make it a better, and more enjoyable gamemode. I want to see where this goes. All the best scriptors could all come together and build off of this and improve it with bug fixes and what not I believe as a community we can build and awesome mode with this and some of the scripts inside of it. Not everything in this mode was made by me, infact I started with a couple of scripts from the community to learn some lua. I have come very far and i spent years studying it to the point where I would dream about how id make this work and how id make that work and eventually put this stuff into play. I have had some help from some talented scriptors help me in the community so I am gonna give this back to all of you so it wont die. Special Thanks To: @NeXuS™ for helping me when I was stuck @Solidsnake14 for save system(your scripts made me understand account saving btw thanks). also for your EXP system too... I built off of it for unlocks and stuff like that and added a resets option. @3laa33 for helping with the survivor script. @NanoBob for teaching me difference of else if and elseif(LOL). @Pembo for helping me with DX drawing. @Mr.Loki for helping me fix bugs alot more, if you feel the need to be credited let me know why and what you've done. theres a few of you! now that the thanks are all out the way here's a list of things in this script. Zombies(duh) Cash system Different shops(weapons, skins, special weapons, resets, ect.) Map with base locations and placements(not complete) moving gates help window in 3 languages for new players DX Text for shop, destination identification. Drop System weapon selling system edited models/textures safe zones zombie difficulty DX Login window save system unlock system reset system Known Bugs THERE *MIGHT* Be some errors in which GUI doesn't work properly, not sure. as in opens for all players instead of the source or you know bugs for some reason like that other than that its pretty good. Save resource needs to be loaded last or else it wont load peoples account data and they will lose all their work. As of now No other bugs to my knowledge. Would like it to be tested. Any bugs found reply. main script survivor script save system Photos Drop System Shops Level System Reset System Explosive Ammo Panel For 5 Resets
  17. alright well i played with it couldnt get it to work lol so i just decided to attach the ped to the player. I dont like it but for now i guess i will have to stick with it.
  18. alright lol :~ well i will see what i can cook up
  19. youre really good at scripting so im wondering okay so i got this function hitSurv(playerSource) outputChatBox(getPlayerName(playerSource).." Has Collected The Survivor!", server, 0, 255, 0) destroyElement(survivorMarker) destroyElement(survivorBlip) setElementData(playerSource, "hasSurv", true) toMarker = createMarker(-719, 951, 11, "cylinder", 3, 255, 0, 255, 150, playerSource) saveBlip = createBlipAttachedTo( toMarker, 22 ) setPedAnimation( survivorPed, "ped", "WOMAN_run") addEventHandler("onMarkerHit", toMarker, hitSurvDes) end i need the ped to follow me once i hit the marker but all i got it to do is run. is there a way to use setPedLookAt to work with the server side created ped?
  20. works but aye i can fix the easy errors, I like to speed up the process by posting tho cuz im working on it as you professionals help. Im a moderate scripter i guess.
  21. it doesnt work i get the error bad argument at createMarkerAttachedTo expected element at argument 1 got boolean and when i remove that line(which is needed for further development) i get 3 more errors, createPed expected element at argument 1 got nil and createBlipAttachedTo element expected at argument 1 got boolean and addEventHandler expected element at argument 2 got boolean
  22. already returned it. It works perfect except the random stuff.
  23. now a single ped spawns but still gives the debug error as well as doesnt destroy the elements onPedWasted or respawn.
×
×
  • Create New...