Jump to content

kewizzle

Members
  • Posts

    162
  • Joined

  • Last visited

About kewizzle

  • Birthday 11/12/1996

Details

  • Gang
    CumDrop
  • Location
    Nebraska, USA
  • Occupation
    Scripter
  • Interests
    MTASA, Zombies, Scripting, Programming

Recent Profile Visitors

1,906 profile views

kewizzle's Achievements

Busta

Busta (15/54)

8

Reputation

  1. Hi i want to make it so you have multiple radar areas and they all spawn together and they all are their own instance so when you enter any of them the script will do the same thing in each one around the map heres a sample WarehouseCol1 = createColRectangle( 2535, 2796, 80, 60 ) and createColRectangle( 1287, 1227, 80, 60 ) WarehouseArea1 = createRadarArea( 2535, 2796, 80, 60, 0, 0, 255, 90, root ) and createRadarArea( 1287, 1227, 80, 60, 0, 0, 255, 90, root )
  2. actually cancel this lol i found my old script i dont have to rewrite completely now HAHA
  3. so i should removeEventHandler each time Edit actually i can probably just call that outside
  4. This script is nearly complete works great but there are some bugs, just wanna see if anyone can point out why it spawns multiple elements each time i complete the warehouse, ill complete it once it spawns 1 truck then the second time it spawns 2 trucks. Also any improvement ideas would be nice. Client: warehouseR = createRadarArea ( 2535, 2795, 80, 50, 255, 0, 0, 75) warehouseCol = createColRectangle ( 2535, 2795, 80, 50 ) createBlip ( 2577, 2820, 11, 22 ) gpt = getElementData(localPlayer, "timer") local screenW, screenH = guiGetScreenSize() timerT = guiCreateLabel((screenW - 600) / 2, (screenH - 52) / 2, 600, 52, "Defend Warehouse: 300", false) guiSetFont(timerT, "sa-gothic") guiLabelSetColor(timerT, 48, 218, 36) guiSetVisible(timerT, false) addEventHandler("onClientColShapeHit", warehouseCol, function(theElement) if isElementWithinColShape ( localPlayer, warehouseCol ) then setElementData(localPlayer, "timer", 300) guiSetVisible(timerT, true) theTimer = setTimer ( function ( ) gpt = getElementData(localPlayer, "timer") setElementData(localPlayer, "timer", gpt-1) guiSetText(timerT, "Defend Warehouse: "..gpt) end, 1000, 300 ) addEventHandler("onClientColShapeLeave", warehouseCol, function() killTimer(theTimer) setElementData(localPlayer, "timer", 300) guiSetText(timerT, "Defend Warehouse: "..gpt) guiSetVisible(timerT, false) end) addEventHandler("onClientElementDataChange", localPlayer, function() if getElementData(localPlayer, "timer") == -2 then outputChatBox ( "Deliver The Supply Truck!", 0, 255, 0 ) triggerServerEvent ( "spawnSupplies", localPlayer, "spawnSupplies" ) end end) end end) Server: function supplySpawn () supplytruck = createVehicle ( 498, 2525, 2810, 11.2, 0, 0, 180 ) warpPedIntoVehicle ( source, supplytruck) stb = createBlipAttachedTo ( supplytruck, 51, 2, 255, 0, 0, 255, 0, 65535 ) dropoff = createMarker(285.5, 2498.8000488281, 16.5, "cylinder", 10, 255, 0, 255, 255, source) dob = createBlipAttachedTo ( dropoff, 35, 2, 255, 0, 0, 255, 0, 65535, source ) addEventHandler("onMarkerHit", dropoff, function() if isElementWithinMarker ( supplytruck, dropoff ) then destroyElement(dropoff) destroyElement(supplytruck) destroyElement(stb) destroyElement(dob) outputChatBox ( "Supply Truck Delivered Successfully! Rewards Recieved!", thePlayer, 0, 255, 0 ) givePlayerMoney(root, math.random(1000,5000)) giveWeapon(root, math.random(1, 46), math.random(0,100)) giveWeapon(root, math.random(1, 46), math.random(0,100)) giveWeapon(root, math.random(1, 46), math.random(0,100)) end end) addEventHandler("onVehicleExplode", supplytruck, function() outputChatBox ( "Supply Truck Destroyed! MISSION FAILED!", thePlayer, 255, 0, 0 ) destroyElement(supplytruck) destroyElement(dropoff) destroyElement(stb) destroyElement(dob) end) end addEvent( "spawnSupplies", true ) addEventHandler( "spawnSupplies", root, supplySpawn )
  5. I figured out a way to make it work without vmware and virtual box
  6. i was trying to use vmware to solo test some scripts with 2 players and it says banned by mta reason 4e security whatever vm type something so wondering whats the best way to test my scripts solo?
  7. i redid it works well i just used my display and text item ima post a video lmk what you think bro
  8. yknow what buddy ima remake this buut completely server side
  9. guess what buddy i was able to use the old script and i fixed it completely. using what you taught me. i found this little piece of code useful (shape == warehouse_col) and my finished script here. 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(source) == "ped") or (getElementType(source) == "marker") 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", localPlayer, warehouseLeave) --warehouse timer function warehoueTimer() if (getElementType(localPlayer) == "ped") or (getElementType(localPlayer) == "marker") 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(shape) if (getElementType(source) == "ped") or (getElementType(source) == "marker") or (shape ~= WarehouseCol1) then return end --thought maybe this would work if isElementWithinColShape(localPlayer, WarehouseCol1) == true and (shape == WarehouseCol1) then setElementData(localPlayer, "timer", 60) :O = setTimer(warehoueTimer, 1000, 61) else killTimer(:O) end end addEventHandler("onClientElementColShapeLeave", localPlayer, warehoueEnter) addEventHandler("onClientElementColShapeHit", localPlayer, warehoueEnter) --switch from destroyed element source to player source function switchh() triggerServerEvent("switch2", localPlayer) end addEventHandler( "switch", localPlayer, switchh ) addEvent( "switch", true ) this is my largest script ive ever written other than guis i think i did pretty good it works flawless.
  10. Thanks for all your help I'd like you to win the day again so I went ahead and gave you a good boost
  11. Okay I'ma rewrite the script from start to finish. Can you give me an example on how to use an element from one function to another? Or how would I do that? Say I created the setTimer in warehouseEnter and want to kill it in warehouseLeave.
×
×
  • Create New...