-
Posts
156 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Ayush Rathore
-
There is no such function make sure what you are typing
-
function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end else return false end end function payScript(player,cmd,other,amount) local name = getPlayerFromPartialName(name) local atg local rpm = getPlayerMoney(player) local err = {} if not (name and isElement(name)) then err[#err+1] = "Name not specified correctly." end if tonumber(amount) < 0 then err[#err+1] = "Amount can't be negative." end atg = tonumber(amount) if (rpm-atg) < 0 then err[#err+1] = "Given amount is more than yours." end if #err == 0 then setPlayerMoney(name,atg) outputChatBox("Given:"..atg.." to:"..getPlayerName(name),player,0,255,0) setPlayerMoney(player,(rpm-atg)) outputChatBox("Left:"..(rpm-atg).." to you.",player,0,255,0) else for i=1,#err do outputChatBox(err[i],player,0,255,0) end end end addCommandHandler( "pay", payScript ) If any one has copied it please update it with this
-
Try this function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end else return false end end function payScript(player,cmd,other,amount) local name = getPlayerFromPartialName(name) local atg local rpm = getPlayerMoney(player) local err = {} if not (name and isElement(name)) then err[1] = "Name not specified correctly." end if tonumber(amount) < 0 then err[2] = "Amount can't be negative." end atg = tonumber(amount) if (rpm-atg) < 0 then err[2] = "Given amount is more than yours." end if #err == 0 then setPlayerMoney(name,atg) outputChatBox("Given:"..atg.." to:"..getPlayerName(name),player,0,255,0) setPlayerMoney(player,(rpm-atg)) outputChatBox("Left:"..(rpm-atg).." to you.",player,0,255,0) else for i=1,#err do outputChatBox(err[1],player,0,255,0) end end end addCommandHandler( "pay", payScript )
-
This might work ---------------------------------------------------------------------------------------------------- --- TABLES --- ---------------------------------------------------------------------------------------------------- local antiSpamSave = { } local setting = { } ---------------------------------------------------------------------------------------------------- --- SETTINGS --- ---------------------------------------------------------------------------------------------------- -- Save Data Setting setting.position = not get("position") == "false" and toJSON(split(get("position"), ", ")) or false setting.rotation = tonumber(get("rotation")) or false setting.interior = tonumber(get("interior")) or false setting.dimension = tonumber(get("dimension")) or false setting.team = tostring(get("team")) or false setting.skin = tonumber(get("skin")) or false --setting.data = not get("elementData") == "false" and split(get("elementData"), ", ") or false -- Other Setting setting.loadOnStartResource = not get("loadOnStartResource") == "false" and true or false setting.saveCommand = not get("saveCommand") == "false" and true or false setting.saveTime = tonumber(get("rotation")) or false ---------------------------------------------------------------------------------------------------- --- CUSTOM EVENTS --- ---------------------------------------------------------------------------------------------------- addEvent("onAccountLoadData", true) addEventHandler("onAccountLoadData", root, function (account) local position = getAccountData(account, "position") or setting.position local rot = getAccountData(account, "rotation") or setting.rotation local int = getAccountData(account, "interior") or setting.interior local dim = getAccountData(account, "dimension") or setting.dimension local teamName = getAccountData(account, "team") or setting.team local skin = getAccountData(account, "skin") or setting.skin local health = getAccountData(account, "health") local armor = getAccountData(account, "armor") local money = getAccountData(account, "money") local wanted = getAccountData(account, "wantedlevel") local clothes = getAccountData(account, "clothes") local stats = getAccountData(account, "stats") local weapons = getAccountData(account, "weapons") --local datas = getAccountData(account, "datas") local x, y, z = unpack(fromJSON(position) or {nil}) local team = teamName and getTeamFromName(teamName) or nil if position then spawnPlayer(source, x, y, z, rot, skin, int, dim, team) end if health then setElementHealth(source, health) end if armor then setPedArmor(source, armor) end if money then setPlayerMoney(source, money) end if wanted then setPlayerWantedLevel(source, wanted) end if (clothes) then removeAllPedClothes(source) for _, cloth in pairs(fromJSON(clothes)) do local typo, texture, model = unpack(cloth) addPedClothes(source, typo, texture, model) end end if (stats) then for stat, value in pairs(fromJSON(stats)) do setPedStat(source, stat, value) end end if (weapons) and not (isPedDead(source)) then takeAllWeapons(source) for weapon, ammo in pairs(fromJSON(weapons)) do giveWeapon(source, weapon, ammo, true) end end ... ... ...
-
you are welcome rays mta
-
vehicleSpawns = { -- {vehicleid,x,y,z,slots,maxArmor}, --Picador {600,-2045.8000488281,1838.1999511719,44.799999237061,25,1000}, {600,669.40002441406,-1441.0999755859,14.89999961853,25,1000}, {600,1061.5,2161.1999511719,10.699999809265,25,1000}, {600,2160.107421875,-2326.259765625,13.554685592651,25,1000}, --Turismo {451,1888.6999511719,2019.6999511719,7.5,25,1000}, {451,872.5,-605.90002441406,18.299999237061,20,1000}, --Admiral {445,840,-1273.5,13.60000038147,42,1000}, {445,1566.0999755859,1173.3000488281,10.60000038147,42,1000}, {445,-2078.3999023438,902.09997558594,63.900001525879,42,1000}, --Cheetah {415,210.10000610352,-230.89999389648,1.6000000238419,38,1000}, {415,-1982.3000488281,-2391,30.5,38,1000}, --Sabre {475,-1424.0999755859,-1480.4000244141,101.5,20,1000}, {475,1487.6999511719,2773.3000488281,10.699999809265,20,1000}, --Uranus {558,2057.6999511719,2432.6000976563,44.900001525879,35,1000}, {558,-544,-500.89999389648,25.200000762939,35,1000}, {558,-2225.1999511719,-378.20001220703,35.099998474121,35,1000}, --Landstalker {400,-2125.6999511719,223.80000305176,35.5,40,1000}, {400,866.40002441406,2714.8000488281,20.700000762939,40,1000}, {400,2164.8999023438,-107.69999694824,3,40,1000}, --Buffalo {402,2791.8999023438,-1448.5999755859,31.799999237061,25,1000}, {402,-1129.3000488281,2263.5,95.099998474121,25,1000}, --ZR-350 {477,5.0999999046326,-2518.3999023438,36.400001525879,27,1000}, --Bravura {401,1674.5999755859,-2085.8999023438,13.300000190735,30,1000}, {401,2553.8999023438,2304.8999023438,3.2000000476837,30,1000}, {401,-2628,2268.8000488281,7.9000000953674,30,1000}, --Sultan {560,-2556.1999511719,980.90002441406,78.199996948242,18,1000}, {560,-98,-1020.5,14.300000190735,18,1000}, {560,1418.5,2023.8000488281,10.699999809265,18,1000}, --Infernus {411,754.59997558594,379,23.200000762939,45,1000}, {411,-1329.9000244141,689.59997558594,14.60000038147,45,1000}, --Pony {413,-1972.1999511719,1227.3000488281,31.5,62,1000}, {413,-643.5,1446.8000488281,13.5,62,1000}, {413,927.29998779297,-1073.1999511719,24.200000762939,62,1000}, --Ambulance {416,1600.8000488281,1847.6999511719,11.10000038147,45,1000}, {416,-331.60000610352,1036.1999511719,20,45,1000}, {416,-2658.1999511719,623.59997558594,14.699999809265,45,1000}, {416,1138.6999511719,-1323.3000488281,13.89999961853,45,1000}, {416,2000.9000244141,-1410.8000488281,17.200000762939,45,1000}, --Bobcat {422,2078.8000488281,-1570.5,13.5,35,1000}, {422,2576.6999511719,796.29998779297,11,35,1000}, {422,-1307.3000488281,2502.1000976563,87.099998474121,35,1000}, {422,-2544.6999511719,1217.9000244141,37.5,35,1000}, --BF Injeciton {424,-2491.6000976563,-680.90002441406,139.5,15,1000}, {424,-473,-178.60000610352,78.400001525879,15,1000}, --Enforcer {427,382.20001220703,2541.8999023438,16.200000762939,60,1000}, {427,-1979.4000244141,441.20001220703,26.799999237061,60,1000}, {427,1361.3000488281,-1715.3000488281,8.1999998092651,60,1000}, --Banshee {429,1655.0999755859,-1837.5999755859,13.5,25,1000}, {429,2095.5,2159.3000488281,10.800000190735,25,1000}, --Bus {431,2851.3999023438,1352.6999511719,11,34,1000}, {431,1241.5999755859,-1818.8000488281,13.60000038147,34,1000}, --Barrack {433,2767.8999023438,-2551.8999023438,14.300000190735,200,1000}, {433,151,1874.3000488281,18.60000038147,200,1000}, {433,-1546.5,367.89999389648,7.8000001907349,200,1000}, --Blooding Danger {504,-2524.3999023438,311.70001220703,27.60000038147,25,1000}, {504,1078.5,1355.8000488281,10.699999809265,25,1000}, {504,889.40002441406,-24.5,63.099998474121,25,1000}, --PCJ-600 {461,1298.8000488281,186.80000305176,20.10000038147,10,1000}, {461,-281.10000610352,2688.1999511719,62.299999237061,10,1000}, --Freeway {463,1484.5,2665.3999023438,10.5,10,1000}, {463,-597.20001220703,-1073.4000244141,23.200000762939,10,1000}, --Shancez {468,-398.10000610352,-1436.9000244141,25.39999961853,10,1000}, {468,-1416.0999755859,-608.90002441406,-302.20001220703,10,1000}, {468,601.5,1235.6999511719,11.39999961853,10,1000}, --Patriot {470,195.5,1427,10.60000038147,28,1000}, {470,2574.5,2791,10.800000190735,28,1000}, {470,1133.0999755859,-2085,69.300003051758,28,1000}, {470,-2403.8000488281,-2182.3000488281,33.299999237061,28,1000}, --Quad Bike {471,-1646.9000244141,-2232.1000976563,29,10,1000}, {471,816.40002441406,823.90002441406,10.300000190735,10,1000}, --Sandking {495,1424.0999755859,1051,11.39999961853,45,1000}, {495,394.5,-1888.5999755859,2.4000000953674,45,1000}, {495,-664.70001220703,936.90002441406,12.699999809265,45,1000}, --Mesa {500,1886.0999755859,1178.5999755859,10.89999961853,25,1000}, {500,-1506.8000488281,1975.6999511719,48.599998474121,25,1000}, {500,-1561.8000488281,-2716.8000488281,48.799999237061,25,1000}, --NRG-500 {522,-1706.0999755859,24.5,3.2000000476837,10,1000}, --Bandito {568,-2322.1000976563,5.1999998092651,35.099998474121,25,1000}, {568,-1041.4000244141,1553.6999511719,33.200000762939,15,1000}, --Police Car LSPD {596,1602.1999511719,-1608.1999511719,13.39999961853,31,1000}, {596,1820.5,-1106.1999511719,23.89999961853,31,1000}, --Police Car SFPD {597,2264,2431.1999511719,3.0999999046326,33,1000}, {597,2427.3000488281,1951.5,5.9000000953674,33,1000}, --SWAT Truck ( yg bisa nyemprot ) {601,1369.9000244141,-2453.1000976563,13.300000190735,46,1000}, --Maverick {487,2601.3000488281,-2340.3000488281,14.300000190735,30,1000}, {487,2293.6000976563,-641.5,134.19999694824,30,1000}, {487,2618.8000488281,2720.5,37.200000762939,30,1000}, --Police Maverick {497,2093.3999023438,2414.3000488281,74.599998474121,34,1000}, {497,-2244.3000488281,-1723.9000244141,9480.39999389648,34,1000}, {497,1544.5999755859,-1352.9000244141,329.5,34,1000}, --Bullet {541,1422.9000244141,-1305.1999511719,13.300000190735,34,1000}, {541,-1782,1311.9000244141,50.200000762939,34,1000}, --Ragina {579,-2206.8999023438,1050,80.099998474121,34,1000}, {579,2491.6000976563,2357.3999023438,4.3000001907349,34,1000}, {579,2366.3999023438,320.5,23.200000762939,34,1000}, --Rhino {432,297.51400756836,1822.0157470703,17.640625,100,1000}, --Hunter {425,203.81123352051,1932.2449951172,23.2421875,300,1000}, } vehicleAddonsInfo = { {400,4,1,1}, {541,4,1,1}, {451,4,1,1}, {415,4,1,1}, {475,4,1,1}, {445,4,1,1}, {600,4,1,1}, {604,4,1,1}, {558,4,1,1}, {402,4,1,1}, {477,4,1,1}, {429,4,1,1}, {560,4,1,1}, {401,4,1,1}, {411,4,1,1}, {413,4,1,1}, {416,4,1,1}, {422,4,1,1}, {424,4,1,1}, {427,4,2,1}, {431,6,1,1}, {433,6,1,1}, {461,2,1,1}, {463,2,1,1}, {468,2,1,1}, {470,4,1,1}, {471,4,1,1}, {487,0,1,1}, {495,4,1,1}, {497,0,1,1}, {500,4,1,1}, {522,2,1,1}, {542,4,1,1}, {568,4,1,1}, {596,4,1,1}, {597,4,1,1}, {601,6,2,1}, {504,4,1,1}, {579,4,1,1}, {432,6,2,1}, {425,0,2,1}, } vehicleFuelTable = { {400,40}, {541,40}, {451,80}, {415,70}, {475,60}, {445,40}, {600,40}, {604,40}, {558,40}, {477,40}, {429,40}, {560,40}, {401,40}, {402,40}, {411,40}, {413,50}, {416,60}, {422,30}, {424,30}, {427,60}, {431,70}, {433,90}, {461,20}, {463,20}, {468,20}, {470,60}, {471,20}, {487,50}, {495,50}, {497,50}, {500,40}, {522,30}, {542,40}, {568,30}, {596,50}, {597,50}, {601,100}, {504,100}, {579,50}, {432,100}, {425,100}, } vehicleFuelInfo = { {400,0.25}, {541,0.25}, {451,0.25}, {415,0.25}, {475,0.25}, {445,0.25}, {600,0.25}, {604,0.25}, {558,0.25}, {402,0.35}, {477,0.35}, {429,0.35}, {560,0.35}, {401,0.35}, {411,0.5}, {413,0.25}, {416,0.25}, {422,0.35}, {424,0.35}, {427,0.45}, {431,0.5}, {433,0.5}, {461,0.35}, {463,0.35}, {468,0.35}, {470,0.45}, {471,0.25}, {487,0.35}, {495,0.45}, {497,0.35}, {500,0.35}, {522,0.25}, {542,0.35}, {568,0.25}, {596,0.25}, {597,0.25}, {601,0.5}, {504,0.25}, {579,0.25}, {432,0.100}, {425,0.100}, } function getVehicleAddonInfos (id) for i,veh in ipairs(vehicleAddonsInfo) do if veh[1] == id then return veh[2],veh[3],veh[4], veh[5] end end end function getVehicleMaxFuel(loot) local modelID = getElementModel(getElementData(loot,"parent")) for i,vehicle in ipairs(vehicleFuelTable) do if modelID == vehicle[1] then return vehicle[2] end end return false end function getVehicleFuelRemove (id,col) for i,veh in ipairs(vehicleFuelInfo) do if veh[1] == id then if not getElementData(col,"Parts_inVehicle") == 1 then return veh[2]*1.3 end return veh[2] end end end local vehicleName = { [597] = "Dodge Police (1974)", [601] = "B-T-R", [596] = "Chevrolet Police", [568] = "Batman Tumbler", [542] = "Dodge Challenger (1970)", [522] = "Yamaha R15", [497] = "FBI Maverick", [495] = "Ford Explorer", [487] = "Castro Maverick", [471] = "Quadbike", [470] = "HUMMER", [463] = "Harly Devidson", [461] = "URAL Motorcycle", [468] = "Sanchez", [431] = "Coach", [427] = "Enforcer Raccoon City Police", [424] = "UAZ (Prototype)", [500] = "Jeep", [422] = "Ford", [416] = "Ambulance", [411] = "Ford Mustang", [401] = "Subaru", [429] = "Porsche 911 Carrera RSR", [560] = "Mitsubishi Lancer", [477] = "Mazda RX-7", [402] = "Nissan GTR r35", [558] = "Audi Quattro Rally", [604] = "Toyota Chaser", [600] = "WHF", [504] = "VAZ-2015 Gladiator", [445] = "OLD-Dodge", [475] = "Chevrolet Camaro (1968)", [415] = "Lamborghini Gallardo", [451] = "Maserati Gran Turismo", [541] = "Ford Mustang GT-R", [579] = "Chevrolet Suburban", [400] = "Mitsubishi Pajero", [433] = "KRAZ-255", [413] = "Pony", [432] = "M26 Pershing Tiger", [425] = "MI 24D Hind Woodland", } function returnNewNameVehicle (vehicle) if isElement(vehicle) and getElementType(vehicle) == "vehicle" then if vehicleName[getElementModel(vehicle)] then return vehicleName[getElementModel(vehicle)] else return "Unknown Vehicle" end end end try this
-
[HELP] Gate system with same command for open/close.
Ayush Rathore replied to RobbyAJM's topic in Scripting
You're welcome -
---------------------------------------------------------------------------------------------------- --- TABLES --- ---------------------------------------------------------------------------------------------------- local antiSpamSave = { } local setting = { } ---------------------------------------------------------------------------------------------------- --- SETTINGS --- ---------------------------------------------------------------------------------------------------- -- Save Data Setting setting.position = not get("position") == "false" and toJSON(split(get("position"), ", ")) or false setting.rotation = tonumber(get("rotation")) or false setting.interior = tonumber(get("interior")) or false setting.dimension = tonumber(get("dimension")) or false setting.team = tostring(get("team")) or false setting.skin = tonumber(get("skin")) or false --setting.data = not get("elementData") == "false" and split(get("elementData"), ", ") or false -- Other Setting setting.loadOnStartResource = not get("loadOnStartResource") == "false" and true or false setting.saveCommand = not get("saveCommand") == "false" and true or false setting.saveTime = tonumber(get("rotation")) or false ---------------------------------------------------------------------------------------------------- --- CUSTOM EVENTS --- ---------------------------------------------------------------------------------------------------- addEvent("onAccountLoadData", true) addEventHandler("onAccountLoadData", root, function (account) local position = getAccountData(account, "position") or setting.position local rot = getAccountData(account, "rotation") or setting.rotation local int = getAccountData(account, "interior") or setting.interior local dim = getAccountData(account, "dimension") or setting.dimension local teamName = getAccountData(account, "team") or setting.team local skin = getAccountData(account, "skin") or setting.skin local health = getAccountData(account, "health") local armor = getAccountData(account, "armor") local money = getAccountData(account, "money") local wanted = getAccountData(account, "wantedlevel") local clothes = getAccountData(account, "clothes") local stats = getAccountData(account, "stats") local weapons = getAccountData(account, "weapons") --local datas = getAccountData(account, "datas") local x, y, z = unpack(fromJSON(position) or {nil}) local team = teamName and getTeamFromName(teamName) or nil if position then spawnPlayer(source, x, y, z, rot, skin, int, dim, team) end if health then setElementHealth(source, health) end if armor then setPedArmor(source, armor) end if money then setPlayerMoney(source, money) end if wanted then setPlayerWantedLevel(source, wanted) end if (clothes) then removeAllPedClothes(source) for _, clothes in pairs(fromJSON(clothes)) do local typo, texture, model = unpack(clothes) addPedClothes(source, typo, texture, model) end end if (stats) then for stat, value in pairs(fromJSON(stats)) do setPedStat(source, stat, value) end end if (weapons) and not (isPedDead(source)) then takeAllWeapons(source) for weapon, ammo in pairs(fromJSON(weapons)) do giveWeapon(source, weapon, ammo, true) end end ... ... ... try this
-
function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function payScript(player,cmd,other,amount) if not other or not amount then outputChatBox( "#00BAFF[Play] #FFffFFHelyes használat: #0088FF/pay <név> <összeg>!", player, 0, 255, 255, true ) else if tonumber(amount) < 0 then outputChatBox( "amount is in negative", player, 0, 255, 255, true ) return end local money = getPlayerMoney(getPlayerFromPartialName(other)) local otherPlayer = getPlayerFromPartialName(other) if otherPlayer and otherPlayer ~= player then if (money - amount) < 0 then outputChatBox("#00BAFF[Play] #FFffFFNincs elegendo #0088FFpénzed!",player,0,255,255, true) else setPlayerMoney( otherPlayer, getPlayerMoney(otherPlayer) + amount ) outputChatBox( "#00BAFF[Play] #FFffFFKaptál #0088FF"..amount.."Ft-ot #FFffFFtole: #0088FF".. getPlayerName(player).."!",otherPlayer,0,255,255,true ) setPlayerMoney( player, money - amount ) outputChatBox( "#00bAFF[Play] #0088FF"..amount.."Ft-ot #FFffFFküldtél neki: #0088FF"..getPlayerName(otherPlayer).."!",player,0,255,255, true ) end else outputChatBox( "Could not find player ".. other, player, 0, 255, 255, true ) end end end addCommandHandler( "pay", payScript ) use this and change this line to your need outputChatBox( "amount is in negative", player, 0, 255, 255, true )
-
good login panel
-
Client function showStats() mainWn = guiCreateWindow(0.30, 0.15, 0.42, 0.69, "Las Barrancas Garage - View Orders", true) guiWindowSetMovable(mainWn, false) guiWindowSetSizable(mainWn, false) gridList = guiCreateGridList(0.02, 0.05, 0.96, 0.83, true, mainWn) guiGridListAddColumn(gridList, "ID", 0.2) guiGridListAddColumn(gridList, "Name", 0.2) guiGridListAddColumn(gridList, "Vehicle", 0.2) guiGridListAddColumn(gridList, "Description", 0.2) btnClose = guiCreateButton(0.77, 0.90, 0.21, 0.08, "Close", true, mainWn) triggerServerEvent("getListData",getLocalPlayer()) end function setData(tab) for i=1,#tab do local row = guiGridListAddRow ( gridList ) guiGridListSetItemText ( gridList, row, 1, tab[i]['id'] , false, false ) guiGridListSetItemText ( gridList, row, 2, tab[i]['name'] , false, false ) guiGridListSetItemText ( gridList, row, 3, tab[i]['vehicle'] , false, false ) guiGridListSetItemText ( gridList, row, 4, tab[i]['desc'] , false, false ) end end addEvent("setListData",true) addEventHandler("setListData",root,setData) Server function getData() local result = {} local query = dbQuery("select * from stats") result = dbPoll(query,-1) dbFree(query) if #result > 0 then triggerClientEvent(client,"setListData",client,result) else triggerClientEvent(client,"setListData",client,{}) end end addEvent("getListData",true) addEventHandler("getListData",root,getData) This might fulfill your needs
-
Object Movement Generator Roller Coaster Generator Editor Loop Generator jump here : https://wiki.multitheftauto.com/wiki/Resource:Editor/Plugins
-
great post . well u can can use map editor for many movement scripts like gates and object movement. many plugins are also present helping you to fulfill your needs
-
iselementwithinmarker [help] isElementWithinMarker
Ayush Rathore replied to raynner's topic in Scripting
wait i will surely give you an idea -
[HELP] Gate system with same command for open/close.
Ayush Rathore replied to RobbyAJM's topic in Scripting
If you are newbie open map editor and then create object and then place it where you want at the first place then double click the object to open a window in which positions and rotation is given note that down and now move that object to the position you want it to be moved and again note the positions and rotation. Now in this code of NTx3 local gate = createObject ( ObjID, Pos_X, Pos_Y, Pos_Z, Rot_X, Rot_Y, Rot_Z ) local state = 0 function move() if state == 0 then moveObject ( gate, Time, New_X, New_Y, New_Z) state = 1 elseif state == 1 then moveObject ( gate, Time,Old_X, Old_Y, Old_Z) state = 0 end end addCommandHandler("gate", move ) remove object id with your object id and then place posx,y,z and rotx,y,z you noted first time to the first line of code then where New_X, New_Y, New_Z is written place the posx,y,z you noted second time and then where Old_X,Old_X,Old_X is written place the pos,x,y,z which you placed in line 1 Good Luck! -
iselementwithinmarker [help] isElementWithinMarker
Ayush Rathore replied to raynner's topic in Scripting
the only solution to your problem is attaching object to forklift as gta physics engine do not capture the event when forklift picks up an oject -
use slothbot resource https://community.multitheftauto.com/index.php?p=resources&s=details&id=672 this would surely help you
-
done
-
make all of them helmet zombie
-
give whole code
-
iselementwithinmarker [help] isElementWithinMarker
Ayush Rathore replied to raynner's topic in Scripting
TbPlEmp = {} function StartJobEmpilhadeiraForPlayer(source) --> verifica se não há uma tabela e cria uma no nome do player ! if not(TbPlEmp[source]) then TbPlEmp[source] = {} end --> Verifica se o player tem um veículo e destroy se houver ! if TbPlEmp[source]["veh"] then destroyElement(TbPlEmp[source]["veh"]) TbPlEmp[source]["veh"] = nil end TbPlEmp[source]["veh"] = createVehicle(530,2799,-2401,13,0,0,93) warpPedIntoVehicle(source,TbPlEmp[source]["veh"]) TbPlEmp[source]["box"] = createObject(1558,2779,-2401,13.3,0,0,0,false) TbPlEmp[source]["marker"] = createMarker(2724,-2401,12,"cylinder",3,0,255,150,255,source) end addCommandHandler("cc",function() StartJobEmpilhadeiraForPlayer(getRandomPlayer()) end) function PlayerHitInMarkerLeaveBox(hitElement) if (isElement(hitElement) and getElementType(hitElement) == "player") then if TbPlEmp[hitElement] and source == TbPlEmp[hitElement]["marker"] then if TbPlEmp[hitElement]["box"] and isElement(TbPlEmp[hitElement]["box"]) then local x,y,z = getElementPosition(TbPlEmp[hitElement]["box"]) local x1,y1,z1 = getElementPosition(source) outputChatBox(getDistanceBetweenPoints3D ( x,y,z,x1,y1,z1 )) if getDistanceBetweenPoints3D ( x,y,z,x1,y1,z1 ) < 56 then outputChatBox("#FFAA00||#00FF00 ✔ #FFAA00||#00FF00 ok !",hitElement,255,255,255,true) else outputChatBox("#FFAA00||#FF0000 ✘ #FFAA00||#FF0000 error !",hitElement,255,255,255,true) end end end end end addEventHandler("onMarkerHit",root,PlayerHitInMarkerLeaveBox) this might work.When in-game type /cc to check change the positions of object as per your need -
this might help you
-
How do I change resource responsible for an element?
Ayush Rathore replied to Adolf_T's topic in Scripting
well you should combine the two resources if it don't make your work difficult- 2 replies
-
- resource
- responsible resources
-
(and 1 more)
Tagged with:
-
try with only setting velocity and btw you used car instead of maverick,and i think it is difficult to change helicopter config use Hedit to check. Link : https://community.multitheftauto.com/index.php?p=resources&s=details&id=3716 : function handlingTest() local me = getPlayerFromName("Angelo") local maverick = getPedOccupiedVehicle(me) setVehicleHandling(maverick, "maxVelocity", 500) setVehicleHandling(maverick, "engineAcceleration", 50) end addCommandHandler("yolo", handlingTest)
-
Why using two checks if only one can fulfill the need whether client or server use this for Client-Sided function mecanico ( thePlayer ) local car= getPedOccupiedVehicle ( thePlayer ) if car then outputChatBox("reparaste el auto correctamente", 255, 255, 0) fixVehicle( car ) else outputChatBox("No estas en el vehiculo para reparar el coche",255, 0, 0) end end addEventHandler("onPlayerVehicleEnter", getRootElement(), mecanico) addCommandHandler("reparar", mecanico) for server-sided function mecanico ( thePlayer ) local car= getPedOccupiedVehicle ( thePlayer ) if car then outputChatBox("reparaste el auto correctamente",thePlayer, 255, 255, 0) fixVehicle( car ) else outputChatBox("No estas en el vehiculo para reparar el coche",thePlayer,255, 0, 0) end end addEventHandler("onPlayerVehicleEnter", getRootElement(), mecanico) addCommandHandler("reparar", mecanico)