Jump to content

kikos500

Members
  • Posts

    125
  • Joined

  • Last visited

Everything posted by kikos500

  1. function openIventory() invWindow = guiCreateWindow(0.00, 0.00, 1.00, 1.00, "", true) guiSetVisible(invWindow, false) guiWindowSetMovable(invWindow, false) guiWindowSetSizable(invWindow, false) guiSetAlpha(invWindow, 1.00) guiSetProperty(invWindow, "CaptionColour", "6CFEFEFE") invText = guiCreateLabel(0.01, 0.08, 0.12, 0.05, "Inventory", true, invWindow) local font0_invfont = guiCreateFont(":guieditor/fonts/invfont.ttf", 20) guiSetFont(invText, font0_invfont) guiLabelSetColor(invText, 240, 249, 5) mainWep = guiCreateButton(0.01, 0.16, 0.12, 0.08, "Main Weapon", true, invWindow) local font1_secondfont = guiCreateFont(":inventory/secondfont.ttf", 10) guiSetFont(mainWep, font1_secondfont) guiSetProperty(mainWep, "NormalTextColour", "FEFEFFFF") secWep = guiCreateButton(0.01, 0.30, 0.12, 0.08, "Secondary Weapon", true, invWindow) guiSetFont(secWep, font1_secondfont) guiSetProperty(secWep, "NormalTextColour", "FFFEFEFE") specWep = guiCreateButton(0.01, 0.43, 0.12, 0.08, "Special Weapon", true, invWindow) guiSetFont(specWep, font1_secondfont) guiSetProperty(specWep, "NormalTextColour", "FFFEFEFE") cosmOne = guiCreateButton(0.34, 0.16, 0.12, 0.08, "Cosmetic", true, invWindow) guiSetFont(cosmOne, font1_secondfont) guiSetProperty(cosmOne, "NormalTextColour", "FEFEFEFE") cosmTwo = guiCreateButton(0.34, 0.30, 0.12, 0.08, "Cosmetic", true, invWindow) guiSetFont(cosmTwo, font1_secondfont) guiSetProperty(cosmTwo, "NormalTextColour", "FFFEFEFE") cosmThree = guiCreateButton(0.34, 0.43, 0.12, 0.08, "Cosmetic", true, invWindow) guiSetFont(cosmThree, font1_secondfont) guiSetProperty(cosmThree, "NormalTextColour", "FFFEFEFE") btnClose = guiCreateButton(0.88, 0.94, 0.10, 0.05, "Close", true, invWindow) local font2_invfont = guiCreateFont(":guieditor/fonts/invfont.ttf", 10) guiSetFont(btnClose, font2_invfont) end addEventHandler( "onClientResourceStart", resourceRoot, openIventory) function bind() guiSetVisible(invWindow, not guiGetVisible(invWindow)) showCursor(guiGetVisible(invWindow)) end bindKey("i", "down", bind)
  2. didn't know about that never did much with account data anyways
  3. function regen() for i,v in pairs(getElementsByType("player")) do if isObjectInACLGroup( "user."..getPlayerName(v), aclGetGroup("VIP")) then setElementHealth (v, getElementHealth (v) + 15) end end end setTimer(regen, 5000, 0) function Join() outputChatBox("health regen", source, 0, 255, 255, true) end addEventHandler("onClientPlayerJoin", getRootElement(), Join) didn't test it use it server side not client
  4. function getPedWeapons(ped) local playerWeapons = {} if ped and isElement(ped) and getElementType(ped) == "ped" or getElementType(ped) == "player" then for i=2,9 do local wep = getPedWeapon(ped,i) if wep and wep ~= 0 then table.insert(playerWeapons,wep) end end else return false end return playerWeapons end function saveData() local account = getPlayerAccount(source) if not account or isGuestAccount(account) then return end local playermoney = getPlayerMoney(source) setAccountData(account, "test.money", playermoney) setAccountData(playeraccount, "test.weps", getPedWeapons(source)) end function loadData(_, account) if account then local playermoney = getAccountData(account, "test.money") local playerweps = getAccountData(account, "test.weps") if playermoney then setPlayerMoney (source, playermoney) end if playerweps then for i,v in pairs(playerweps) do giveWeapon(source, v) end end end end function resetData(account) local playermoney = getPlayerMoney(source) setAccountData(account, "test.money", playermoney) setAccountData(playeraccount, "test.weps", getPedWeapons(source)) takeAllWeapons(source) setPlayerMoney(source, 0) end addEventHandler ("onPlayerQuit", getRootElement (), saveData) addEventHandler ("onPlayerLogin", getRootElement (), loadData) addEventHandler ("onPlayerLogout", getRootElement (), resetData) Well I'm not sure that it will work but it's worth a try
  5. we don't write scripts for free we only help people learn and i don't think anyone will understand what u need with this kind of explanation
  6. kikos500

    Help

    Attempt to preform arthemic on a nil value is most likely because you are trying to do an arithmetic operation on a variable without a value without the code we can't really help you.
  7. I'm not sure about it but i think this what you are searching for https://wiki.multitheftauto.com/wiki/Server_mtaserver.conf check the auth_serial_http part i searched in most mta files now i still can't find anything related to login so i think you can turn it off from mta server configuration file
  8. function createList(x,y,w,h,parent) local id = #elements_Table.list + 1 elements_Table.list[id] = {} if not x or not y or not w or not h then outputDebugString("Error: Missing some arguments (x,y,w,h)") end elements_Table.list[id].type = "list" elements_Table.list[id].x = x elements_Table.list[id].y = y elements_Table.list[id].px = x elements_Table.list[id].py = y elements_Table.list[id].w = w elements_Table.list[id].h = h elements_Table.list[id].parent = parent or nil elements_Table.list[id].visible = false elements_Table.list[id].items = {} elements_Table.list[id].selected = 0 elements_Table.list[id].scroll = 0 elements_Table.list[id].postgui = false elements_Table.list[id].itc = {50,255,50} elements_Table.list[id].scc = {50,255,50} elements_Table.list[id].rTarget = dxCreateRenderTarget(w, h, true) if parent then table.insert(parent.children,elements_Table.list[id]) elements_Table.list[id].x = elements_Table.list[id].x + parent.px elements_Table.list[id].y = elements_Table.list[id].y + parent.py end return elements_Table.list[id] end function addItem(grid,text,data) if grid then table.insert(grid.items,{text = text, alpha = 0, data = data or nil}) return #grid.items end return false end function getData(grid) return grid.items[selected].data end function resetGrid(grid) grid.items = {} end function onHover() for _,list in pairs(elements_Table.list) do local num = list.h/20 for i = 1+list.scroll, num+list.scroll do local posrow = i - list.scroll if not list.items[i] then return end if isCursorHover(list.x,list.y+(posrow*20)-20,list.w,20) then list.items[i].alpha = 150 else list.items[i].alpha = 0 end end end end addEventHandler( "onClientRender", root, onHover) addEvent("onGridListSelected", true) function onClick(button,state) if button == "left" and state == "down" then for i,list in pairs(elements_Table.list) do local num = list.h/20 for i = 1+list.scroll, num+list.scroll do local posrow = i - list.scroll if isCursorHover(list.x,list.y+(posrow*20)-20,list.w,20) then list.selected = i triggerEvent("onGridListSelected", root, i) end end end end end addEventHandler( "onClientClick", root, onClick ) function getData(grid) return grid.items[grid.selected] end function scrollDown() for i,v in pairs(elements_Table.list) do if isCursorHover(v.x,v.y,v.w,v.h) then if v.scroll+(v.h/20) < #v.items then v.scroll = v.scroll+1 end end end end bindKey("mouse_wheel_down", "down", scrollDown) function scrollUp() for i,v in pairs(elements_Table.list) do if isCursorHover(v.x,v.y,v.w,v.h) then if v.scroll > 0 then v.scroll = v.scroll-1 end end end end bindKey("mouse_wheel_up", "down", scrollUp) function renderList() for i,v in pairs(elements_Table.list) do if v.visible then dxDrawRectangle(v.x,v.y,v.w,v.h,tocolor(0,0,0,200)) local num = v.h/20 for i = 1+v.scroll, num+v.scroll do local posrow = i - v.scroll if v.items[i] then if v.selected ~= i then dxDrawRectangle( v.x, v.y+(posrow*20)-20, v.w, 20,tocolor(v.itc[1],v.itc[2],v.itc[3],v.items[i].alpha)) else dxDrawRectangle( v.x, v.y+(posrow*20)-20, v.w, 20,tocolor(50,255,50,255,255)) end dxDrawText(v.items[i].text,v.x + 1,v.y+(posrow*20)-20,v.w+v.x,v.y,tocolor(255,255,255,255),1,"default-bold","left","top",false,false) end end dxSetRenderTarget(v.rTarget,true) dxDrawImage(v.x, v.y, v.w, v.h, v.rTarget,0,0,0,tocolor(255,255,255,155)) dxSetRenderTarget() if num < #v.items and #v.items*20 > v.h then local size = (v.h-(v.h/3))/(#v.items - num) local endX = (((v.h - size) / (#v.items - num)) * v.scroll) dxDrawRectangle( v.x+v.w, v.y, 10, v.h, tocolor(0,0,0,100)) dxDrawRectangle( v.x+v.w, v.y+endX, 10, size, tocolor(v.scc[1],v.scc[2],v.scc[3], 255)) end end end end addEventHandler( "onClientRender", root, renderList) so this is the new code i tried doing it but now the scroll goes out of bounds like https://i.imgur.com/rktYddV.png
  9. man look at my code carefully.. replace this one addEventHandler( "onClientPlayerDamage", localPlayer, onPlayerHeadshot ) with addEventHandler( "onClientPlayerDamage", localPlayer, checkHeadDamage )
  10. local multiply = 5 function checkHeadDamage(attacker, weapon, part, loss) if not attacker or not ( getElementType( attacker ) == "player" ) then return false end if part == 9 then outputChatBox("This is a test output the player u shot at should be dead now", root) setElementHealth(localPlayer, 0) end end addEventHandler( "onClientPlayerDamage", localPlayer, checkHeadDamage) try this function damage( attacker, weapon, bodypart, loss ) if ( bodypart == 9 ) then outputChatBox ( "Headshot!", getRootElement (), 255, 170, 0 ) setElementHealth(source, (getElementHealth(source)/2)) end end addEventHandler ( "onPlayerDamage", getRootElement (), damage) try this one too but try this one server sided
  11. local multiply = 5 function checkHeadDamage(attacker, weapon, part, loss) if not attacker or not ( getElementType( attacker ) == "player" ) then return false end if part == 9 then setElementHealth(localPlayer, (getElementHealth(localPlayer) - (loss * multiply))) end end addEventHandler( "onClientPlayerDamage", localPlayer, checkHeadDamage) if this doesn't work try addEventHandler( "onClientPlayerDamage", getRootElement(), checkHeadDamage) but try the code i posted up first
  12. what do u mean by driving drunk?
  13. kikos500

    lua problem

    triggerServerEvent("addPlayerToGroup", getRootElement(), localPlayer, guiGridListGetSelectedItem(groupGrid)) try this
  14. uhh the script is mine i released it to community a few months ago its just that i always had a problem with scroll bars
  15. uhh for example i don't know how to make it scroll i tried looking at some examples but with no result and i don't know how to draw it well a general explaining would be good
  16. i made the same topic some months ago but still i wasn't able to finish my dx list scroll system i would really be grateful if someone can help me finish it function createList(x,y,w,h,parent) local id = #elements_Table.list + 1 elements_Table.list[id] = {} if not x or not y or not w or not h then outputDebugString("Error: Missing some arguments (x,y,w,h)") end elements_Table.list[id].x = x elements_Table.list[id].y = y elements_Table.list[id].w = w elements_Table.list[id].h = h elements_Table.list[id].parent = parent or nil elements_Table.list[id].visible = false elements_Table.list[id].items = {} elements_Table.list[id].selected = 0 elements_Table.list[id].scroll = 0 if parent then table.insert(parent.children,elements_Table.list[id]) elements_Table.list[id].x = elements_Table.list[id].x + parent.px elements_Table.list[id].y = elements_Table.list[id].y + parent.py end return elements_Table.list[id] end function addItem(grid,text) if grid then table.insert(grid.items,{text = text, alpha = 0}) return #grid.items end return false end function onHover() for _,list in pairs(elements_Table.list) do local num = list.h/20 for i = 1+list.scroll, num+list.scroll do local posrow = i - list.scroll if isCursorHover(list.x,list.y+(posrow*20)-20,list.w,20) then list.items[i].alpha = 150 else list.items[i].alpha = 0 end end end end addEventHandler( "onClientRender", root, onHover) function onClick() for i,list in pairs(elements_Table.list) do local num = list.h/20 for i = 1+list.scroll, num+list.scroll do local posrow = i - list.scroll if isCursorHover(list.x,list.y+(posrow*20)-20,list.w,20) then list.selected = i end end end end addEventHandler( "onClientClick", root, onClick ) function scrollDown() for i,v in pairs(elements_Table.list) do if isCursorHover(v.x,v.y,v.w,v.h) then if v.scroll+(v.h/20) < #v.items then v.scroll = v.scroll+1 end end end end bindKey("mouse_wheel_down", "down", scrollDown) function scrollUp() for i,v in pairs(elements_Table.list) do if isCursorHover(v.x,v.y,v.w,v.h) then if v.scroll > 0 then v.scroll = v.scroll-1 end end end end bindKey("mouse_wheel_up", "down", scrollUp) function renderList() for i,v in pairs(elements_Table.list) do if v.visible then dxDrawRectangle(v.x,v.y,v.w,v.h,tocolor(0,0,0,150)) local num = v.h/20 for i = 1+v.scroll, num+v.scroll do local posrow = i - v.scroll if v.items[i] then if v.selected ~= i then dxDrawRectangle( v.x, v.y+(posrow*20)-20, v.w, 20,tocolor(0,0,0,v.items[i].alpha)) else dxDrawRectangle( v.x, v.y+(posrow*20)-20, v.w, 20,tocolor(0,0,0,255)) end dxDrawText(v.items[i].text,v.x + 1,v.y+(posrow*20)-20,v.w+v.x,v.y,tocolor(255,255,255,255),1,"default-bold","left","top") end end local endX = v.scroll * 20 dxDrawRectangle( v.x+v.w, v.y+endX, 10, num*20) end end end addEventHandler( "onClientRender", root, renderList)
  17. kikos500

    /login

    local ErrorMessage = "Error: /login <user> <pass>" function login(p, _, user, pass) if not user or not pass then outputChatBox(ErrorMessage, p) end end addCommandHandler("login", login) its worth a try but the login command doesn't it normally do that when u don't type a username or password?
  18. actually i wouldn't recommend this library if u want to create a server use this one its much better
  19. any ideas how @thisdp
  20. ok I have another question if I to add a car painjob on the car roof how can I do that? maybe replace a mta object with a custom object with a txd looking like the paint that I want?
  21. it didn't work @Hale and in a lot of servers with car skins but I can see others skins too @Justin|X5|
  22. function getJarmuElet() local jatekosVehicle = getPedOccupiedVehicle ( localPlayer ) if not jatekosVehicle then return end local jarmuHealth = getElementHealth ( jatekosVehicle ) / 10 if jatekosVehicle and jarmuHealth then return jarmuHealth else return nil end end try this
  23. Wow i am amazed that you released this script just by looking at the code i can tell how much time you spent on this. tbh i never thought that someone will release a fully usable dxlibrary i released a one a few months ago but i got lazy lol here is it if anyone is interested
×
×
  • Create New...