Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 28/04/23 in all areas

  1. eagleLoader Custom map loader for MTA:SA Allows for custom maps to be imported in MTA:SA Loads new models alongside the default SA models Quickly and efficiently loads maps If configured right draw distance comparable to the default map Github (Download & Documentation) Eagle Inc Discord (Support & Community) Newer supported relative to MTA-Stream / J-Stream Support : Join our discord Comment on in Feedback on github Official maps using this system : Vice City Liberty City
    1 point
  2. As alterações que mostrei era pra você mexer somente nas funções que mostrei. Não era pra apagar o resto do seu código.
    1 point
  3. Tested and works. Well here is the code: Server side -- replace the old function myskins with the new one i found some bugs in old one. --And then add the new event "ChangeSkin" function myskins(thePlayer,commandName) if thePlayer then local acc = getPlayerAccount( thePlayer ) local acc_name = getAccountName( acc ) local q = dbQuery(connection,"SELECT username,skin FROM skins WHERE username=?",tostring(acc_name)) local rezult = dbPoll(q,-1) if #rezult > 0 then triggerClientEvent(thePlayer,"skin_inventory",thePlayer,rezult) end end end addCommandHandler("myskins",myskins,false,false) addEvent("ChangeSkin",true) change_skin = function(Player,skin) if source == Player and client == source then setElementModel(Player,skin) end end addEventHandler("ChangeSkin",getRootElement(),change_skin) Client side -- just replace all the code with this there are few changes but maybe u insert them wrong or not so u better replace all the code with this. function centerWindow (center_window) --- a function to put the window in the center of the screen local screenW, screenH = guiGetScreenSize() local windowW, windowH = guiGetSize(center_window, false) local x, y = (screenW - windowW) /2,(screenH - windowH) /2 return guiSetPosition(center_window, x, y, false) end addEvent("skin_inventory",true) -- we add the skin_inventory event client side so we can call it from server side function skin_inventory_gui(rezult) -- here we have our table sent from server to client skin_list = guiCreateWindow(329, 246, 465, 381, "MY SKINS", false) centerWindow(skin_list) guiWindowSetMovable(skin_list, false) guiWindowSetSizable(skin_list, false) skins = guiCreateGridList(9, 20, 376, 351, false, skin_list) guiGridListAddColumn(skins, "Description", 0.5) guiGridListAddColumn(skins, "Model/Skin Owned", 0.5) close = guiCreateButton(389, 20, 66, 21, "X", false, skin_list) set_skin = guiCreateButton(389, 40, 66, 21, "SET SKIN", false, skin_list) guiSetProperty(close, "NormalTextColour", "FFAAAAAA") showCursor(true) for key, value in ipairs(rezult) do -- we loop through table local row = guiGridListAddRow(skins) -- so for each result we get we insert a row with guiGridListSetItemText (skins, row, 1, "Skin Model ->", false, true) -- this value guiGridListSetItemText (skins, row, 2, value.skin, false, true) --- and skin model / id end addEventHandler ( "onClientGUIClick", close, closeinventory,false) -- event for close function and button!!! addEventHandler ( "onClientGUIClick", set_skin, closeinventory,false) -- event for set_skin button !!! end addEventHandler("skin_inventory",root,skin_inventory_gui) closeinventory = function(button,state) --- function to close the gui window and change the skin if (button == "left") and (state == "up") then if source == set_skin then if (guiGridListGetSelectedItem (skins)) then local skin_to_change = guiGridListGetItemText (skins, guiGridListGetSelectedItem (skins), 2) triggerServerEvent("ChangeSkin",localPlayer,localPlayer,skin_to_change) outputChatBox("[SKIN SYSTEM] You have changed your skin",160,255,160) end end showCursor (false) guiSetVisible(skin_list,false) end end
    1 point
×
×
  • Create New...