
McDeKi
Members-
Posts
55 -
Joined
-
Last visited
Everything posted by McDeKi
-
Hello again! I'm doing save system for my inventory, almost everything works perfect, but I must trigger client event to get player inventory to save it in MySQL base. --//Serverside function ZapiszEQ(StringEQ) local mysqlId = getElementData(client, "mysqlNick") local EQ = exports.SQL:zapytanie("UPDATE dane SET EKWIPUNEK=? WHERE IMIE=?", StringEQ, mysqlId) outputServerLog("Gracz o nicku: "..getPlayerName( source ).." zapisal swoj ekwipunek na konto: "..getElementData(source, "mysqlNick")) end addEvent("ZapiszPrzedmioty", true) addEventHandler("ZapiszPrzedmioty", root, ZapiszEQ) function GraczWyszedl() triggerClientEvent(source, "GraczWyszedl", root ) end addEventHandler("onPlayerQuit", root, GraczWyszedl) --//This event is in the another resource than inventory. --//Clientside function SaveEQ() triggerServerEvent("ZapiszPrzedmioty", getLocalPlayer(), table.concat(zapiszEkwipunek(), "|")) end addEvent("GraczWyszedl", true) addEventHandler("GraczWyszedl", root, SaveEQ) It doesnt work. I think the event is not triggered because the element of player got removed, any advice to fix it, I have tried doing it with "onPlayerClientQuit" but this event doesnt work like "onPlayerQuit".
-
I must save it according to scheme: Xslot, Yslot, ID for example (4,1,1|next Item|next Item) then I must save it in mysql as string and read the substrings, then I'm gonna add the items in the slots according to scheme X, Y, ID
-
Hello, I was wondering how I should do save system for my inventory. --//Zapis przedmiotow\\-- function zapiszEkwipunek() for k,v in pairs( Plecak )do for i=1, wysokoscY do if not (Plecak[k][i] == false) then outputChatBox(k.."|"..i.."|"..Plecak[k][i].id) end end end end It works fine, output all items in inventory, for example here is the item with id 4, in the slot 5|1 and it outputs 5|1|4 What function I should use, split and gettok or table.insert and table.concat.
-
I know, but I put it as global only for testing.
-
Ok, fixed it. function SprawdzWolneMiejsca ( ) liczbaPrzedmiotow = 0 for k, v in pairs ( Plecak ) do for i = 1, wysokoscY do if ( not Plecak [ k ] [ i ] == false ) then liczbaPrzedmiotow = ( liczbaPrzedmiotow + 1 ) end end end return liczbaPrzedmiotow end Thanks for advice.
-
I made a table full of falses { false false false false item item item false false } and I want to count how many items is in the table and then I want output count of items, that why I'm using return
-
Hello, I have a problem, I'm looping through all elements in my table. function SprawdzWolneMiejsca() for k, v in pairs ( Plecak ) do for i=1, wysokoscY do if not Plecak[k][i] == false then liczbaPrzedmiotow = liczbaPrzedmiotow + 1 outputChatBox(liczbaPrzedmiotow) return liczbaPrzedmiotow end end end end It works and output count of elements in table, but If I will use return then it output 1, because the loop wont ended looping through all elements, any advice how to fix it? I have tried doing, that when the loop is ending looping then I return value function SprawdzWolneMiejsca() for k, v in pairs ( Plecak ) do for i=1, wysokoscY do if not Plecak[k][i] == false then liczbaPrzedmiotow = liczbaPrzedmiotow + 1 outputChatBox(liczbaPrzedmiotow) if k == liczbaPrzedmiotow then return liczbaPrzedmiotow end end end end end
-
This bug only appears when you join the game function fixClothes() local TablicaDebugowa = { {"tracktrpro","tracktr", 2}, {"convproblk","conv", 3}, {"bandred3","bandmask", 15}, {"tshirterisyell","tshirt",0 }, {"gimpleg","gimpleg",17}, {"bandred","bandana",16}, {"watchpink","watch",14}, {"dogtag","neck",13} } --you can add more clothes (like tattos etc) to TablicaDebugowa for i=1,#TablicaDebugowa do --simple loop addPedClothes(source,TablicaDebugowa[i][1],TablicaDebugowa[i][2],TablicaDebugowa[i][3]) removePedClothes(source,TablicaDebugowa[i][3]) end end addEventHandler("onPlayerLogin", getRootElement ( ), fixClothes)
-
There is mta bug which set tattos and other things to cj and you cant remove it with removePedClothes, you must add clothes and then remove it
-
Hey, I had this problem too local TablicaDebugowa = { {"tracktrpro","tracktr", 2}, {"convproblk","conv", 3}, {"bandred3","bandmask", 15}, {"tshirterisyell","tshirt",0 }, {"gimpleg","gimpleg",17}, {"bandred","bandana",16}, {"watchpink","watch",14}, {"dogtag","neck",13} } --you can add more clothes (like tattos etc) to TablicaDebugowa for i=1,#TablicaDebugowa do --simple loop addPedClothes(source,TablicaDebugowa[i][1],TablicaDebugowa[i][2],TablicaDebugowa[i][3]) removePedClothes(source,TablicaDebugowa[i][3]) end
-
I edited this skin. https://wiki.multitheftauto.com/wiki/Clo ... ponent_IDs
-
Hello, I have tried replace CJ textures via shader, but without effect, now I'm using CJ skin .txd replace. textures = { ["player_torso"] = 30421, } function replaceClothes() for cloth, id in pairs(textures) do local txd = engineLoadTXD(cloth..".txd") engineImportTXD(txd, id) end end addEventHandler("onClientResourceStart", resourceRoot, replaceClothes) http://www73.zippyshare.com/v/18875057/file.html Whole textures must have the same resoulution as the orginal from player.img, if you put texture with bigger resolution then the game will crash. Another link: http://www.sendspace.com/file/dq63f2
-
Hello! I'm trying do shader, which will replace CJ clothes texture, but... in wikipedia it says I need change textureName to CJ(https://wiki.multitheftauto.com/wiki/En ... rldTexture), also I found in MTA code that I need change world texture to "cj_ped_..." //////////////////////////////////////////////////////////////// // // CRenderWareSA::AppendAdditiveMatch // // Add additive match for a shader+entity combo // //////////////////////////////////////////////////////////////// void CRenderWareSA::AppendAdditiveMatch ( CSHADERDUMMY* pShaderData, CClientEntityBase* pClientEntity, const char* szTextureNameMatch, float fShaderPriority, bool bShaderLayered, int iTypeMask, uint uiShaderCreateTime, bool bShaderUsesVertexShader, bool bAppendLayers ) { TIMING_CHECKPOINT( "+AppendAddMatch" ); // Make previous versions usage of "CJ" work with new way SString strTextureNameMatch = szTextureNameMatch; if ( strTextureNameMatch.CompareI( "cj" ) ) [b] strTextureNameMatch = "cj_ped_*";[/b] m_pMatchChannelManager->AppendAdditiveMatch ( pShaderData, pClientEntity, strTextureNameMatch, fShaderPriority, bShaderLayered, iTypeMask, uiShaderCreateTime, bShaderUsesVertexShader, bAppendLayers ); TIMING_CHECKPOINT( "-AppendAddMatch" ); } I have tried this, but it isn't working. local pShader = dxCreateShader( 'shader.fx' ); -- change this to the shader file name if( pShader ) then -- check if shader was created successfully local pTexture = dxCreateTexture( 'tracktrblue.png' ); -- create texture || change here to the texture file name if( pTexture ) then -- check if texture was created successfully dxSetShaderValue( pShader, 'cj', pTexture ); -- set shader texture to the texture we created -- engineApplyShaderToWorldTexture( pShader, 'cj_ped_torso'--[[, TARGET [ not needed ] ]] ); -- apply texture to the world || change here to the clothe texture name you want to replace and maybe fill target with an element if you don't want it to be applied to all world textures with this name end end shader texture cj; technique clotheTexRep { pass P0 { Texture[0] = cj; } } Any help will be appreciated.
-
you can also do this with onClientRender, if you want for example smooth move camera local x1 = 50 local y1 = 50 local z1 = 50 function onClick() local x,y = guiGetScreenSize() setCameraMatrix(x1,y1,z1,50,50,50) local check = isMouseWithinRangeOf(x*0,x*0.5,y*0,y*0.5) -- start x, width, start y, height if getKeyState("mouse1") == true then if check then x1 = x1 + 0.2 y1 = y1 - 0.02 end end addEventHandler("onClienRender",getRootElement(),onClick) Edit: Gallardo you are fast, I noticed that and changed it after 30 seconds.
-
function DrawRectangle() x, y = guiGetScreenSize() local check = isMouseWithinRangeOf(x*0,x*0.5,y*0,y*0.5) -- start x, width, start y, height if check then dxDrawRectangle(x*0,y*0,x*0.5,y*0.5,tocolor(0,0,0,180)) end end addEventHandler("onClientRender",resourceRoot,DrawRectangle) function isMouseWithinRangeOf(psx,pssx,psy,pssy) if not isCursorShowing() then return false end local cx,cy = getCursorPosition() cx,cy = cx*x,cy*y if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then return true,cx,cy else return false end end Gallardo gave me this code and it works perfect
-
local countersprint = 1 local imagessprint = {"MW2Sprinten1","MW2Sprinten2","MW2Sprinten3","MW2Sprinten4","MW2Sprinten5","MW2Sprinten6","MW2Sprinten7","MW2Sprinten8","MW2Sprinten9","MW2Sprinten10","MW2Sprinten11","MW2Sprinten12","MW2Sprinten13","MW2Sprinten14","MW2Sprinten15","MW2Sprinten16","MW2Sprinten17","MW2Sprinten18","MW2Sprinten19","MW2Sprinten20","MW2Sprinten21","MW2Sprinten22","MW2Sprinten23","MW2Sprinten24","MW2Sprinten25","MW2Sprinten26"} local xsprint, ysprint = guiGetScreenSize(); local secondBetweenImageInMSsprint = 30 addEventHandler("onClientRender",root, function() if getPedMoveState ( localPlayer ) == "sprint" then if not isTimer(timer) then timer = setTimer(function () countersprint = countersprint + 1 end,secondBetweenImageInMSsprint,1) end if countersprint == #imagessprint then countersprint = 1 end local xsprint, ysprint = guiGetScreenSize(); dxDrawImage ( 0, 0, xsprint, ysprint, "images/sprint/".. imagessprint[countersprint]..".png" ); end end ) local secondBetweenImageInMSsprint = 30
-
/svp your current nick
-
Try /svp your account name
-
Ok, try /svp then
-
And you did /add admin yournick/account I'm not sure nick or account
-
Are you added yourself to acl in admin group?
-
Are you sure you are logged in? /register nick password /login nick password
-
It spawn vehicles.