-
Posts
151 -
Joined
-
Last visited
Everything posted by xMKHx
-
addEventHandler("onResourceStart", resourceRoot, function() -- Replace the car model (ID 411 is the Infernus model, you can change it) local modelID = 411 -- Model ID to replace (e.g., 411 for Infernus) local dffFile = "path/to/your/car.dff" -- Path to the DFF file local txdFile = "path/to/your/car.txd" -- Path to the TXD file -- Load the TXD file local txd = engineImportTXD(txdFile) engineReplaceModel(txd, modelID) -- Load the DFF file local dff = engineLoadDFF(dffFile, modelID) engineReplaceModel(dff, modelID) end )
- 1 reply
-
- lua
- scripting help
-
(and 1 more)
Tagged with:
-
I've used DeepSeek to fix your code, there is this result: -- Define the bomb function function bomb(player) local car = getPedOccupiedVehicle(player) if getElementModel(car) == 520 then outputChatBox("Сброс бомб", player) local x, y, z = getElementPosition(player) setTimer(AirstrikeThrow, 51, 1, player, x, y, z) end end -- Bind the "3" key to the bomb function for each player when they spawn or enter the vehicle function bindBombKey(player) bindKey(player, "3", "down", bomb) end -- Add event handlers to bind the key when the player spawns or enters a vehicle addEventHandler("onPlayerJoin", root, bindBombKey) addEventHandler("onVehicleEnter", root, function(player) bindBombKey(player) end) -- Define the AirstrikeThrow function function AirstrikeThrow(player, x, y, z) triggerClientEvent(getRootElement(), "AirstrikeThrowDo", getRootElement(), player) end
-
Client-Side: -- Function to check ammo and reload function checkAmmoAndReload() -- Get the player's current weapon local weapon = getPedWeapon(localPlayer) -- Get the ammo in the player's clip local ammoInClip = getPedAmmoInClip(localPlayer) -- Get the total ammo the player has for the current weapon local totalAmmo = getPedTotalAmmo(localPlayer) -- If the clip is empty but the player has more ammo, reload the weapon if ammoInClip == 0 and totalAmmo > 0 then triggerServerEvent("onPlayerReloadWeapon", localPlayer) end end -- Event handler for when the player fires a weapon addEventHandler("onClientPlayerWeaponFire", localPlayer, checkAmmoAndReload) Server-Side: -- Event to handle weapon reloading addEvent("onPlayerReloadWeapon", true) addEventHandler("onPlayerReloadWeapon", root, function() -- Get the player's current weapon local weapon = getPedWeapon(source) -- Reload the weapon setPedWeaponSlot(source, getPedWeaponSlot(source)) end) I don't know if it's working, I just asked DeepSeek and this is the result.. Have fun
-
Hello, can you please post your code.
-
Check if the problem in the host or your resources
-
Client and server sides and meta.xml
-
Post your code and meta please
-
I didn't try to code at first But I made some change, I think it will work now I've changed the col location to test, you can change it later Try this one server side greenzone = createColRectangle ( 1400.2144775391,1425.1593017578, 100, 100 ) greenzoneradar = createRadarArea ( 1400.2144775391,1425.1593017578, 100, 100, 255, 255, 0, 150 ) function Col_Enter ( thePlayer, matchingDimension ) if getElementType ( thePlayer ) == "player" then setElementData(thePlayer, "isInGreenZone", true) setRadarAreaFlashing ( greenzoneradar, true ) setTimer(giveMoneyToPlayers, 1000, 0, thePlayer) outputChatBox( "#FFFFFF* #00FF00You've entered the money zone!", thePlayer, 255, 255, 109, true ) end end addEventHandler ( "onColShapeHit", greenzone, Col_Enter ) function Col_Exit ( thePlayer, matchingDimension ) if getElementType ( thePlayer ) == "player" then setElementData(thePlayer, "isInGreenZone", false) setRadarAreaFlashing ( greenzoneradar, false ) outputChatBox ( "#FFFFFF* #FF0000You've left the money zone!", playerSource, 255, 255, 109, true ) end end addEventHandler ( "onColShapeLeave", greenzone, Col_Exit ) function giveMoneyToPlayers (thePlayer) if getElementData(thePlayer, "isInGreenZone") == false then return false end givePlayerMoney(thePlayer, 5) end I've re-checked the code and found an issue Try this version I hope it helps you greenzone = createColRectangle ( 1400.2144775391,1425.1593017578, 100, 100 ) greenzoneradar = createRadarArea ( 1400.2144775391,1425.1593017578, 100, 100, 255, 255, 0, 150 ) function Col_Enter ( thePlayer, matchingDimension ) if getElementType ( thePlayer ) == "player" then setElementData(thePlayer, "isInGreenZone", true) setRadarAreaFlashing ( greenzoneradar, true ) outputChatBox( "#FFFFFF* #00FF00You've entered the money zone!", thePlayer, 255, 255, 109, true ) end end addEventHandler ( "onColShapeHit", greenzone, Col_Enter ) function Col_Exit ( thePlayer, matchingDimension ) if getElementType ( thePlayer ) == "player" then setElementData(thePlayer, "isInGreenZone", false) setRadarAreaFlashing ( greenzoneradar, false ) outputChatBox ( "#FFFFFF* #FF0000You've left the money zone!", playerSource, 255, 255, 109, true ) resetTimer(timer) end end addEventHandler ( "onColShapeLeave", greenzone, Col_Exit ) timer = setTimer(function(thePlayer) for i, v in ipairs(getElementsByType("player")) do if getElementData(v, "isInGreenZone") == false then return false end givePlayerMoney(v, 5) end end ,1000, 0, thePlayer)
-
Try this local greenzone = createColRectangle ( 1995.224609375, 1516.697265625, 11, 45 ) local greenzoneradar = createRadarArea ( 1993.91796875, 1567.671875, 50, -100, 255, 255, 0, 150 ) function Col_Enter ( thePlayer, matchingDimension ) if getElementType ( thePlayer ) == "player" then setElementData(thePlayer, "isInGreenZone", true) setRadarAreaFlashing ( greenzoneradar, true ) outputChatBox( "#FFFFFF* #00FF00You've entered the money zone!", thePlayer, 255, 255, 109, true ) end end addEventHandler ( "onColShapeHit", greenzone, Col_Enter ) function Col_Exit ( thePlayer, matchingDimension ) if getElementType ( thePlayer ) == "player" then setElementData(thePlayer, "isInGreenZone", false) setRadarAreaFlashing ( greenzoneradar, false ) outputChatBox ( "#FFFFFF* #FF0000You've left the money zone!", playerSource, 255, 255, 109, true ) end end addEventHandler ( "onColShapeLeave", greenzone, Col_Exit ) setTimer(function() for i,v in ipairs(getElementsByType("player")) do if getElementData(v, "isInGreenZone") == false then return false end givePlayerMoney(v, 5) end end, 1000, 1)
-
There is a lot of examples on wiki https://wiki.multitheftauto.com/wiki/AddDebugHook
-
You can search for free php inventory templates on internet and use mysql to manage data I made a search and I've found this https://www.sourcecodester.com/php/15419/simple-inventory-management-system-phpoop-free-source-code.html Its just an exmple but you have to make your own efforts
-
What do you exactly want to do ?
-
You may use a glue system Try mine local glues = {} function glue (plr, cmd) local veh = getPedContactElement(plr) if (getElementData(plr, "glue") == false) then -- Boolean again >_< if isElement(veh) and (getElementType(veh) == "vehicle") then local px, py, pz = getElementPosition(plr) local vx, vy, vz = getElementPosition(veh) local sx = px - vx local sy = py - vy local sz = pz - vz local rotpX = 0 local rotpY = 0 local rotpZ = getElementRotation(plr) local rotvX,rotvY,rotvZ = getVehicleRotation(veh) local t = math.rad(rotvX) local p = math.rad(rotvY) local f = math.rad(rotvZ) local ct = math.cos(t) local st = math.sin(t) local cp = math.cos(p) local sp = math.sin(p) local cf = math.cos(f) local sf = math.sin(f) local z = ct*cp*sz + (sf*st*cp + cf*sp)*sx + (-cf*st*cp + sf*sp)*sy local x = -ct*sp*sz + (-sf*st*sp + cf*cp)*sx + (cf*st*sp + sf*cp)*sy local y = st*sz - sf*ct*sx + cf*ct*sy local rotX = rotpX - rotvX local rotY = rotpY - rotvY local rotZ = rotpZ - rotvZ attachElements(plr, veh, x,y,z, rotX, rotY, rotZ) setElementData(plr, "glue", true) glues[plr] = veh end else if (isElement(glues[plr])) then detachElements(plr, glues[plr]) setElementData(plr, "glue", false) end end end addCommandHandler("glue", glue)
-
You can try this addCommandHandler( "brake", function ( thePlayer ) local theVehicle = getPedOccupiedVehicle( thePlayer ) if ( theVehicle ) then if ( isVehicleDamageProof( theVehicle ) ) then outputChatBox("Your vehicle is no longer damageproof!", thePlayer, 0, 255, 0) setVehicleDamageProof( theVehicle, false ) else outputChatBox("Your vehicle is now damageproof!", thePlayer, 0, 255, 0) setVehicleDamageProof( theVehicle, true ) end end end )
-
You can use setElementData For Example: function changeFreq (freq) if getElementData(source, "freq") == freq then return outputChatBox("You're already on "..freq.." frequency !", source, 255, 0, 0) end setElementData(source, "freq", freq) outputChatBox("You are now on "..freq.." frequency.", source, 0, 255, 0) end addCommandHandler("freq", changeFreq) function freqChat(plr, command, ...) if getElementData(plr, "freq") == false then return outputChatBox("Get a frequency first by using /freq <freqNumber>, For example /freq 3", plr, 255, 0, 0) end local freq = "( "..getElementData(plr, "freq").." )" local message = table.concat({...}, " ") local fullMessage = freq.." "..getPlayerName(plr)..": "..message:gsub("#%x%x%x%x%x%x", "") for i, v in ipairs(getElementsByType("player")) do if (getElementData(v, "freq") == getElementData(plr, "freq")) then outputChatBox(fullMessage, v, 255, 255, 255, true) end end end addCommandHandler("fc", freqChat) Note: I didn't test the code
-
LOT_NUM_LIMIT = 10 -- What is the higher lottery number .
-
Hello Community, Hello Legends, How you doing, I hope you're all alright. Well am gonna directly talk hh I've been playing MTA for 10 years since 2010 to 2020 and like most of you we've started like newbies then we upgrade ourselves by the time. As you know most of ppl are focusing on FiveM, no comparison here, quality, cars models and reality..etc. Well I had a server before, I was having fun, we all grown up with MTA and we all have memories, we've made a lot of friends, we've got virtual relations and some ppl got a real one. Well as I can see there's nothing new in MTA, I've spent a lot of time playing and scripting, I made new graphic mods to make the game enjoyable but no results, What I would say that day by day this game is dying, We may have to support the community to improve the game performance, Some ads may help too. Am a lover and a supporter, I would like to get back but work and responsibilities took all ma'time so A message to the community admins, please survive the game and thanks. - Best regards
-
Seriously you're selling this simple script for $7 I'll make it for free if someone requested !
-
createObject createColRectangle onColShapeHit setTrainSpeed
-
You can take a look on DGS, Actually am using it in my server
-
About the community: UDC is a project which has been developed since probably 3 year. It's a CnR/RPG/RP project, in this server we're trying to make things as much realistic as we can, we try to give the player the best RP experience in a RPG/CnR server. We can say this server is based on CIT (Community of Integrity and Transparency) but we got our unique ideas and code. Our goal is the make a completely enjoyable atmosphere for our players to enjoy and not get fed up. Nevertheless, we won't hide the truth that we got some scripts from MTA community (not more that 3 tho). Objectives: Reach a decent amount of players. Make realistic scripts and improve the gameplay. Make this community to the top. Create a funny and enjoyable atmosphere for the players. Features: Login panel: An advanced UI and simple interface to make it easier for the players. Vehicles System: An advanced and Realistic vehicles system that hasn't been used in any other servers before. Spawners System: An advanced vehicles system, it's not really realistic but does the job. Jobs/Employment System: An advanced employment system which contains "SOME" of the jobs as we're still developing the rest of the jobs, you can find jobs all around SA marked with blips in the map. Groups System: DGS UI that allows players to understand the system faster, it contains a lot of features for the leaders, and will be improved in further versions. Rules Panel (F1): DGS UI which contains all server rules, commands and jobs information. Banking System: Realistic banking system, which offers different payment methods (using UDC Card) which is a unique idea that hasn't been used before, the banking system is synchronised with players' accounts using a specific PIN Code that the player should enter. Turfing System: for a better CnR experience we offer you the best choice which is turfing, actually it might be only for criminals since police officers can't turf, but this feature is well designed and has a lot of perks. Fuel System: We tried to make this as much realistic as we could so we made a fuel system which synchronizes fuel refilling with vehicles type (i.e: a truck pays more than a bike to refill) Customs Shop (Credits: Al3grab): While searching the community to gain time, we found this epic modshop resource made by @Al3grab Housing System: Make your own real estate, or have your own house, this system isn't finished, but V1.0 is ready to be launched (in further versions you'll be able to buy apartments and add your own furniture). Fast Food: Heal yourself by buying some pizza hot. Drugs System: Improve your health and movements. Animations: Make some animations by pressing F7 Phone System: Transfer money, send PMs, Take a selfie, Clock, Weather, Note, GPS, Calculator and settings Other Features: Criminal Boss Police Chief JFM Bankrob Stores Rob Civilians Job (Taxi, Pizzaboy, Bus Driver, Fisherman, Rescue Man, Pilot, Ferry Captain..) Vehicles Repair System Stats Panel Settings System HD Radar Walking Style System VIP System Ammunation Teleport System Drugs Store Medkits Repair Kits Armed Robberies LAW/Gangsters Skills Safe Zones Score System Skin Shop Taser/Arrest System Quiz System Social Links: Forums Discord Official Trailer: