![](https://forum.multitheftauto.com/uploads/set_resources_22/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
pa3ck
Members-
Posts
1,141 -
Joined
-
Last visited
-
Days Won
7
Everything posted by pa3ck
-
Post the whole code again, with the changes you made.
-
Add something like this so it will not try to index the filed unless it finds something: function outputDistrictName() lastDistrictKey = getCurrentDistrictKey(source) if lastDistrictKey then outputChatBox("" .. districts[lastDistrictKey][5] .. ".") end end Then enter a colshape.
-
I'm not familiar with CJ clothes. Can you have more than one clothing on the torso? Like a t-shirt and a jacket as well?
-
How would the code know the districtName? Where do you define and change the current districtName? EDIT: Oh yea, I see what you are trying to do. The thing is, the onClientRender function would never know which district the player is in. Try this: http://pastebin.com/k4VkAja0 (Can't paste LUA code for some reason, it just keeps loading) Also, change the table.insert to this: table.insert(district, {createColCuboid(v[1], v[2], -50, v[3], v[4], 1000)})
-
Hide the weapon element using setElementAlpha and use createObject at the position of the hidden weapon.
-
You still don't understand what he is trying to do. He wants to change the skin color, head shape etc and also use clothes/hats/glasses. The only way to replace the skin color is to replace the torso but when you replace the torso, you also replace the clothes that have been added with addPedClothes.
-
The thing is, I'm not that experienced with shaders, but that's how I would do it, yes. Somebody might come along and give you a better solution. The code in my previous post replaces the torso twice. Once the skin color then the t-shirt and the layers are being merged into one. You can do the same thing with the rest.
-
It has to be in the loop because he's looping through every player. If you scroll up a bit you will see how it was fixed.
-
As far as I know, all the clothing, tattoos etc are shaders as well. So basically when you apply something to the torso, you overwrite the existing shaders. A work around would be to not use addPedClothes but add them with shaders: addCommandHandler("change", function(cmd, col) if not tonumber(col) or tonumber(col) < 0 or tonumber(col) > 3 then return end local texts = {"brown", "white", "black"} local textSkin = dxCreateTexture ( "files/" .. texts[tonumber(col)] .. ".png" ) local textTshirt = dxCreateTexture ( "files/tshirt.png" ) local textFace = dxCreateTexture ( "files/nface.png" ) local skin = dxCreateShader( "files/shader.fx", 0, 0, true, "ped" ) local tshirt = dxCreateShader( "files/shader.fx", 0, 0, true, "ped" ) local face = dxCreateShader( "files/shader.fx", 0, 0, true, "ped" ) engineApplyShaderToWorldTexture ( skin, "cj_ped_torso", localPlayer ) engineApplyShaderToWorldTexture ( tshirt, "cj_ped_torso", localPlayer ) engineApplyShaderToWorldTexture ( face, "cj_ped_head", localPlayer ) dxSetShaderValue ( skin, "gTexture", textSkin ) dxSetShaderValue ( tshirt, "gTexture", textTshirt ) dxSetShaderValue ( face, "gTexture", textFace ) end) Try it, just export a t-shirt from player.img. It's also important, that that the model changes as well depending on the type of clothing, for example suits, hoodies have different models than t-shirts, so you should also use a "dummy" addPedClothes depending on the type. @Walid That's done using engineImportTXD probably, but even if they are shaders, they are only 1 layered.
-
engineApplyShader has this argument to let you apply more than one texture: appendLayers: allows two or more layered shaders to be applied in the same texture. You may want to modify the DepthBias in the technique pass to avoid Z-fighting artifacts when using this.
-
It's actually not that hard as you would think. List of CJ parts you can replace with shader: "cj_ped_head", "cj_ped_hat", "cj_ped_torso", "cj_ped_legs", "cj_ped_feet", "cj_ped_glasses", "cj_ped_necklace", "cj_ped_watch" and "cj_ped_extra1". Code for replacing the torso: addCommandHandler("change", function(cmd, col) if not tonumber(col) or tonumber(col) < 0 or tonumber(col) > 3 then return end local texts = {"brown", "white", "black"} local texture = dxCreateTexture ( "files/" .. texts[tonumber(col)] .. ".png" ) -- either export the default CJ TXD file then export the image with TXD Workshop to edit it with PhotoShop or download a custom part local shader = dxCreateShader( "files/shader.fx", 0, 0, false, "ped" ) -- this is the only shader you will need, don't need to edit anything here engineApplyShaderToWorldTexture ( shader, "cj_ped_torso", localPlayer, true ) -- this is where you specify which CJ part you want to replace, probably you will want to replace "cj_ped_head" as well dxSetShaderValue ( shader, "gTexture", texture ) -- same here, leave it as is end) I will attach a simple resource, which already has 3 "skin colors". In the resource, it only replaces the localPlayer, not every players' skin. You will need to do the same with "cj_ped_head" (at least I think that's what it's called) so you can have different faces. Saving them is quite simple, create a LUA table with all the texture file names you have, example: local skinTypes = { "white-1", "white-2", "white-3", "brown-1", "brown-2" -- etc etc } local headTypes = { "small-1", "small-2", "small-3", "med-1", "med-2" -- etc etc } And in the database you will have two columns which saves the table index of the skin and head example: 2, 5 which will be skinTypes[2] and headTypes[5], like: local texts = {"brown", "white", "black"} local texture = dxCreateTexture ( "files/" .. skinTypes[ Your_Value_From_Database ] .. ".png" ) local shader = dxCreateShader( "files/shader.fx", 0, 0, false, "ped" ) engineApplyShaderToWorldTexture ( shader, "cj_ped_torso", localPlayer, true ) dxSetShaderValue ( shader, "gTexture", texture ) [ Screenshot of the resource ] [ Download ]
-
You can't have different models on the same ID but you can have different textures (like TXDs) on world elements using EngineApplyShaderToWorldTexture.
-
interpolateBetween Look at the examples on the wiki, the second one is a GUI example as well.
-
Not sure how getPlayerIdleTime works, I don't know if you use binds / move camera that will re-initialize it, but if you are happy enough with only being AFK if the player hasn't moved, then change line 10 to this: elseif isElementMoving(source) and not idleState[source] or idleState[source] == "idle" then
-
You need to save the last state of the player, try this: local idleState = {} function checkAFKPlayers() for index, source in ipairs(getElementsByType("player")) do if (getPlayerIdleTime(source) > 1000) and not idleState[source] or idleState[source] == "active" then idleState[source] = "idle" setElementDimension ( source, 50) setElementAlpha(source, 50) outputChatBox("#004B00[DDC - Afk] #FFffFFNem mozogtál 2 percig, afk módba léptél! Kikapcsoláshoz mozdulj meg!", source, 255,000,000, true) elseif isElementMoving(source) or getPlayerIdleTime(source) < 1000 and not idleState[source] or idleState[source] == "idle" then idleState[source] = "active" setElementAlpha(source, 255) setElementDimension ( source, 0) outputChatBox("#004B00[DDC - Afk] #FFffFFKiléptél az afk módból!", source, 255,000,000, true) end end end setTimer(checkAFKPlayers, 1000, 0) function isElementMoving ( theElement ) if isElement ( theElement ) then local x, y, z = getElementVelocity( theElement ) return x ~= 0 or y ~= 0 or z ~= 0 end return false end
-
An "end" was missing and you said there were no errors, which is not possible. In case you didn't know, you need to enter "/debugscript 3" as ACL Admin in the chat.
-
Not sure what you need it for, but you can rotate the wheel with setAnalogControlState
-
getBanIP, getBanNick these are all server-side functions, you can't use them client-side. You will need to process the table which you get with getBans and trigger that "sorted table". By sorting, I mean, put everything from the getBanIP, getBanNick functions into a new table.
-
Please don't bump your topic, this is not an advertising website, somebody will come along and help you when / if they can. The onPlayerCommand is inside the loop, meaning it will run number of times. Shouldn't it be inside the if v ~= p then .. statement? By the way, you will probably want to use this somewhere else (player can't go passive). I think it would be better to use use a table or setElementData to save their status, because that way you will be able to prevent it from other resources as well.
-
Please don't *bump* your post, it's not an advertising website and use LUA tags when posting LUA code. Change line 29 to this: for i, v in ipairs( getElementsByType( 'colshape', rRoot ) ) do
-
Please help , i tried with everything but it won't work
pa3ck replied to Best-Killer's topic in Scripting
Tried everything? Is that mean you also Googled how to write a WHERE clause? exports.NGSQL:db_exec(" UPDATE `group_kills` WHERE Name =?, Kills =? WHERE Serial=?",playerName,Kills_[Killer],playerSerial) That's totally wrong. You can have multiple conditions in the WHERE but not like that and it doesn't even make sense... You clearly don't know SQL, I suggest you to look at this: http://www.w3schools.com/sql/sql_intro.asp . This is where I learnt SQL, it's a really good source. exports.NGSQL:db_exec(" UPDATE `group_kills` SET Name =?, Kills =? WHERE Serial=?",playerName,Kills_[Killer],playerSerial) . -
Okay, you didn't actually say much about the error. Screenshot the error you are getting because you just left out the most important part, the part after "near". Also you have an error in the dbExec but I see no dbExec commands, just the function for it. Send us that dbExec command you are getting the error from along with the full error message.