Jump to content

Captain Cody

Members
  • Posts

    2,753
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by Captain Cody

  1. Oh wait I read that wrong crap.. function follow() for i,v in pairs(zombie) do local x,y,z = getElementPosition (getLocalPlayer()) local zpx,zpy,zpz = getElementPosition (v) local zombie_angle = (360 - math.deg(math.atan2((zpx - x), (zpy - y)))) % 360 local dist = getDistanceBetweenPoints2D(x, y, zpx, zpy) if (dist > 3) then setPedCameraRotation (v,-zombie_angle) setPedControlState(v, "backwards", true) setPedControlState(v, "fire", false) elseif (dist < 3) then setPedAimTarget (v, x,y,z) setPedCameraRotation (v,-zombie_angle) setPedControlState(v, "fire", false) setPedControlState(v, "fire", true) setPedControlState(v, "fire", false) end end end There are a few bits I'm unsure of, but this should work hopefully.
  2. Made a mistake.. function follow() for i,v in pairs(zombie) do local x,y,z = getElementPosition (getLocalPlayer()) local zpx,zpy,zpz = getElementPosition (v) local zombie_angle = (360 - math.deg(math.atan2((zpx - x), (zpy - y)))) % 360 local dist = getDistanceBetweenPoints2D(x, y, zpx, zpy) if (dist < 2) then setPedCameraRotation (v,-zombie_angle) setPedControlState(v, "backwards", true) setPedControlState(v, "fire", false) elseif (dist > 2) then setPedAimTarget (v, x,y,z) setPedCameraRotation (v,-zombie_angle) setPedControlState(v, "fire", false) setPedControlState(v, "fire", true) end end end Had it so it would fire if the distance was bigger then two instead of smaller then.
  3. Try /unbind g If that doesn't work, manually edit out the bindKey function
  4. Basic things to do -- Create a gui edit box Create an accept button When player hits send create a file, and set its text to the text from the GUI edit box. Usually for the title I'd use the players name, then some random numbers to prevent the names from conflicting
  5. function follow() for i,v in pairs(zombie) do local x,y,z = getElementPosition (getLocalPlayer()) local zpx,zpy,zpz = getElementPosition (v) local zombie_angle = (360 - math.deg(math.atan2((zpx - x), (zpy - y)))) % 360 local dist = getDistanceBetweenPoints2D(x, y, zpx, zpy) if (dist > 2) then setPedCameraRotation (v,-zombie_angle) setPedControlState(v, "backwards", true) setPedControlState(v, "fire", false) elseif (dist < 2) then setPedAimTarget (v, x,y,z) setPedCameraRotation (v,-zombie_angle) setPedControlState(v, "fire", false) setPedControlState(v, "fire", true) end end end - Changed a few things, some due to potential issues; others just to optimize the code a bit. Any ways make sure the timer is set up right and what not.
  6. function Lock (EnterPerson) local car = getPedOccupiedVehicle (EnterPerson) local x,y,z = getElementPosition( EnterPerson ) local col = createColSphere ( x,y,z, 10 ) local veh = getElementsWithinColShape (col, "vehicle") if isPedInVehicle ( EnterPerson ) then setVehicleLocked (car, true) outputChatBox ("locked", EnterPerson) end if isPedInVehicle ( EnterPerson ) == false then for i,v in pairs(veh) do setVehicleLocked (v, false) outputChatBox ("Unlocked", EnterPerson) end end addCommandHandler ("Lock", Lock, false , false)
  7. local maxzombies = 30 local zombiecount = 0 zombie = {} function spawn() local x,y,z = getElementPosition (localPlayer) zombie[zombiecount] = zombiecount zombie[zombiecount] = createPed (20,x+math.random(-7,7),y+math.random(-7,7),z) end function follow() zpx,zpy,zpz = getElementPosition (zombie[zombiecount]) local zombie_angle = (360 - math.deg(math.atan2((zpx - x), (zpy - y)))) % 360 local dist = getDistanceBetweenPoints2D(x, y, zpx, zpy) if (dist > 2) then setPedCameraRotation (zombie[zombiecount],zombie_angle) setPedControlState(zombie[zombiecount], "forwards", true) elseif (dist < 2) then setPedControlState(zombie[zombiecount], "forwards", false) setPedControlState(zombie[zombiecount], "fire", true) end end setTimer (follow, 1000, 0) function zombie_check() if (zombiecount < maxzombies) then spawn() zombiecount = zombiecount + 1 end end setTimer (zombie_check, 100, 0) function zombie_died() zombiecount = zombiecount - 1 end addEventHandler("onClientPedWasted", getRootElement(), zombie_died) You can't local a table in this case here.
  8. function cancelTheEvent(EnterPerson) removePedFromVehicle ( EnterPerson) end addEventHandler ( "onVehicleEnter", getRootElement(), cancelTheEvent)
  9. Then convert them already... If you don't know how or some thing email me with the files and I will.
  10. Then use the functions Walid put originally, I explained how to use each of them..
  11. If you just want to add objects that are already there use https://wiki.multitheftauto.com/wiki/CreateObject http://dev.prineside.com/en/gtasa_samp_model_id/ Col = Collision file, it's what allows you to stand/ hit the object LODDistance = The distance you are able to see the object from, but it needs a LOD assigned to it for better results.
  12. Well basically first you have to record your mileage, then you have to split it into 6 units. And so on. Probably could use setElementData. And use onClientRender, and check speed and what not.
  13. Any thing in debugscript? And, try defining GUIEditor if it's no already defined GUIEditor = {}
  14. function downloadPlayerAlternateSkin (p, _) local filename = exports.CSTmysql:query("SELECT * FROM Skins") for i=1, #filename do local theskinId = filename[i].skinid outputDebugString("filename[i] = ".. tostring(filename[i].skinid)) -- Not sure if this was what you intended to do, but here it was outputting a table as the string. if theskinId then fetchRemote("http://localhost/shadersqsdqs/"..theskinId..".jpg", checkPlayerAlternateSkinONLOGIN) end end end addCommandHandler("addskin", downloadPlayerAlternateSkin) Not sure if that's what you were trying to do, but some times small errors such as that will indeed freeze up the server.
  15. txd = engineLoadTXD() -- Load up the txd, in () put the name of the txd file engineImportTXD(txd,model) -- Import the txd replace model with the model ID dff = engineLoadDFF() -- Load up the dff, as before in () put the name of the dff file engineReplaceModel(dff,model) -- Replace the dff, replace model with the model ID col = engineLoadCOL() -- Put col file name in () engineReplaceCOL(col,model) -- Replace model with the model ID. engineSetModelLODDistance(model,300) -- Use this to set a custom lod distance 300 max.. Questions?
  16. When you post some such such as this, can you please explain in clearer English. Hard to under stand what exactly you are asking in the first place.
  17. Here's an example (Untested) -- Table = {{x,y,z,r,1},{x,y,z,r,2},{x,y,z,r,3},{x,y,z,r,4}} -- 1,2,3,4,5 etc = position ; x,y,z,r = cords for said position Time = 5000 -- Put time you want it to take for each position here. Basically the speed. Object = -- Put car here. function trigger() for i,v in pairs(Table) do local x,y,z,r,p = Table[1],Table[2],Table[3],Table[4],Table[5] setTimer ( moveTheObject, p*time, 1,x,y,z,r,p) -- Set timer for when to move it.. end end function moveTheObject(x,y,z,r,p) local xr,yr,zr = getElementRotation(Object) moveObject (Object, Time,x,y,z,xr,yr,r) --- Actually do the move end
  18. Judging by how it turned, it's using move object with a table.
  19. You would have to make your own spherical models with cols, make faces, boxes, etc. But resizing wouldn't work so you'd either have script some sort of grid; or make a few different sizes of each.
  20. Make the stop command handler client sided.
  21. Looping through numbers won't lag a server. Any ways -- Do as alex said local objects = getElementsByType("object") for i, v in ipairs(objects) do local x,y,z = getElementPosition(v) local xr,yr,zr = getElementRotation(v) setLowLODElement(v,createObject ( getElementModel(v), x,y,z,xr,yr,zr,true ) local lowlod = getLowLODElement(v) attachElements(lowlod,v) ) end
  22. hm.. You could connect an object to the marker maybe. And use getElementAttachedTo
  23. It's because the marker has no collisions onClientClick and proccessLineOfSight both rely on collision with the object.
×
×
  • Create New...