βurak
Members-
Posts
377 -
Joined
-
Last visited
-
Days Won
22
Everything posted by βurak
-
As I said, the codes are working fine for me, you are doing something wrong, maybe you can try to remove the cache=false part for the server, if it doesn't happen again, I don't know.
-
In which file are these codes stored client, server, shared? if shared just write them on server side and try to delete the oop line
-
Can you show the meta.xml and is there any other script running besides this script? If so, you can try turning them off.
-
I tested your code now, it works perfectly no errors creating teams seamlessly and puts player in props team
-
I don't see any problem in your code maybe you can check meta.xml make sure the file is on the server side
-
your welcome ?
-
in fact, you can only add it once when the player is a new registration, you don't need to do it this way. local SetData = dbExec(db,"INSERT INTO stats (ID,Account) VALUES (?, ?)",ID, AccName) you can do something like this to avoid multiple column records but I'm not sure it will work function getpaccount (_,account) local AccName = getAccountName(account) local AccData = dbPoll(dbQuery(db,"SELECT * FROM stats WHERE Account=? LIMIT 1", AccName), -1) -- search for a column in the database for this account if(AccData) then if(#AccData > 0) then return end -- do not continue if there is any record end --if there is no such record then save it to the database local ID = getFreeID() local SetData = dbExec(db,"INSERT INTO stats (ID,Account) VALUES (?, ?)",ID, AccName) end addEventHandler("onPlayerLogin",root, getpaccount)
-
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
-
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)
-
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
-
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)
-
Can you add the codes of the s_core.lua file to the topic so we can help you?
-
set next element in table?
-
https://wiki.multitheftauto.com/wiki/SetElementModel use: setElementModel (element theElement, int model)
-
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
-
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)
-
my pleasure ?
-
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)
-
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)
-
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)
-
there is a typo here triggerServerEvent("GTWvehicleshop.onPlayerVehicleBuyRequest", localPlayer, getVehicleModelFromName(vehName), fix it like this triggerServerEvent("GTWvehicleshop.onPlayerVehicleBuyRequest", localPlayer, getVehicleModelFromName(vehName))
-
your welcome
-
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)
-
send it as a private message
