Jump to content

βurak

Members
  • Posts

    370
  • Joined

  • Last visited

  • Days Won

    21

Everything posted by βurak

  1. I think here it gives a warning message because something other than the player element enters the marker. You can check it with getElementType function BuySkin159 (theplayer) if(getElementType(theplayer) ~= "player") then return end -- if theplayer not player stop continue local account = getPlayerAccount(theplayer) local skinprice = 5000 if(account) then -- Does the player have an account? if(isGuestAccount(account)) then return end -- if account guest account stop continue local accName = getAccountName(account) if getPlayerMoney(theplayer) >= skinprice then takePlayerMoney(theplayer, 5000) setTimer(function() fadeCamera(theplayer,true) setElementModel(theplayer, 159) local ID = getFreeID() local skinid = 159 local myData = dbExec(db,"INSERT INTO SkinShop VALUES (?, ?, ?)",ID,accName,skinid) skin = getElementModel(theplayer) outputChatBox("#00ff00 [Done]: #ffffffskin shoma be id #ff0000"..skin.."#ffffff taghir kard",theplayer, 255,255,255,true) end,1000,1) fadeCamera(theplayer,false) end end end addEventHandler("onMarkerHit", marker1, BuySkin159)
  2. hello i think you can have a look at this thread this might be what you want
  3. you can do it like this addEventHandler("onClientResourceStart", resourceRoot, function() local txd = engineLoadTXD ("yourtxd.txd") engineImportTXD (txd, 17633) --The object id you want to change txd local dff = engineLoadDFF("yourdff.dff") engineReplaceModel(dff, 17633) --The object id you want to change dff local col = engineLoadCOL("yourcol.col") engineReplaceCOL(col, 17633) --The object id you want to change col end )
  4. hello, I have prepared a small script for you with explanations here, I hope I can help you. here I created 2 markers as entry/exit, one teleports to the inside and the other to the exit server: local entraceMarker = createMarker(-1605.32422, 711.13220, 12.86719, "cylinder", 2.0, 255, 0, 0, 255) -- marker to enter the interior (SFPD HQ) local exitMarker = createMarker(246.37334, 107.73531, 1003.21875, "cylinder", 2.0, 255, 0, 0, 255) -- marker to exit interior (SFPD HQ) setElementInterior(exitMarker, 10) -- make marker interior to 10 for visible -- INSIDE addEventHandler("onMarkerHit", entraceMarker, -- add event listener for entrace marker function(hitElement, matchingDimension) if(getElementType(hitElement) == "player") then -- if hit Element is Player? setElementInterior(hitElement, 10) -- make interior 10 for player setElementPosition(hitElement, 246.87018, 110.93930, 1003.21875) --if so teleport player end end ) -- OUTSIDE addEventHandler("onMarkerHit", exitMarker, -- add event listener for exit marker function(hitElement, matchingDimension) if(getElementType(hitElement) == "player") then -- if hit Element is Player? setElementInterior(hitElement, 0) -- make interior 0 for player setElementPosition(hitElement, -1604.80127, 713.89508, 13.20619) --if so teleport player end end )
  5. this code will work when you hit all the markers in the game only if you want it for the shop menu, check it with the marker hit by the player with the for loop other than that, your code looks good, there is no problem example: addEventHandler("onPlayerMarkerHit", root, function(markerHit, matchingDimension) for id,marker in pairs(_marker) do -- only for shop markers if(markerHit == marker.marker) then outputChatBox("Presiona la H para acceder al panel", source) end end end )
  6. If you want to do this with the key, you will need to do a little more code. You have to bind the key both when you start the resource and when a new player enters the game. server: addEventHandler("onResourceStart", resourceRoot, function() for _,player in ipairs(getElementsByType("player")) do -- pull all players when resource starts bindKey(player, "B", "down", toggleCarShopMenu) -- bind the b key to the toggleCarShopMenu function for this player end end ) addEventHandler("onPlayerJoin", root, function() bindKey(source, "B", "down", toggleCarShopMenu) -- bind b key to toggleCarShopMenu function for newly joined player end ) function toggleCarShopMenu(player) for id,marker in pairs(_marker) do if(isElementWithinMarker(player, marker.marker)) then -- Is the player inside any marker found in this loop? triggerClientEvent(player, "vehicles:CarshopShowMenu", player, marker.marker:getData("vehicles:shop_name"), marker.marker:getData("vehicles:shop_data"), marker.marker:getData("vehicles:name"), marker.marker:getData("vehicles:price")) -- if so call menu break -- break loop end end end
  7. https://wiki.multitheftauto.com/wiki/SetAmbientSoundEnabled client: setAmbientSoundEnabled( "gunfire", false )
  8. no problem it was my pleasure ?
  9. your code already has mensaje:gsub part doing this job mensaje = mensaje:gsub("^%l", string.upper) you don't need to do anything else
  10. I tested this code it converts the first character of the text to uppercase mensaje = "hello" -- hello mensaje = mensaje:gsub("^%l", string.upper) outputDebugString(mensaje) -- Hello
  11. no problem if you have any other questions, please open a thread, I'll help as much as I can ?
  12. hello, after a long effort, I finally managed to run your code. I think the problem is about entering a low value for the bandwith parameter, but if you enter a high amount here, the problem will be solved, I'll send you the code I tried. server: addCommandHandler ("LoadCar",function(player) txd1 = fileOpen("sultan.txd") dff1 = fileOpen("sultan.dff") local txd = fileRead (txd1, 100*1024*1024) local dff = fileRead(dff1, 100*1024*1024) triggerLatentClientEvent(player,"acceptCar",100*1024*1024,false,player,txd,dff) fileClose (txd1) fileClose (dff1) end) client: addEvent ("acceptCar", true) addEventHandler ("acceptCar",root,function(t1 ,d1) outputDebugString("test") txd1 = engineLoadTXD ( t1 ) dff1 = engineLoadDFF ( d1,576 ) engineImportTXD ( txd1, 576 ) engineReplaceModel ( dff1, 576 ) end) triggerLatentClientEvent(player,"acceptCar",100*1024*1024,false,player,txd,dff) -- max bandwidth : 100 MB When you type LoadCar it will load your model with a little delay.
  13. actually hex codes will work for you, but before that you can clear the hex codes in the player's name For example, I made the dice text red here, you can use it this way to get what you want, but make sure the last parameter of the outputChatBox is true. local clearedName = string.gsub(sourceName, "#%x%x%x%x%x%x", "") outputChatBox ("[ING] "..clearedName.."#FF0000dice: "..mensaje..".", v, 255, 255, 255, true)
  14. oh my fault sorry forgot to say triggerClientEvent(root, "playSound", player) change the first player parameter to root this should work so it will send to all players
  15. function sonidoBloq() local x, y, z = getElementPosition(localPlayer) -- get player position local bloqueo = playSound3D("sonidoBloq.mp3", x, y, z, false) setSoundMaxDistance(bloqueo, 10) end addEvent("playSound", true) -- add event with name "playSound" or whatever you want addEventHandler("playSound", root, sonidoBloq) -- add event listener hmmm can you try to enclose the getElementPosition in a function?
  16. yes it's possible you can call it with triggerClientEvent likewise triggerClientEvent(player, "playSound", player) but be careful with the player parameter because it will change based on where it is called. As an example, here I made 3 parameters as posX, posY, posZ. function sonidoBloq(posX, posY, posZ) local bloqueo = playSound3D("sonidoBloq.mp3", posX, posY, posZ, false) setSoundMaxDistance(bloqueo, 10) end addEvent("playSound", true) -- add event with name "playSound" or whatever you want addEventHandler("playSound", root, sonidoBloq) -- add event listener you can run it on the server side with triggerClientEvent in the same way, but here we will need to add 3 x, y, z coordinates as an extra, so we can play the sound in the coordinates we want. triggerClientEvent(player, "playSound", player, 0, 50, 3) -- play sound 0,50,3 coordinates
  17. local x, y, z = getElementPosition(localPlayer) -- get player position function sonidoBloq() local bloqueo = playSound3D("sonidoBloq.mp3", x, y, z, false) setSoundMaxDistance(bloqueo, 10) end addEvent("playSound", true) -- add event with name "playSound" or whatever you want addEventHandler("playSound", root, sonidoBloq) -- add event listener create an event on the client side to play the sound you can use triggerClientEvent to call this on server side triggerClientEvent(player, "playSound", player)
  18. addCommandHandler("motor", function(player,cmd) local acc = player:getAccount() local owner = acc:getName() local vehicle = getPedOccupiedVehicle(player) if vehicle then if(getPedOccupiedVehicleSeat(player) ~= 0) then return end if (vehicle:getData("vehicles:owner") == owner) then setPlayerVehicleEngine(player, vehicle) else player:outputChat("No tienes las llaves de este vehículo.", 255, 0, 0) end else player:outputChat("Debes estar en un vehículo para ejecutar este comando.", 255, 0, 0) end end) can you try this
  19. Change "theplayer" to "source" like this function afterlogin() local skinData = dbQuery(connection,"SELECT * FROM accounts WHERE id=? AND skin=? LIMIT 1",(id),(skin)) local result = dbPoll( qh, -1 ) if (skinData) then setElementData(source,"id",skinData.id) setElementModel (source, skinData.skin ) end end addEventHandler("onPlayerLogin",root, afterlogin)
  20. Can you show the code so we can help you?
  21. no problem if you have any other questions, open a new thread and I will help you as much as I can ?
  22. yes, I tested it, it didn't work. How about doing it on the server side with "onVehicleStartExit" instead? server: function blockPlayerExitIfLocked() if(isVehicleLocked(source)) then cancelEvent() end end addEventHandler("onVehicleStartExit", root, blockPlayerExitIfLocked)
  23. function blockPlayerExitIfLocked() if(isVehicleLocked(source)) then cancelEvent() end end addEventHandler("onClientVehicleStartExit", root, blockPlayerExitIfLocked) can you try this if we test normally if you don't mind?
×
×
  • Create New...