Jump to content

βurak

Members
  • Posts

    370
  • Joined

  • Last visited

  • Days Won

    21

Everything posted by βurak

  1. I'm not sure but you can use dxCreateTexture for this also you can change the "textureEdge" parameter to "clamp" Tip: To help prevent edge artifacts when drawing textures, set textureEdge to "clamp" when calling dxCreateTexture https://wiki.multitheftauto.com/wiki/DxCreateTexture
  2. hi i have tested the animate function for you you can test the example i made here but i am not sure if this is what you want local test = playSound("music.wav", true) setSoundVolume(test, 1.0) local anims, builtins = {}, {"Linear", "InQuad", "OutQuad", "InOutQuad", "OutInQuad", "InElastic", "OutElastic", "InOutElastic", "OutInElastic", "InBack", "OutBack", "InOutBack", "OutInBack", "InBounce", "OutBounce", "InOutBounce", "OutInBounce", "SineCurve", "CosineCurve"} function table.find(t, v) for k, a in ipairs(t) do if a == v then return k end end return false end function animate(f, t, easing, duration, onChange, onEnd) assert(type(f) == "number", "Bad argument @ 'animate' [expected number at argument 1, got "..type(f).."]") assert(type(t) == "number", "Bad argument @ 'animate' [expected number at argument 2, got "..type(t).."]") assert(type(easing) == "string" or (type(easing) == "number" and (easing >= 1 or easing <= #builtins)), "Bad argument @ 'animate' [Invalid easing at argument 3]") assert(type(duration) == "number", "Bad argument @ 'animate' [expected number at argument 4, got "..type(duration).."]") assert(type(onChange) == "function", "Bad argument @ 'animate' [expected function at argument 5, got "..type(onChange).."]") table.insert(anims, {from = f, to = t, easing = table.find(builtins, easing) and easing or builtins[easing], duration = duration, start = getTickCount( ), onChange = onChange, onEnd = onEnd}) return #anims end function destroyAnimation(a) if anims[a] then table.remove(anims, a) end end addEventHandler("onClientRender", root, function( ) local now = getTickCount( ) for k,v in ipairs(anims) do v.onChange(interpolateBetween(v.from, 0, 0, v.to, 0, 0, (now - v.start) / v.duration, v.easing)) if now >= v.start+v.duration then if type(v.onEnd) == "function" then v.onEnd( ) end table.remove(anims, k) end end end) function fadeOutSound(sound, fadeTime) animate(1.0, 0, 1, fadeTime, function(volumeValue) setSoundVolume(sound, volumeValue) if(sound and getSoundVolume(sound) == 0) then stopSound(sound) end end) end addCommandHandler("fadesound", function() fadeOutSound(test, 3000) -- Completely mute in 3 seconds end)
  3. Put false at the end of the onClientGUIClick event so it will only do things when you press the button example: addEventHandler("onClientGUIClick", btnContinuar, function() NombrePersonaje = guiGetText(nombreYapellido) sexo = guiRadioButtonGetSelected(masculino) -----if I try to put the variable (if (sexo==true) here, the script doesn't work and crash------- triggerServerEvent("definirName", getLocalPlayer(), NombrePersonaje) end, false) -- this
  4. I haven't tested the code but it could be something like this when the player sees all the skins in the table it will come back to the beginning local currentTableID = 1 addEventHandler("onClientGUIClick", btnContinuar, function() if(currentTableID > #tableSkinsHombre) then currentTableID = 1 end setElementModel(localPlayer, tableSkinsHombre[currentTableID]) currentTableID = currentTableID + 1 end)
  5. Can you add the codes of the s_core.lua file to the topic so we can help you?
  6. https://wiki.multitheftauto.com/wiki/SetElementModel use: setElementModel (element theElement, int model)
  7. you can use tables for this local skinMarkers = {} --create table to store markers function createSkinMarker(x, y, z, interior) --skin marker creation function local marker = createMarker(x, y, z, "cylinder", 2.0, 255, 0, 0, 255) setElementInterior(marker, interior) table.insert(skinMarkers, marker) -- transfer the created marker to the skinMarkers table end addEventHandler("onMarkerHit", root, -- Define event handler for markers in skinMarkers table function(hitElement, matchingDimension) if(getElementType(hitElement) == "player") then -- hitElement is player? for i=1,#skinMarkers do if(source == skinMarkers[i]) then -- the marker that the player touched is the skin marker? -- YOUR CODES HERE end end end end ) then you can call the createSkinMarker function to create markers at multiple points createSkinMarker(0, 0, 2, 0) -- create skin marker 0, 0, 2 position with interior id 0 createSkinMarker(1, 3, 2, 0) -- create skin marker 1, 3, 2 position with interior id 0 createSkinMarker(3, 20, 2, 0) -- create skin marker 3, 20, 2 position with interior id 0
  8. here you can call posicionar event with triggerClientEvent to trigger music and camera matrix triggerClientEvent(source, "posicionar", source) -- trigger music and camera matrix use triggerClientEvent again to end music and camera matrix when player login triggerClientEvent(source, "pararmusicaycamara", source) -- stop music and camera matrix local cancion = playSound("loginSoundtrack.mp3") setSoundPaused(cancion, true) -- create but stop music when resource starts function fondoLogin() -- no theplayer parameter needed here setSoundPaused(cancion, false) -- play music setSoundVolume(cancion, 0.5) setElementPosition(source, -1400.2099609375,106.88999938965,1032.2734375) setElementInterior(source, 1) setCameraMatrix ( 1709.7098388672,-1449.96484375,151.87727355957, 1537.9990234375,-1276.736328125,238.57434082031, 0, 100 ) end addEvent("posicionar", true) addEventHandler("posicionar", getLocalPlayer(), fondoLogin) ---------Suposed to stops the music and cameraMatrix---------------- function parartodo() -- no theplayer parameter needed here setCameraTarget(source) stopSound(cancion) end addEvent("pararmusicaycamara", true) addEventHandler("pararmusicaycamara", getLocalPlayer(), parartodo)
  9. To be honest, I don't know much either, but let me explain. The SkinData query returns a table value that gets all the columns that contain your account then we include it in a loop using a for loop and we can get the data we want from there If we wanted to get the id as an example, then we could get it as row["ID"] The if code checks if the number of columns returned is greater than 0. if(#SkinData > 0)
  10. not sure but can you test this? but backup your old code function afterlogin(_,account) local accName = getAccountName(account) local SkinData = dbPoll(dbQuery(db,"SELECT * FROM SkinShop WHERE Account=?",accName), -1) if(SkinData) then if(#SkinData > 0) then for _,row in ipairs(SkinData) do setElementModel(source, row["Skin"]) end end end end addEventHandler("onPlayerLogin",root, afterlogin)
  11. Have you tried the where clause? using this you can update the column with the account name example: local myData = dbExec(db,"UPDATE SkinShop SET Skin=? WHERE Account=?",skinid, accName) -- Update name of Skin column in SkinShop table matching accName you can do the same in select clause local GotSkinData = dbPoll(dbQuery(db,"SELECT Account,Skin,ID FROM SkinShop WHERE Account=?", accName), -1)
  12. there is a typo here triggerServerEvent("GTWvehicleshop.onPlayerVehicleBuyRequest", localPlayer, getVehicleModelFromName(vehName), fix it like this triggerServerEvent("GTWvehicleshop.onPlayerVehicleBuyRequest", localPlayer, getVehicleModelFromName(vehName))
  13. actually you don't need some lines here like getPlayerAccount because the onPlayerLogin event carries the account you are logged into so change it like this function afterlogin(_,account) -- this account local SkinData = dbPoll(dbQuery(db,"SELECT Account,Skin,ID FROM SkinShop"), -1) --local account = getPlayerAccount(source) -- no need this local accName = getAccountName(account) if (SkinData) and (SkinData[1]) and (SkinData[2]) then if (SkinData[1].Account == tostring(accName)) then setElementModel(source, SkinData[2].Skin ) end end end addEventHandler("onPlayerLogin",root, afterlogin)
  14. send it as a private message
  15. This varies according to the resource you use. Since you do not show the code, I will explain the logic, but if you have a save system, you may need to write more code than that. you can call the savePlayerDefaultSkin function before the job starts and when the job is finished you can call the loadPlayerDefaultSkin function local playerDefaultSkin = {} -- define storage for player default skins function savePlayerDefaultSkin(player) playerDefaultSkin[player] = getElementModel(player) --save player model to table end function loadPlayerDefaultSkin(player) if(playerDefaultSkin[player]) then setElementModel(player, playerDefaultSkin[player]) -- load skin from table playerDefaultSkin[player] = nil -- remove from table we don't need anymore end end addEventHandler("onPlayerQuit", root, function() playerDefaultSkin[player] = nil --delete player skin from game completely from memory end )
  16. yes he knows a lot more than me he will help you good luck ?
  17. I don't know much about database, if you want, ask someone else about this I don't want to give you wrong information.
  18. so when you exit the game, doesn't it save the current skin to the database again?
  19. hmm maybe try changing "skin" to "Skin"? function afterlogin() local skinData = dbQuery(db,"SELECT Skin,Account FROM SkinShop") local result = dbPoll(skinData,-1) if (result) and (result[1]) and (result[2]) then setElementModel(source, result[1].Skin ) end end addEventHandler("onPlayerLogin",root, afterlogin)
  20. Can you show the data coming with outputDebugString outputDebugString(result[1].skin)
  21. I think I forgot this part, I edited the code above again local accName = getAccountName(account)
×
×
  • Create New...