Jump to content

Sawos

Members
  • Posts

    30
  • Joined

  • Last visited

Everything posted by Sawos

  1. Hello there,today i bring an inventory script,as the name suggests it's an inventory to store all your items from weapons to food/repairkit ,to use an item it is easy as just pressing use within selecting the amount .It is very easy and stable and was built using SQL,hopefully it is up to standards. You still have the option to use commands : ./use weaponname amount ./use itemname ./store weaponname amount ./drop weaponname amount (need to be stored) Current Items: Food: Boosts the player's health by 10 if he's low. Repairkit: Gives the vehicle 100 health (only if it's too damaged) Exported functions which you can use them in other scripts : (server side) getPlayerItem(player,itemname) updatePlayerItems(player,itemname,value) TakePlayeritem(player,itemname,value) Download link : https://community.multitheftauto.com/index.php?p=resources&s=details&id=18155
  2. Well, I tought you would give me a lesson, but i will. If you leave it to "source" It won't make the player exits, cause the source element refers to the Vehicle not the player so without using The Loop to get the players it won't work, same thing with the Vehicle Loop without it, it won't dected any of the Vehicles at all : for i,player in pairs(getVehicleOccupants(source)) do setControlState(player,"enter_exit",true) and The issue was never from this Loop, cause without the loop the SetControlState won't be working plus even without both of them the issue still the same. i've posted this so people could help me with an "usefull" reply with Codes. Other than that, i don't need any pointless Reply. i see ppl farming replies with non sense help. Thanks
  3. Nope that's not the problem, if it was that i wouldn't post it.
  4. Hello Community, i would like to have some support here, the code works fine on this script which once the Vehicle damage is below "350", it gets Destroyed in a couple of seconds and then once the script calls this : setTimer( sec, 6000, 0 ) It doesn't spawn a single Vehicle as i wish to, it Spawns an infinate Vehicles on the same place. i just need help to make it spawn Only One. Here is the full code : function sec () local car = createVehicle ( 428, 2317.0588378906,2408.1867675781,10.8203125) setElementData(car,"sec",true) setVehicleDamageProof(car,true) end addEventHandler("onResourceStart", resourceRoot,sec) function checkDamage(player) for _,vehicle in ipairs ( getElementsByType ( "vehicle" ) ) do if getElementData(source,"sec") then else return end if getElementHealth(source) > 350 then setVehicleDamageProof(source,false) setVehicleEngineState(source,true) else setVehicleDamageProof(source,true) setVehicleEngineState(source,false) for i,player in pairs(getVehicleOccupants(source)) do setControlState(souce,"enter_exit",true) --setTimer(respawnVehicle, 6000, 1, source) --------------------------------------------- x, y, z = getElementPosition(source) setTimer ( function() bag = createPickup( x-6, y, z, 3, 1550 ) setElementCollisionsEnabled( bag, false ) end, 4000, 1) -------------------------------------------- setTimer( destroyElement, 1000, 1, source) --setTimer( destroyElement, 50, 1, source) setTimer( sec, 6000, 0 ) end end end end addEventHandler("onVehicleDamage",getRootElement(),checkDamage)
  5. Hello Community, i do have a script which when someone spawn the vehicle it shows up on The debug, This is the code : function spawner ( sourceplayer, commandname, carN) if not isPedInVehicle ( sourceplayer )then local x, y, z = getElementPosition ( sourceplayer ) local rx , ry, rz = getElementRotation ( sourceplayer ) local location = getZoneName ( x, y, z ) local car = createVehicle ( 434, x, y, z, rx, ry, rz) setElementData( sourceplayer, "housing", car ) warpPedIntoVehicle ( sourceplayer, car ) setElementAlpha(car, 180) triggerClientEvent("enableCollisions",sourceplayer,car) setVehiclePlateText( car, 'housing' ) setVehicleHandling(car , "maxVelocity", 40) setVehicleLocked ( car, true ) setVehicleDamageProof(car, true) local vehicleName = getVehicleName (car) triggerClientEvent ( sourceplayer, "show", sourceplayer) -- outputChatBox ( "Your vehicle is being destroyed in few Seconds due to the Abuse", sourceplayer, 255, 255, 0 ) outputDebugString ( "Housing Admin: [" ..getPlayerName(sourceplayer).."] Has Spawned "..vehicleName.." At {" ..location.."}.") setTimer ( function() destroyElement (car) end, 25000, 1 ) else outputDebugString ( "Housing Admin: [" ..getPlayerName(sourceplayer).."] Has Tried the Housing command.") end end addCommandHandler ( "spawn", spawner ) the thing i want to create is to make a txt file code into this script which writes and saves every spawn the player did like the outputDebugString. Thanks.
  6. this is really awesome man, good job for real, for How long you been coding all of this ? good luck on the sale.
  7. You should define all of 3 skills into the weapon (poor, std , pro) . and most importantly you didn't call the resource on the script starting with this : addEventHandler ( "onResourceStart", getRootElement(), stats ) and you cant remove these 2 lines unless you won't be using them in other side to trigger them : addEvent("stats",true) addEventHandler ("stats", root, stats) You're welcome
  8. function stats() weaponList = { "ak-47" } for _,weapon in ipairs( weaponList ) do for _,skill in ipairs( { "poor", "std", "pro" } ) do setWeaponProperty( weapon, skill, "maximum_clip_ammo", 1) end end end addEvent("stats",true) addEventHandler ("stats", root, stats) addEventHandler ( "onResourceStart", getRootElement(), stats )
  9. I Get No Errors/warnings but it doesn't work when i leave the vehicle, anyways thanks for the help
  10. bad argument @'getElementData' [Expected element at argument 1, got nil]
  11. Loading script failed: housingspawn\spawner.lua:34: ')' expected near ',' do i have to add the vehicle identify name ? Removed The "local" from SetElementData at the function Out and Now it shows me : attempt to concatenate a boolean value
  12. Nope, both didn't work. neither the collision thing and the destroy vehicle stopped working at all. also setElementCollisionsEnabled(car, true) a can't work with Vehicles.
  13. Yes @ShayF i have already seen that but the thing i'm still stuck at the PlayerExitVehicle thing
  14. doesn't work at all.. i literally needed some help here.. a real help Thanks
  15. function colloff () local theVeh = getElementData( sourceplayer, "freecar" ) setElementCollidableWith(theVeh, sourceplayer, false) end addEvent( "test", true ) addEventHandler( "test", localPlayer, colloff ) This should work fine ? when i trigger it to server side ? bad argument @'setElementCollidableWith' [expected element at argument1, got boolean]
  16. I'm using the debugscript command everytime i log in. That's why i needed some help cause the debug was showing no Warnings/errors at all. Will try out what u just replied, thanks Since it's server side and setElementCollidableWith works with Client Only, do u have any idea how may i code it to client side so i can trigger it to server side, In other words, Shall i use the GetElementData on the funtcion of setElementCollidableWith (client side) !!
  17. Hello Community, i've been coding a very small Script which makes me a spawn a specific "Vehicle" with a command, It workd literally fine at first. Later on, i've tried to add this : setElementCollisionsEnabled(car, false) to the car which i spawn, but the thing is once i spawn the vehicle, it goes directly up into the Air like there is none of Gravity if you know i mean, here is the code : allowedTeams = { ["Staff"] = true,} function spawner ( sourceplayer, commandname) if allowedTeams[getTeamName(getPlayerTeam( sourceplayer))]then local x, y, z = getElementPosition ( sourceplayer ) local location = getZoneName ( x, y, z ) local car = createVehicle ( 445, x, y, z) warpPedIntoVehicle ( sourceplayer, car ) setElementCollisionsEnabled(car, false) setVehiclePlateText( car, 'housing' ) setVehicleHandling(car , "maxVelocity", 40) setVehicleLocked ( car, true ) setVehicleDamageProof(car, true) local vehicleName = getVehicleName (car) outputChatBox ( "Your vehicle is being destroyed in few Seconds due to the Abuse", sourceplayer, 255, 255, 0 ) outputDebugString ( "Housing Admin: [" ..getPlayerName(sourceplayer).."] Has Spawned "..vehicleName.." At {" ..location.."}.") setTimer ( function() destroyElement (car) end, 25000, 1 ) else setElementCollisionsEnabled(car, true) outputDebugString ( "Housing Admin: [" ..getPlayerName(sourceplayer).."] Has Tried the Housing command.") end end addCommandHandler ( "spawn", spawner ) function out ( sourceplayer ) if ( sourceplayer )then setTimer( destroyElement, 50, 1, sourceplayer) end end addEventHandler ( "onPlayerVehicleExit", getRootElement(), out ) One More thing, if you could help me with which the Destroying Vehicle thing cause every player who leaves his vehicle, it gets an instant Destroy as the function out, i just wanna make to the guy who spawned the vehicle Only. I would really appreciate your support, Thanks.
  18. Take a Look at this Please : https://wiki.multitheftauto.com/wiki/ToggleControl You might be using The ToggleControl function which has to be Client side.
  19. Hello MTA Community, i've made a script which Makes the Team "name" undamageable until they get a wanted level, i've tried it in many ways and i'm still having this error : ANTIDM/Server.lua:3: syntax error near 'end' Client Side : dmteam = { ["Emergency"] = true, } function antidm (Player) Player = getLocalPlayer() if dmteam[getTeamName(getPlayerTeam(Player))] and triggerServerEvent("Dm", Player, Player) then cancelEvent() end end addEventHandler("onClientPlayerDamage", getRootElement(), antidm) Server Side : function check(Player) (exports.SACGpolice:getWantedLevel(Player) == 0) end addEvent("Dm",true) addEventHandler("Dm", getRootElement(Player), check) Note : i've done this TriggerServerEvent, cause the "SACGpolice" is exportable with Server Side. Thank you.
  20. local friends = { ["Emergency"] = true, } function friendy () for index, theTeam in ipairs(friends) do if ( getTeamFriendlyFire ( theTeam ) == false ) then setTeamFriendlyFire ( theTeam, true ) end end end addEventHandler("onClientPlayerDamage", getRootElement(), friendy) Well, i wanted to restrict The Emergency team from getting Killed by each other for an exemple, The Scripts works fine without any Warnings/Errors But It's not running Correctly, there has to be a mistake. The Second Part : I've made a script in the past days experiencing The "setWeaponProperty" with some weapons such as M4/minigun Damage, i thought by deleting the script, the weapon damage should have been refreshed, but still NOT, so i'm asking for a little Help if someone can help me out to Get it back like every weapon used to be. Thank you.
  21. Yeap, thanks it worked.
×
×
  • Create New...