Jump to content

myonlake

Members
  • Posts

    2,312
  • Joined

  • Days Won

    40

Everything posted by myonlake

  1. Thank you mate. I would ask another thing here too. What's problem with this one? This is an emergency light script, it doesn't quit emergency lights if I do the /l command again. In debugscript it says: .lua:9: Bad argument @ 'killTimer' .lua:10: Bad argument @ 'killTimer' function EmergencyLights ( source ) theVehicle = getPlayerOccupiedVehicle ( source ) if ( theVehicle ) then if ( getVehicleOverrideLights ( theVehicle ) ~= 2 ) then setVehicleOverrideLights ( theVehicle, 2 ) setTimer ( setLight, 400, 1 ) else setVehicleOverrideLights ( theVehicle, 0 ) killTimer ( setLight ) killTimer ( setLight2 ) end end end function setLight ( ) setTimer ( setLight2, 400, 1 ) setVehicleHeadLightColor (theVehicle, 000, 000, 255) end function setLight2 ( ) setVehicleHeadLightColor (theVehicle, 255, 000, 000) setTimer ( setLight, 400, 1 ) end addCommandHandler ( "l", EmergencyLights )
  2. myonlake

    Area on map

    Hello, I was wondering what is that function that makes (for example) LSPD show blue area on map? Like a turf wars in the Single Player. Is it something to do with the dX drawing?
  3. It works! Thanks all of you!
  4. Alright. I used the same script but changed the marker as an arrow object 1318. It doesn't work yet, can you look if I missed something? arrow1 = createObject(1318, 0, 0, 3, 0, 0, 0) function attach ( hitElement ) if ( getElementType( hitElement ) == "vehicle" ) then attachElements ( hitElement, arrow1 ) else outputChatBox ( "Only vehicles can be attached here" ) end end addEventHandler ( "hitElement", arrow1, attach ) function detach ( thePlayer, commandName ) local Pvehicle = getPedOccupiedVehicle( thePlayer ) detachElements ( pVehicle ) end addCommandHandler ( "detach", detach ) Something like this?
  5. Doesn't work either. But now it doesn't give me any errors either, lol. Are we missing something?
  6. Hello, It doesn't work, but looks better. I fixed some typos there. Errors: on line 4: Bad 'ped' pointer @ 'isPedInVehicle'(1) on line 15: Bad argument @ 'detachElements' EDIT: Would freeze/unfreeze work as good as attaching the element? theMarker = createMarker ( 0, 0, 3, "cylinder", 5, 255, 255, 255, 255 ) function attach ( hitElement, matchingDim ) if ( isPedInVehicle ( hitElement )) then local Pvehicle = getPedOccupiedVehicle ( hitElement ) attachElements ( Pvehicle, theMarker ) else outputChatBox ( "Only vehicles can be attached here" ) end end addEventHandler ( "onMarkerHit", theMarker, attach ) function detach ( thePlayer, commandName ) local attachedElements = getAttachedElements ( getPedOccupiedVehicle ( thePlayer )) detachElements ( Pvehicle, attachedElements ) end addCommandHandler ( "detach", detach )
  7. Yeah, it doesn't work either. It still whines about the 5 and 6 lines.
  8. Hello, Thanks for your help for now, but please do not laugh at my script if it looks like nothing working in it... So this is how far I am now. It creates a marker to the center of the map (the farm at 0,0,3), but it doesn't attach vehicles. It just tells me that lines 5 and 6 have errors like: "Bad Argument @ 'getPedOccupiedVehicle'" "Bad Argument @ 'attachElements'" local theMarker = createMarker ( 0, 0, 3, "cylinder", 5, 255, 255, 255, 255 ) function attach ( hitElement ) if (getElementType(hitElement) == "vehicle" ) then local vehicle = getPedOccupiedVehicle ( vehicle ) attachElements ( vehicle, theMarker ) elseif (getElementType(hitElement) == "player" ) then outputChatBox ( "Only vehicles can be attached here" ) end end addEventHandler ( "onMarkerHit", theMarker, attach ) function detach () local attachedElements = getAttachedElements ( source ) detachElements ( vehicle, source ) end addCommandHandler ( "detach", detach ) So, can someone help me? Have I missed something? try this local theMarker = createMarker ( 0, 0, 3, "cylinder", 5, 255, 255, 255, 255 ) function attach ( hitElement ) if (getElementType(hitElement) == "vehicle" ) then local Pvehicle = getPedOccupiedVehicle ( vehicle ) attachElements ( Pvehicle, theMarker ) elseif (getElementType(hitElement) == "player" ) then outputChatBox ( "Only vehicles can be attached here" ) end end addEventHandler ( "onMarkerHit", theMarker, attach ) function detach () local attachedElements = getAttachedElements ( source ) detachElements ( Pvehicle, source ) end addCommandHandler ( "detach", detach ) It doesn't work either. Same error coming up: "Bad Argument @ 'getPedOccupiedVehicle'" "Bad Argument @ 'attachElements'"
  9. Hello, Thanks for your help for now, but please do not laugh at my script if it looks like nothing working in it... So this is how far I am now. It creates a marker to the center of the map (the farm at 0,0,3), but it doesn't attach vehicles. It just tells me that lines 5 and 6 have errors like: "Bad Argument @ 'getPedOccupiedVehicle'" "Bad Argument @ 'attachElements'" local theMarker = createMarker ( 0, 0, 3, "cylinder", 5, 255, 255, 255, 255 ) function attach ( hitElement ) if (getElementType(hitElement) == "vehicle" ) then local vehicle = getPedOccupiedVehicle ( vehicle ) attachElements ( vehicle, theMarker ) elseif (getElementType(hitElement) == "player" ) then outputChatBox ( "Only vehicles can be attached here" ) end end addEventHandler ( "onMarkerHit", theMarker, attach ) function detach () local attachedElements = getAttachedElements ( source ) detachElements ( vehicle, source ) end addCommandHandler ( "detach", detach ) So, can someone help me? Have I missed something?
  10. Hello, I've been trying to drive a car on a moving ship, but when I move the ship, the car doesn't stay on it. I heard that you should make a marker and when you drive in it it attachs the car there. Well, it sounds easy, but I don't know where to start? Maybe from the marker? I am not sure about the detach, because I would like to do it that when you just drive in the marker it attaches it, when you type a command it detaches. So, does someone have a attach script already or can you help me with this? Okay so if anybody needs the WORKING script, here it is (thanks for everybody who helped me): arrow1 = createObject(1318, 0, 0, 3, 0, 0, 0) theMarker = createMarker ( 0, 0, 3, "cylinder", 5, 255, 255, 255, 0 ) -- the last 0 is the Alpha ( 255 = full visible, 0 = invisible ) function attach ( hitElement ) if ( getElementType( hitElement ) == "vehicle" ) then attachElements ( hitElement, arrow1 ) else outputChatBox ( "Only vehicles can be attached here" ) end end addEventHandler ( "onMarkerHit", theMarker, attach ) function detach ( thePlayer, commandName ) local pVehicle = getPedOccupiedVehicle( thePlayer ) detachElements ( pVehicle ) end addCommandHandler ( "detach", detach )
  11. If I was you I would search more. I found almost all these things as downloadable resources at community. Just find: jrgm, bank, vehiclelights, joinmoney, vehicles-system, new-mabako_services, admin (you already have it), adminpolice (just delete all non-needed stuff, very easy), lock, housing_system Others you can find in Wiki by searching. Just copypaste and read what it says to learn. Easy mate. Good luck.
  12. Hello, I would need some help with this one. It tells me an error when I start the resource. afs-ufo, resource is the name. This is what is shows: SCRIPT ERROR: afs-ufo\settings.lua:22: '(' expected near 'toggleGUI' WARNING: Loading script failed: afs-ufo\settings.lua:22: '(' expected near 'toggleGUI' addCommandHandler("controlufo", function toggleGUI(thePlayer) if allowAll == false or allowAll == nil then if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(thePlayer)), aclGetGroup ( "Admin" ) ) then triggerClientEvent("ufo:showmainGUI", thePlayer) elseif hasObjectPermissionTo ( thePlayer, "resource.afs-ufo.controlufo", false ) then triggerClientEvent("ufo:showmainGUI", thePlayer) else outputChatBox("#ff0000*UFO: #ffff00The UFO cannot be controlled by you at this time.", thePlayer, 255,255,255,true) end else triggerClientEvent("ufo:showmainGUI", thePlayer) end end ) So, anyone can help me with this little bug? ? Thank you
  13. Hello, I am searching for a jailing script for my freeroam server. I have tried searching on this forum and community but those didn't work. It only gave message: "You've been jailed!". It didn't teleport. Anybody knows a working jailing script like this: /jail player /unjail player
  14. Hello, I just downloaded a bank system from community.multitheftauto.com but it didn't include any bank interiors. Can someone help me to find this? Thanks
  15. Do you know how to change the area of the warning. I would like to add this same script to Naval Base. Any advise? I tried to configure those xyz-positions but maybe it wasn't right.
  16. Oh thank you so much! I didn't even search for that keyword! I just searched for like air, a51, defence etc. lol! Thanks PS. Can be locked or deleted whatever
  17. Hello, I am searching a script that shoots rockets in the air if someone comes near A51 (Area 51) or one of my carriers. Does someone know where is this script? Thanks PS. I have seen these rocket scripts in many servers so I guess you know where or you scripted yourself. My script didn't work.
  18. What does bad argument even mean?
  19. Well the problem is only on three lines. I appriciate any help
  20. Hello, I have one error on script that I downloaded from community.multitheftauto.com (link to the resource) I guess some of you are experienced of scripting and can help me. I don't know how to script so well but I am trying to find out why Beta Carrier -script is saying bad argument error. WARNING: carrier\Objects\Server\ObjCarrier.lua:32: Bad argument @ 'getResourceConfig' WARNING: carrier\Objects\Server\ObjCarrier.lua:61: Bad argument @ 'getResourceConfig' WARNING: carrier\Objects\Server\ObjCarrier.lua:81: Bad argument @ 'getResourceConfig' -- server script -- MTA:SA Deathmatch 1.0 Developer preview 2 compatible ObjCarrier = {} ObjCarrier.__index = ObjCarrier function ObjCarrier.create(resource) local _objCarrier = {} setmetatable(_objCarrier, ObjCarrier) _objCarrier._resource = resource _objCarrier._resourceMapRoot = false _objCarrier._centerToBase = 0 _objCarrier._objects = {} _objCarrier._carriers = {} _objCarrier._samgroups = { ["sambow"] = {}, ["samstern"] = {} } _objCarrier._panelgroups = { ["sidepanel"] = {}, ["rearpanel"] = {}, ["backdoor"] = {} } _objCarrier._mainTimer = false _objCarrier._funcMainTimer = nil return _objCarrier end function ObjCarrier:regCarrier(resourceMapRoot) local rootNode = getResourceConfig(self._resource, "../../config/objects.xml") local nextSibling = 0 local firstSibling = false local node = false self._resourceMapRoot = resourceMapRoot self._centerToBase = get(getResourceName(self._resource) .. ".centertobase") if (rootNode) then node = xmlFindChild(rootNode, "object", nextSibling) while (node) do table.insert(self._objects, { ["name"] = xmlNodeGetAttribute(node, "name"), ["model"] = tonumber(xmlNodeGetAttribute(node, "model") or 0), ["posX"] = tonumber(xmlNodeGetAttribute(node, "posX") or 0), ["posY"] = tonumber(xmlNodeGetAttribute(node, "posY") or 0), ["posZ"] = tonumber(xmlNodeGetAttribute(node, "posZ") or 0), ["rotX"] = tonumber(xmlNodeGetAttribute(node, "rotX") or 0), ["rotY"] = tonumber(xmlNodeGetAttribute(node, "rotY") or 0), ["rotZ"] = tonumber(xmlNodeGetAttribute(node, "rotZ") or 0), ["object"] = false, ["xPosOffset"] = 0, ["yPosOffset"] = 0, ["zPosOffset"] = 0 } ) nextSibling = nextSibling + 1 node = xmlFindChild(rootNode, "object", nextSibling) end end rootNode = getResourceConfig(self._resource, "../../config/samgroups.xml") if (rootNode) then for groupName, group in pairs(self._samgroups) do nextSibling = 0 firstSibling = xmlFindChild(rootNode, groupName, nextSibling) if (firstSibling) then node = xmlFindChild(firstSibling, "mover", nextSibling) while (node) do table.insert(self._samgroups[groupName], { ["time"] = tonumber(xmlNodeGetAttribute(node, "time") or 0) / 1000, ["moverZ"] = tonumber(xmlNodeGetAttribute(node, "moverZ") or 0) } ) nextSibling = nextSibling + 1 node = xmlFindChild(firstSibling, "mover", nextSibling) end end end end rootNode = getResourceConfig(self._resource, "../../config/panelgroups.xml") if (rootNode) then for groupName, group in pairs(self._panelgroups) do nextSibling = 0 firstSibling = xmlFindChild(rootNode, groupName, nextSibling) if (firstSibling) then node = xmlFindChild(firstSibling, "target", nextSibling) while (node) do table.insert(self._panelgroups[groupName], { ["time"] = tonumber(xmlNodeGetAttribute(node, "time") or 0), ["targetX"] = tonumber(xmlNodeGetAttribute(node, "targetX") or 0), ["targetY"] = tonumber(xmlNodeGetAttribute(node, "targetY") or 0), ["targetZ"] = tonumber(xmlNodeGetAttribute(node, "targetZ") or 0) } ) nextSibling = nextSibling + 1 node = xmlFindChild(firstSibling, "target", nextSibling) end end end end self._funcMainTimer = function () for _, carrier in ipairs(self._carriers) do for groupName, group in pairs(self._samgroups) do if (carrier.count >= self._samgroups[groupName][carrier.mover].time) then moveObject(carrier[groupName .. "clone"], self._samgroups[groupName][carrier.mover].time * 1000, 0, 0, -100, 0, 0, self._samgroups[groupName][carrier.mover].moverZ) if ((carrier.mover + 1) > #self._samgroups[groupName]) then carrier.mover = 1 else carrier.mover = carrier.mover + 1 end carrier.count = 1 else carrier.count = carrier.count + 1 end end end self._mainTimer = setTimer(self._funcMainTimer, 1000, 1) end self._funcMainTimer() end function ObjCarrier:createCarrier(posX, posY, posZ, rot) local gX, gY, gZ = 0, 0, 0 local oX, oY, oZ = 0, 0, 0 table.insert(self._carriers, { ["id"] = "carrier" .. (#self._carriers + 1), ["parent"] = false, ["objects"] = self._objects, ["samgroups"] = {}, ["panelgroups"] = {}, ["mover"] = 1, ["target"] = { ["sidepanel"] = 1, ["rearpanel"] = 1, ["backdoor"] = 1 }, ["count"] = 1, ["teamplayers"] = {} } ) oX, oY, oZ = self._carriers[#self._carriers].objects[1].posX, self._carriers[#self._carriers].objects[1].posY, self._carriers[#self._carriers].objects[1].posZ for _, object in ipairs(self._carriers[#self._carriers].objects) do gX = math.abs(posX - oX) gY = math.abs(posY - oY) if (object.posX > posX) then gX = object.posX - gX else gX = object.posX + gX end if (object.posY > posY) then gY = object.posY - gY else gY = object.posY + gY end object.posX = gX object.posY = gY object.object = createObject( object.model, object.posX, object.posY, object.posZ, object.rotX, object.rotY, object.rotZ ) for groupName, group in pairs(self._samgroups) do if (object.name == groupName) then setElementID(object.object, self._carriers[#self._carriers].id .. "." .. groupName) self._carriers[#self._carriers][groupName .. "clone"] = cloneElement(object.object, 0, 0, -100, false) setElementID(self._carriers[#self._carriers][groupName .. "clone"], self._carriers[#self._carriers].id .. "." .. groupName .. "clone") end end for groupName, group in pairs(self._panelgroups) do if (object.name == groupName) then setElementID(object.object, self._carriers[#self._carriers].id .. "." .. groupName) self._carriers[#self._carriers][groupName .. "clone"] = cloneElement(object.object, 0, 0, -100, false) setElementID(self._carriers[#self._carriers][groupName .. "clone"], self._carriers[#self._carriers].id .. "." .. groupName .. "clone") end end end self._carriers[#self._carriers].parent = createVehicle(453, posX, posY, posZ, 0, 0, 0) setElementID(self._carriers[#self._carriers].parent, self._carriers[#self._carriers].id) setElementAlpha(self._carriers[#self._carriers].parent, 0) setVehicleDamageProof(self._carriers[#self._carriers].parent, true) toggleVehicleRespawn(self._carriers[#self._carriers].parent, false) for _, object in ipairs(self._carriers[#self._carriers].objects) do setElementParent(object.object, self._carriers[#self._carriers].parent) gX = math.abs(posX - object.posX) gY = math.abs(posY - object.posY) gZ = object.posZ + self._centerToBase if (object.posX < posX) then gX = -(gX) end if (object.posY < posY) then gY = -(gY) end object.xPosOffset = gX object.yPosOffset = gY object.zPosOffset = gZ if (object.name == "hull" or object.name == "hangar") then setElementID(object.object, "carrier." .. object.name) end for groupName, group in pairs(self._samgroups) do if (object.name == groupName) then self._carriers[#self._carriers].samgroups[groupName] = { ["xPosOffset"] = object.xPosOffset, ["yPosOffset"] = object.yPosOffset, ["zPosOffset"] = object.zPosOffset, ["targetPending"] = false, ["timer"] = false, ["maxPlayers"] = 8, ["totalLaunched"] = 0, ["support"] = { ["barrage"] = { ["timer"] = false, ["maxPlayers"] = 1, ["totalLaunched"] = 0 } }, ["creatorPlayers"] = {} } end end for groupName, group in pairs(self._panelgroups) do if (object.name == groupName) then self._carriers[#self._carriers].panelgroups[groupName] = { ["xPosOffset"] = object.xPosOffset, ["yPosOffset"] = object.yPosOffset, ["zPosOffset"] = object.zPosOffset, ["rotX"] = object.rotX, ["rotY"] = object.rotY, ["rotZ"] = object.rotZ } end end attachElements(object.object, self._carriers[#self._carriers].parent, object.xPosOffset, object.yPosOffset, object.zPosOffset, object.rotX, object.rotY, object.rotZ) end setVehicleRotation(self._carriers[#self._carriers].parent, 0, 0, -(rot)) return {["parent"] = self._carriers[#self._carriers].parent, ["id"] = self._carriers[#self._carriers].id} end function ObjCarrier:getCarriers() local carriers = {}
×
×
  • Create New...