Jump to content

Adde

Members
  • Posts

    228
  • Joined

  • Last visited

Everything posted by Adde

  1. you just write at the bottom of mtaserver.conf
  2. Yes I have the same problem, but I don´t know what the probem is.
  3. Do you mean start the resources automaticly?
  4. Adde

    how to add car

    What do you mean with add cars? add cars to the map or replace the model of a car with another?
  5. Hello, I want to ask you if it´s possible to make a function to trigger when a player have register. Example make this happend when someone register: function onPlayerRegister () setElementPosition ( player, x, y, z ) SetPlayerTeam ( player, "team" ) SetElementModel ( player, 1 ) givePlayerMoney ( player, 1000 ) addEventHandler("???", getRootElement, onPlayerRegister) Anyone who knows how to do that or if it works? I tested to put it in registerpanel with the other things happend at register but it didn´t work. I found something on the forum that maybe helped me a bit. Can this work? addEventHandler("onPlayerLogin", root, function(_, account) if not getAccountData(account, "FirstTime") then setElementPosition ( player, x, y, z ) setPlayerTeam ( player, "team" ) setElementModel ( player, 1 ) givePlayerMoney ( player, 1000 ) setAccountData(account, "FirstTime", true) end end )
  6. Okay, thx i test that say whut, I entered "scripting" ffs
  7. Hey guys I have this resource to warn a player if he is shooting someone, but how to change element from player to vehicle? So when I hit or shot a car it will warn the player. I tried to change it but it didn´t work. It´s probably something easy and that I just forgot. function warnDM ( attacker ) if attacker ~= source then if ( getElementType ( attacker ) == "player" ) then outputChatBox ("WARNING!! Don´t shoot at other players!", attacker, 255, 20, 20, true ) end end end addEventHandler ( "onPlayerDamage", root, warnDM )
  8. Okay, i haven´t tested this, but try to reset "fps.lua" with this. Then when script is started you should be able to do /fps to use firstperson. If it doesn´t work, just download the original script again or tell me the debug. checking = 0 carchecking = 0 wright = false wleft = false wback = false function FPSStart () local skin = engineLoadTXD ( "160.txd" ) -- arm skin engineImportTXD ( skin, 160 ) local x,y,z = getElementPosition( getLocalPlayer() ) Body = createObject (991, x, y, z ) setElementParent(Body, getLocalPlayer()) attachElements ( Body, getLocalPlayer(), 0, -0.1, 0.45, 0, 90, 0) setElementAlpha( Body, 0) setElementData ( getLocalPlayer(), "blocker", Body ) realskin = getElementModel(getLocalPlayer()) if realskin == 160 then realskin = 200 end realvoice1, realvoice2 = getPedVoice (getLocalPlayer()) setElementModel ( getLocalPlayer(), 160 ) setPedVoice (getLocalPlayer(),realvoice1,realvoice2) local allcars = getElementsByType ( "vehicle", getRootElement(), false) for theKey,theVehicle in ipairs(allcars) do setElementCollidableWith ( Body, theVehicle, false ) end bindKey ( "left", "both", sidewalking ) bindKey ( "right", "both", sidewalking ) bindKey ( "backwards", "both", sidewalking ) bindKey ( "fire", "both", autoAimMode ) end end addCommandHandler ( "fps", getRootElement(), FPSStart) function clearcars() if getElementType(source) == "vehicle" then setElementCollidableWith ( Body, source, false ) end end addEventHandler( "onClientElementStreamIn", getRootElement(),clearcars) function invisOnSpawn() realskin = getElementModel(getLocalPlayer()) if realskin == 160 then realskin = 200 end realvoice1, realvoice2 = getPedVoice (getLocalPlayer()) setElementModel ( getLocalPlayer(), 160 ) setPedVoice (getLocalPlayer(),realvoice1,realvoice2) end addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), invisOnSpawn ) function climbcheck() if isPlayerDead(getLocalPlayer())== false and getControlState("aim_weapon") == false then setElementCollisionsEnabled(Body, false)
  9. You can change it to a bind instead of a command i think. But if so, you have to edit the script.
  10. Adde

    gatemaker problem

    It works, but also not. It rotates all way back and changes position of the rotation after every time i open and close, lol. When I restart gatemaker the gate is set to the right position.
  11. Adde

    gatemaker problem

    Same problem but ":85:Bad argument @ "moveobject" [Expected number at argument 3, got nil ]"
  12. Adde

    gatemaker problem

    Nope, I just reinstalled mta and added it again.
  13. This gatemaker from community got a problem on latest version of mta, i don´t know how to fix it but I hope someone can! debug: WARNING: [gameplay]/gatemaker/gateloader.lua:85: Bad argument @ "moveobject" [Expected easing-type at argument 9, got number "0" ] server.lua Editor = {} Gate = {} Gate2 = {} Precision = {} status = {} coll = {} coll2 = {} coll3 = {} coll4 = {} -- this script mod is (no longer) PRIVATE -- - Deject3d function startBuilding(playerSource, commandName, objectid) if not objectid then outputChatBox("usage: /addgate objectid teamname", playerSource) end team = getTeamName(getPlayerTeam(playerSource)) if team == false then team = "" end for i = 1,20 do if Editor[i] == playerSource then destroyElement(Gate[i]) Gate[i] = null Editor[i] = null Precision[i] = null end if Editor[i] == null then Editor[i] = playerSource -- set Editor[i] to who made the object --creating object -v local x,y,z = getElementPosition(playerSource) object = createObject ( objectid, x + 3,y + 3,z) interior = getElementInterior ( playerSource ) setElementInterior(object,interior) --created object -^ Gate[i] = object -- added object identifier to the array, corresponds to who created it Precision[i] = .5 -- default precision bindKey(playerSource, "i", "down", moveIt) bindKey(playerSource, "j", "down", moveIt) bindKey(playerSource, "k", "down", moveIt) bindKey(playerSource, "l", "down", moveIt) bindKey(playerSource, "mouse_wheel_up", "down", moveIt) bindKey(playerSource, "mouse_wheel_down", "down", moveIt) bindKey(playerSource, "pgup", "down", moveIt) bindKey(playerSource, "pgdn", "down", moveIt) bindKey(playerSource, "u", "down", moveIt) bindKey(playerSource, "o", "down", moveIt) bindKey(playerSource, "[", "down", moveIt) bindKey(playerSource, "]", "down", moveIt) bindKey(playerSource, "enter", "down", nextPosition ,objectid, team) bindKey(playerSource, "delete", "down", removeIt, playerSource) break -- done adding our object and who created it to the arrays... stop the loop end end end function nextPosition(playerSource, key, keyState, objectid, team) unbindKey ( playerSource, "i" ) unbindKey ( playerSource, "j" ) unbindKey ( playerSource, "k" ) unbindKey ( playerSource, "l" ) unbindKey ( playerSource, "pgup" ) unbindKey ( playerSource, "pgdn" ) unbindKey ( playerSource, "mouse_wheel_down") unbindKey ( playerSource, "mouse_wheel_up" ) unbindKey ( playerSource, "enter" ) unbindKey ( playerSource, "delete" ) unbindKey ( playerSource, "u" ) unbindKey ( playerSource, "o" ) unbindKey ( playerSource, "[" ) unbindKey ( playerSource, "]" ) outputDebugString("object 1 set. object 2 controlled. ID: " .. objectid .." team: " .. team .. "") for i = 1,20 do if Editor[i] == playerSource then --creating object -v local x,y,z = getElementPosition(Gate[i]) local rx,ry,rz= getObjectRotation(Gate[i]) object = createObject ( objectid, x,y,z,rx,ry,rz) interior = getElementInterior ( playerSource ) setElementInterior(object,interior) --created object -^ Gate2[i] = object -- added object identifier to the array, corresponds to who created it Precision[i] = .5 -- default precision bindKey(playerSource, "i", "down", moveIt2) bindKey(playerSource, "j", "down", moveIt2) bindKey(playerSource, "k", "down", moveIt2) bindKey(playerSource, "l", "down", moveIt2) bindKey(playerSource, "mouse_wheel_up", "down", moveIt2) bindKey(playerSource, "mouse_wheel_down", "down", moveIt2) bindKey(playerSource, "pgup", "down", moveIt2) bindKey(playerSource, "pgdn", "down", moveIt2) bindKey(playerSource, "u", "down", moveIt2) bindKey(playerSource, "o", "down", moveIt2) bindKey(playerSource, "[", "down", moveIt2) bindKey(playerSource, "]", "down", moveIt2) bindKey(playerSource, "enter", "down", collisionObject, team, objectID) bindKey(playerSource, "delete", "down", removeIt, playerSource) break -- done adding our object and who created it to the arrays... stop the loop end end end function changePrecision(playerSource,commandName,value) if value then for i = 1,20 do if Editor[i] == playerSource then Precision[i] = value outputChatBox("Sensitivity set to: " .. value .. "", playerSource) break end end end end function moveIt(source, key, keyState) for i = 1,20 do if Editor[i] == source then object = Gate[i] prec = Precision[i] break end end if key == "i" then x,y,z = getElementPosition(object) setElementPosition ( object, x,y + prec,z ) end if key =="j" then x,y,z = getElementPosition(object) setElementPosition ( object, x - prec,y,z ) end if key =="l" then x,y,z = getElementPosition(object) setElementPosition ( object, x + prec,y,z ) end if key =="k" then x,y,z = getElementPosition(object) setElementPosition ( object, x,y - prec,z ) end if key =="pgup" then x,y,z = getElementPosition(object) setElementPosition ( object, x,y,z + prec ) end if key =="pgdn" then x,y,z = getElementPosition(object) setElementPosition ( object, x,y ,z - prec ) end -- rotation -- if key =="mouse_wheel_up" then rx,ry,rz = getObjectRotation(object) setObjectRotation ( object, rx,ry,rz - prec * 5) end if key =="mouse_wheel_down" then rx,ry,rz = getObjectRotation(object) setObjectRotation ( object, rx,ry,rz + prec * 5) end if key =="u" then rx,ry,rz = getObjectRotation(object) setObjectRotation ( object, rx,ry - prec*10,rz) end if key =="o" then rx,ry,rz = getObjectRotation(object) setObjectRotation ( object, rx,ry + prec*10,rz) end if key =="[" then rx,ry,rz = getObjectRotation(object) setObjectRotation ( object, rx- prec*10,ry,rz) end if key =="]" then rx,ry,rz = getObjectRotation(object) setObjectRotation ( object, rx+ prec*10,ry,rz) end end function moveIt2(source, key, keyState) for i = 1,20 do if Editor[i] == source then object = Gate2[i] prec = Precision[i] break end end if key == "i" then x,y,z = getElementPosition(object) setElementPosition ( object, x,y + prec,z ) end if key =="j" then x,y,z = getElementPosition(object) setElementPosition ( object, x - prec,y,z ) end if key =="l" then x,y,z = getElementPosition(object) setElementPosition ( object, x + prec,y,z ) end if key =="k" then x,y,z = getElementPosition(object) setElementPosition ( object, x,y - prec,z ) end if key =="pgup" then x,y,z = getElementPosition(object) setElementPosition ( object, x,y,z + prec ) end if key =="pgdn" then x,y,z = getElementPosition(object) setElementPosition ( object, x,y ,z - prec ) end -- rotation -- if key =="mouse_wheel_up" then rx,ry,rz = getObjectRotation(object) setObjectRotation ( object, rx,ry,rz - prec * 5) end if key =="mouse_wheel_down" then rx,ry,rz = getObjectRotation(object) setObjectRotation ( object, rx,ry,rz + prec * 5) end if key =="u" then rx,ry,rz = getObjectRotation(object) setObjectRotation ( object, rx,ry - prec*10,rz) end if key =="o" then rx,ry,rz = getObjectRotation(object) setObjectRotation ( object, rx,ry + prec*10,rz) end if key =="[" then rx,ry,rz = getObjectRotation(object) setObjectRotation ( object, rx- prec*10,ry,rz) end if key =="]" then rx,ry,rz = getObjectRotation(object) setObjectRotation ( object, rx+ prec*10,ry,rz) end
  14. Okay, i reinstalled mta now and found it, I will test this way now. It works! When I also reinstalled mta on my server pc thx
  15. Hello I used object_remover from community to remove some things from map. The problem is that the objects come back after reconnect and it only works to remove when it is in server side and not client. Here´s the saved script from object_remover. Anyone who knows the problem? Server local removals = {} addEventHandler("onResourceStart", resourceRoot, function() local xmlNode = xmlLoadFile("removals.xml") if not xmlNode then outputDebugString("Invalid xml file") return end local children = xmlNodeGetChildren(xmlNode) for k, node in ipairs(children) do if xmlNodeGetName(node) == "removal" then local model, LODmodel = tonumber(xmlNodeGetAttribute(node, "model")), tonumber(xmlNodeGetAttribute(node, "LODmodel")) local posX, posY, posZ = tonumber(xmlNodeGetAttribute(node, "posX")), tonumber(xmlNodeGetAttribute(node, "posY")), tonumber(xmlNodeGetAttribute(node, "posZ")) local rotX, rotY, rotZ = tonumber(xmlNodeGetAttribute(node, "rotX")), tonumber(xmlNodeGetAttribute(node, "rotY")), tonumber(xmlNodeGetAttribute(node, "rotZ")) local interior = tonumber(xmlNodeGetAttribute(node, "interior")) removeWorldModel(model, 20, posX, posY, posZ, rotX, rotY, rotZ, interior) removeWorldModel(LODmodel, 20, posX, posY, posZ, rotX, rotY, rotZ, interior) table.insert(removals, {model, LODmodel, posX, posY, posZ, rotX, rotY, rotZ, interior}) end end outputDebugString("Removal-map successfully loaded") end ) addEventHandler("onResourceStop", resourceRoot, function() for k, info in ipairs(removals) do local model, LODmodel, posX, posY, posZ, rotX, rotY, rotZ, interior = unpack(info) restoreWorldModel(model, 20, posX, posY, posZ, rotX, rotY, rotZ, interior) restoreWorldModel(LODmodel, 20, posX, posY, posZ, rotX, rotY, rotZ, interior) end end ) objects xml "16670" LODmodel="0" interior="0" posX="330.7890625" posY="1813.21875" posZ="17.828125" rotX="0" rotY="0" rotZ="0.75796508789063"> "16094" LODmodel="0" interior="0" posX="191.140625" posY="1870.0390625" posZ="21.4765625" rotX="0" rotY="0" rotZ="0"> "16095" LODmodel="0" interior="0" posX="279.1328125" posY="1829.78125" posZ="16.6328125" rotX="0" rotY="0" rotZ="269.5"> "3279" LODmodel="0" interior="0" posX="113.3828125" posY="1814.453125" posZ="16.8203125" rotX="0" rotY="0" rotZ="0"> "3279" LODmodel="0" interior="0" posX="103.890625" posY="1901.1015625" posZ="16.8203125" rotX="0" rotY="0" rotZ="0"> "16096" LODmodel="0" interior="0" posX="120.5078125" posY="1934.03125" posZ="19.828125" rotX="0" rotY="0" rotZ="0"> "16671" LODmodel="0" interior="0" posX="193.953125" posY="2051.796875" posZ="20.1796875" rotX="0" rotY="0" rotZ="357.04632568359"> "16668" LODmodel="0" interior="0" posX="357.9375" posY="2049.421875" posZ="16.84375" rotX="0" rotY="0" rotZ="180.56341552734"> "16669" LODmodel="0" interior="0" posX="380.2578125" posY="1914.9609375" posZ="17.4296875" rotX="0" rotY="0" rotZ="201.69436645508"> "3279" LODmodel="0" interior="0" posX="233.4296875" posY="1934.84375" posZ="16.8203125" rotX="0" rotY="0" rotZ="0"> "966" LODmodel="0" interior="0" posX="-1526.390625" posY="481.3828125" posZ="6.1796875" rotX="0" rotY="0" rotZ="0"> "968" LODmodel="0" interior="0" posX="-1526.4375" posY="481.3828125" posZ="6.90625" rotX="0" rotY="0" rotZ="0"> "966" LODmodel="0" interior="0" posX="-1572.203125" posY="658.8359375" posZ="6.078125" rotX="0" rotY="0" rotZ="270"> "967" LODmodel="0" interior="0" posX="-1572.703125" posY="657.6015625" posZ="6.078125" rotX="0" rotY="0" rotZ="0"> "966" LODmodel="0" interior="0" posX="-1701.4296875" posY="687.59375" posZ="23.8828125" rotX="0" rotY="0" rotZ="90"> xml "true">
  16. Adde

    JoinSound

    I using it as client.. Okay, so like this? client addEventHandler( "onClientResourceStart", root, function () local sound = playSound("scary.mp3") setSoundVolume(sound, 1) end ) function stopSoundOnLogin() stopSound(sound) end addEvent("stop", true) addEventHandler("onPlayerLogin", root, stopSoundOnLogin)
  17. Adde

    JoinSound

    Hello, I made a script that play a sound on join and then stop it on login. The problem is that the sound don´t start, what´s wrong? Thankfull for answears function playSoundOnJoin() local sound = playSound("scary.mp3") setSoundVolume(sound, 1) end addEventHandler("onPlayerJoin", root, playSoundOnJoin) function stopSoundOnLogin() stopSound(scary) end addEvent("stop", true) addEventHandler("onPlayerLogin", root, stopSoundOnLogin) btw, nothing in debug
  18. Ah okay I forgot to say that
  19. Yes that worked, thx! I only tested with source..
  20. Hello, why is setElementModel a bad argument here? function skin () setElementModel( player, 286 ) end addCommandHandler ( "girlskin", skin )
  21. Hello, I wounder what I did wrong because the outputChatBox does not show. It should show only for attacker. function warnDM ( _, attacker ) if attacker ~= source then if ( getElementType ( attacker ) == "player" ) then outputChatBox ("WARNING!! Don´t shoot at other players!", attacker, 255, 20, 20, true ) end end end addEventHandler ( "onPlayerDamage", root, warnDM )
  22. Post the function when you save the team. Save team works correctly, it´s the script that just makes the player join offline team when it´s a guest account that I don´t know how to fix. viewtopic.php?f=91&t=55069
×
×
  • Create New...