synskidz Posted April 20, 2020 Share Posted April 20, 2020 this is the code from resource called skins_panel write by @MR.GRAND server addEvent( 'ChangeSkin', true ) addEventHandler( 'ChangeSkin', root, function( Data ) if ( getElementType(source) == "player" ) then if (Data == 0) or not Data then cancelEvent() outputChatBox( 'Please Select a skin to change it !', source, 255,0,0, true) else setElementModel(source,tonumber(Data)) outputChatBox( 'Skin Changed seccessfully !', source, 0,255,0, true) end end end ) client skins = { { "Skin 1", 124 }, { "Skin 2", 73 }, { "Skin 3", 253 }, { "Skin 4", 220 }, { "Skin 5", 240 }, } Skin_changer = guiCreateButton(0.54, 0.28, 0.10, 0.04, "# Change skin", true) guiSetVisible( Skin_changer, false) guiSetFont(Skin_changer, "default-bold-small") guiSetProperty(Skin_changer, "NormalTextColour", "FF00C9FC") Skins_close = guiCreateButton(0.54, 0.74, 0.10, 0.04, "# Close panel", true) guiSetVisible( Skins_close, false) guiSetFont(Skins_close, "default-bold-small") guiSetProperty(Skins_close, "NormalTextColour", "FFFC00AB") Skins_grid = guiCreateGridList(0.36, 0.27, 0.17, 0.53, true) guiSetVisible( Skins_grid, false) guiGridListAddColumn(Skins_grid, "# Skins ", 0.5) guiGridListAddColumn(Skins_grid, "# ID ", 0.5) local screenW, screenH = guiGetScreenSize() function Skins_panel() dxDrawLine((screenW * 0.3543) - 1, (screenH * 0.2005) - 1, (screenW * 0.3543) - 1, screenH * 0.8008, tocolor(0, 253, 11, 255), 1, false) dxDrawLine(screenW * 0.6457, (screenH * 0.2005) - 1, (screenW * 0.3543) - 1, (screenH * 0.2005) - 1, tocolor(0, 253, 11, 255), 1, false) dxDrawLine((screenW * 0.3543) - 1, screenH * 0.8008, screenW * 0.6457, screenH * 0.8008, tocolor(0, 253, 11, 255), 1, false) dxDrawLine(screenW * 0.6457, screenH * 0.8008, screenW * 0.6457, (screenH * 0.2005) - 1, tocolor(0, 253, 11, 255), 1, false) dxDrawRectangle(screenW * 0.3543, screenH * 0.2005, screenW * 0.2914, screenH * 0.6003, tocolor(250, 4, 207, 194), false) dxDrawText("*|- Skins panel v.1.0 -|*", (screenW * 0.3543) - 1, (screenH * 0.2005) - 1, (screenW * 0.6457) - 1, (screenH * 0.2604) - 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("*|- Skins panel v.1.0 -|*", (screenW * 0.3543) + 1, (screenH * 0.2005) - 1, (screenW * 0.6457) + 1, (screenH * 0.2604) - 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("*|- Skins panel v.1.0 -|*", (screenW * 0.3543) - 1, (screenH * 0.2005) + 1, (screenW * 0.6457) - 1, (screenH * 0.2604) + 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("*|- Skins panel v.1.0 -|*", (screenW * 0.3543) + 1, (screenH * 0.2005) + 1, (screenW * 0.6457) + 1, (screenH * 0.2604) + 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("*|- Skins panel v.1.0 -|*", screenW * 0.3543, screenH * 0.2005, screenW * 0.6457, screenH * 0.2604, tocolor(47, 252, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawLine(screenW * 0.3543, screenH * 0.2604, screenW * 0.6457, screenH * 0.2604, tocolor(47, 252, 0, 255), 2, false) dxDrawText("* *\n* *\n* *", (screenW * 0.5322) - 1, (screenH * 0.3411) - 1, (screenW * 0.5842) - 1, (screenH * 0.5130) - 1, tocolor(0, 0, 0, 255), 1.50, "beckett", "center", "top", false, false, false, false, false) dxDrawText("* *\n* *\n* *", (screenW * 0.5322) + 1, (screenH * 0.3411) - 1, (screenW * 0.5842) + 1, (screenH * 0.5130) - 1, tocolor(0, 0, 0, 255), 1.50, "beckett", "center", "top", false, false, false, false, false) dxDrawText("* *\n* *\n* *", (screenW * 0.5322) - 1, (screenH * 0.3411) + 1, (screenW * 0.5842) - 1, (screenH * 0.5130) + 1, tocolor(0, 0, 0, 255), 1.50, "beckett", "center", "top", false, false, false, false, false) dxDrawText("* *\n* *\n* *", (screenW * 0.5322) + 1, (screenH * 0.3411) + 1, (screenW * 0.5842) + 1, (screenH * 0.5130) + 1, tocolor(0, 0, 0, 255), 1.50, "beckett", "center", "top", false, false, false, false, false) dxDrawText("* *\n* *\n* *", screenW * 0.5322, screenH * 0.3411, screenW * 0.5842, screenH * 0.5130, tocolor(41, 252, 0, 255), 1.50, "beckett", "center", "top", false, false, false, false, false) dxDrawText("* *\n* *\n* *", (screenW * 0.5864) - 1, (screenH * 0.5586) - 1, (screenW * 0.6384) - 1, (screenH * 0.7305) - 1, tocolor(0, 0, 0, 255), 1.50, "beckett", "center", "top", false, false, false, false, false) dxDrawText("* *\n* *\n* *", (screenW * 0.5864) + 1, (screenH * 0.5586) - 1, (screenW * 0.6384) + 1, (screenH * 0.7305) - 1, tocolor(0, 0, 0, 255), 1.50, "beckett", "center", "top", false, false, false, false, false) dxDrawText("* *\n* *\n* *", (screenW * 0.5864) - 1, (screenH * 0.5586) + 1, (screenW * 0.6384) - 1, (screenH * 0.7305) + 1, tocolor(0, 0, 0, 255), 1.50, "beckett", "center", "top", false, false, false, false, false) dxDrawText("* *\n* *\n* *", (screenW * 0.5864) + 1, (screenH * 0.5586) + 1, (screenW * 0.6384) + 1, (screenH * 0.7305) + 1, tocolor(0, 0, 0, 255), 1.50, "beckett", "center", "top", false, false, false, false, false) dxDrawText("* *\n* *\n* *", screenW * 0.5864, screenH * 0.5586, screenW * 0.6384, screenH * 0.7305, tocolor(41, 252, 0, 255), 1.50, "beckett", "center", "top", false, false, false, false, false) dxDrawText("# #\n# #\n# #\n", (screenW * 0.5864) - 1, (screenH * 0.3411) - 1, (screenW * 0.6384) - 1, (screenH * 0.5130) - 1, tocolor(0, 0, 0, 255), 1.50, "beckett", "center", "top", false, false, false, false, false) dxDrawText("# #\n# #\n# #\n", (screenW * 0.5864) + 1, (screenH * 0.3411) - 1, (screenW * 0.6384) + 1, (screenH * 0.5130) - 1, tocolor(0, 0, 0, 255), 1.50, "beckett", "center", "top", false, false, false, false, false) dxDrawText("# #\n# #\n# #\n", (screenW * 0.5864) - 1, (screenH * 0.3411) + 1, (screenW * 0.6384) - 1, (screenH * 0.5130) + 1, tocolor(0, 0, 0, 255), 1.50, "beckett", "center", "top", false, false, false, false, false) dxDrawText("# #\n# #\n# #\n", (screenW * 0.5864) + 1, (screenH * 0.3411) + 1, (screenW * 0.6384) + 1, (screenH * 0.5130) + 1, tocolor(0, 0, 0, 255), 1.50, "beckett", "center", "top", false, false, false, false, false) dxDrawText("# #\n# #\n# #\n", screenW * 0.5864, screenH * 0.3411, screenW * 0.6384, screenH * 0.5130, tocolor(0, 252, 237, 255), 1.50, "beckett", "center", "top", false, false, false, false, false) dxDrawText("# #\n# #\n# #\n", (screenW * 0.5344) - 1, (screenH * 0.5586) - 1, (screenW * 0.5864) - 1, (screenH * 0.7305) - 1, tocolor(0, 0, 0, 255), 1.50, "beckett", "center", "top", false, false, false, false, false) dxDrawText("# #\n# #\n# #\n", (screenW * 0.5344) + 1, (screenH * 0.5586) - 1, (screenW * 0.5864) + 1, (screenH * 0.7305) - 1, tocolor(0, 0, 0, 255), 1.50, "beckett", "center", "top", false, false, false, false, false) dxDrawText("# #\n# #\n# #\n", (screenW * 0.5344) - 1, (screenH * 0.5586) + 1, (screenW * 0.5864) - 1, (screenH * 0.7305) + 1, tocolor(0, 0, 0, 255), 1.50, "beckett", "center", "top", false, false, false, false, false) dxDrawText("# #\n# #\n# #\n", (screenW * 0.5344) + 1, (screenH * 0.5586) + 1, (screenW * 0.5864) + 1, (screenH * 0.7305) + 1, tocolor(0, 0, 0, 255), 1.50, "beckett", "center", "top", false, false, false, false, false) dxDrawText("# #\n# #\n# #\n", screenW * 0.5344, screenH * 0.5586, screenW * 0.5864, screenH * 0.7305, tocolor(252, 249, 0, 255), 1.50, "beckett", "center", "top", false, false, false, false, false) dxDrawLine(screenW * 0.5322, screenH * 0.5339, screenW * 0.6457, screenH * 0.5339, tocolor(47, 252, 0, 255), 5, false) end function OPEN() if removeEventHandler('onClientRender', root, Skins_panel) then removeEventHandler('onClientRender', root, Skins_panel) guiSetVisible(Skins_grid,false) guiSetVisible(Skin_changer,false) guiSetVisible(Skins_close,false) showCursor(false) else addEventHandler('onClientRender', root, Skins_panel) guiSetVisible(Skins_grid,true) guiSetVisible(Skin_changer,true) guiSetVisible(Skins_close,true) showCursor(true) end end bindKey( "F2", "down", OPEN) for i,v in ipairs( skins ) do row = guiGridListAddRow(Skins_grid) guiGridListSetItemText( Skins_grid, row, 1, tostring(v[1]), false, false ) guiGridListSetItemText( Skins_grid, row, 2, tonumber(v[2]), false, false ) guiGridListSetItemData( Skins_grid, row, 1, tonumber(v[2]) ) guiGridListSetItemColor( Skins_grid, row, 1, math.random(255),math.random(255),math.random(255) ) guiGridListSetItemColor( Skins_grid, row, 2, math.random(255),math.random(255),math.random(255) ) end addEventHandler('onClientGUIClick', root, function() if (source == Skins_close) then removeEventHandler('onClientRender', root, Skins_panel) guiSetVisible(Skins_grid,false) guiSetVisible(Skin_changer,false) guiSetVisible(Skins_close,false) showCursor(false) elseif (source == Skin_changer) then local Data = guiGridListGetItemData( Skins_grid, guiGridListGetSelectedItem ( Skins_grid ), 1 ) triggerServerEvent( 'ChangeSkin', localPlayer, Data ) end end ) I want to replace the skin with the database depend on each account i already made the database called skinslot with 2 column "name" and "skinid" somebody please help me Link to comment
Spakye Posted April 20, 2020 Share Posted April 20, 2020 If you are using mta account system you dont need a data base just to store a skin, use setAccountData() to save the skin then when the player join use getAccountData() to get the skin and apply it to the player Link to comment
synskidz Posted April 21, 2020 Author Share Posted April 21, 2020 no, its not save resource. this resource means many skins on 1 account Link to comment
Spakye Posted April 21, 2020 Share Posted April 21, 2020 then use toJson to store the skin table in the database Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now