Jump to content

Walid

Members
  • Posts

    1,491
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Walid

  1. -- Client Side local sx,sy = guiGetScreenSize () local width = 250 local height = 400 addEventHandler("onClientResourceStart",resourceRoot, function() ateamablak = guiCreateWindow (sx/2-width/2,sy/2-height/2,width,height,"servername - adminteam",false) Bezaras = guiCreateButton (10,height-30,width-20,22,"Close",false,ateamablak) lista = guiCreateGridList (10,25,width-20,height-60,false,ateamablak) d3 = guiGridListAddColumn (lista,"Rang",0.35) d2 = guiGridListAddColumn (lista,"Név",0.43) guiWindowSetMovable(ateamablak, false) guiWindowSetSizable(ateamablak, false) guiSetVisible(ateamablak, false) addEventHandler ("onClientGUIClick", Bezaras, CloseGui,false) end ) function listAllOfAdminRender(table) guiSetVisible( ateamablak, true) showCursor (true) guiSetInputEnabled(true) guiGridListClear(lista) for k,v in pairs(table) do local row = guiGridListAddRow ( lista ) guiGridListSetItemText ( lista, row, d2, v[1], false, false ) guiGridListSetItemText ( lista, row, d3, v[2], false, false ) end end addEvent("listAllOfAdminRender", true) addEventHandler("listAllOfAdminRender", resourceRoot, listAllOfAdminRender) function CloseGui(button, state) if (button == "left") and (state == "up") then guiSetVisible(ateamablak, false) showCursor (false) guiSetInputEnabled(false) end end -- Server side local connection = dbConnect( "mysql", exports.roleplay_global:getSQLData() ) function listAllOfAdmin(player) admins = {} local query = dbQuery(connection,"SELECT * FROM `account` WHERE `admin` >= '1'") local result = dbPoll(query, -1) local aNick, adminLevel if result then for k, data in ipairs (result) do aNick = data["anick"] adminLevel = data["admin"] table.insert(admins,{aNick,adminLevel}) triggerClientEvent(player,"listAllOfAdminRender", resourceRoot, admins) end else return end dbFree(query) end addCommandHandler("asd", listAllOfAdmin)
  2. explane your problem better, post some SS here. /debugscript
  3. Try this function updatePlayerBlips() if not g_PlayerData then return end local wnd = isWindowOpen(wndSpawnMap) and wndSpawnMap or wndSetPos local mapControl = getControl(wnd, 'map') for elem,player in pairs(g_PlayerData) do if not player.gui.mapBlip then player.gui.mapBlip = guiCreateStaticImage(0, 0, 9, 9, elem == g_Me and 'localplayerblip.png' or 'playerblip.png', false, mapControl) player.gui.mapLabelShadow = guiCreateLabel(0, 0, 100, 14, player.name, false, mapControl) local labelWidth = guiLabelGetTextExtent(player.gui.mapLabelShadow) local r, g, b = getPlayerNametagColor (elem) guiSetSize(player.gui.mapLabelShadow, labelWidth, 14, false) guiSetFont(player.gui.mapLabelShadow, 'default-bold-small') guiLabelSetColor(player.gui.mapLabelShadow, r, g, b) player.gui.mapLabel = guiCreateLabel(0, 0, labelWidth, 14, player.name, false, mapControl) guiSetFont(player.gui.mapLabel, 'default-bold-small') guiLabelSetColor(player.gui.mapLabel, 0, 0, 0) for i,name in ipairs({'mapBlip', 'mapLabelShadow'}) do addEventHandler('onClientGUIDoubleClick', player.gui[name], function() server.warpMe(elem) closeWindow(wnd) end, false ) end end local x, y = getElementPosition(elem) x = math.floor((x + 3000) * g_MapSide / 6000) - 4 y = math.floor((3000 - y) * g_MapSide / 6000) - 4 guiSetPosition(player.gui.mapBlip, x, y, false) guiSetPosition(player.gui.mapLabelShadow, x + 14, y - 4, false) guiSetPosition(player.gui.mapLabel, x + 13, y - 5, false) end end
  4. Clear the grid list before adding new rows all what you need is guiGridListClear() like this local ateamablak = nil function listAllOfAdminRender(anick, alvl) if (ateamablak == nil) then guiSetInputEnabled(true) local sx,sy = guiGetScreenSize () local width = 250 local height = 400 local ateamablak = guiCreateWindow (sx/2-width/2,sy/2-height/2,width,height,"servername - adminteam",false) local Bezaras = guiCreateButton (10,height-30,width-20,22,"Close",false,ateamablak) local lista = guiCreateGridList (10,25,width-20,height-60,false,ateamablak) local d3 = guiGridListAddColumn (lista,"Rang",0.35) local d2 = guiGridListAddColumn (lista,"Név",0.43) guiWindowSetMovable(ateamablak, false) guiWindowSetSizable(ateamablak, false) guiGridListClear(lista) local row = guiGridListAddRow ( lista ) guiGridListSetItemText ( lista, row, d2, anick, false, false ) guiGridListSetItemText ( lista, row, d3, alvl, false, false ) guiBringToFront (Bezaras) guiSetVisible (ateamablak, true) addEventHandler ("onClientGUIClick", Bezaras, function(button, state) if (button == "left") then if (state == "up") then guiSetVisible(ateamablak, false) showCursor (false) guiSetInputEnabled(false) ateamablak = nil end end end, false) else local lathato = guiGetVisible (ateamablak) if (lathato == false) then guiSetVisible( ateamablak, true) showCursor (true) else showCursor(false) end end end addEvent("listAllOfAdminRender", true) addEventHandler("listAllOfAdminRender", resourceRoot, listAllOfAdminRender)
  5. Hello everybody Today in this tutorial i will explain to you the arithmetic, relational, and logical operators one by one. it's easy just try to follow my tutorial step by step . Arithmetic Operators: `+´ , `-´ , `*´ , `/´ , `-´ , `^´ Relational Operators : `<´ , `>´ , `<=´ , `>=´ , `==´ , `~=´ Logical Operators: `and´, `or´, `not´ Misc Operators: `..´, `# Following table shows all the arithmetic operators supported by Lua language. Relational operators are supplied which return the boolean values true or false. Following table shows all the logical operators supported by Lua language Also there is Miscellaneous operators supported by Lua Language include concatenation and length.
  6. try this it should work table = {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100} function getNearestValue(table, number) local index, value for i, y in ipairs(table) do if not index or (math.abs(number-y) < index) then index = math.abs(number - y) value = i end end return table[value] end -- Your code local nitro = getVehicleNitroLevel(getPedOccupiedVehicle(getLocalPlayer())) local id = 8 local slot = getVehicleUpgradeOnSlot(vehicle, tonumber(id)) if slot then if nitro ~= false and nitro ~= nil and nitro > 0 then dxDrawImage(x*960+x2, y*470+y2, 306, 232, "files/nitro/"..getNearestValue(table,(math.floor(nitro/1*100)))..".png", 0,0,0, tocolor(255, 255, 255 , 255)) end end
  7. 0.png, 5.png, 10.png, 15.png, 20.png, 25.png, 30.png........ (100.png) add 100 pictures , i think it's a lot anyways local nitro = getVehicleNitroLevel(getPedOccupiedVehicle(getLocalPlayer())) local id = 8 local slot = getVehicleUpgradeOnSlot(vehicle, tonumber(id)) if slot then if nitro ~= false and nitro ~= nil and nitro > 0 then dxDrawImage(x*960+x2, y*470+y2, 306, 232, "files/nitro/"..(math.floor(nitro/1*100))..".png", 0,0,0, tocolor(255, 255, 255 , 255)) end end
  8. Walid

    Doesn't work

    All what you need is setTimer isTimer
  9. Walid

    Doesn't work

    :3 function dxDraw() dxDrawText("You are now AFK!\nType /afk to come back!", 432, 266, 1015, 331, tocolor(255, 255, 255, 255), 2.00, "bankgothic", "left", "top", false, false, false, false, false) end function setPlayerAFK() local wanted = getPlayerWantedLevel(localPlayer) if isPedInVehicle(localPlayer) or wanted > 1 then return outputChatBox("Unable to go AFK!", 255, 0, 0) end if getElementData(localPlayer,"afk") then setElementFrozen(localPlayer, false) setElementData(localPlayer, "afk", false) setElementAlpha(localPlayer, 255) removeEventHandler("onClientRender", root, dxDraw) fadeCamera(true) else setElementFrozen(localPlayer, true) setElementData(localPlayer, "invincible", true) setElementAlpha(localPlayer, 100) fadeCamera(false) addEventHandler("onClientRender", root, dxDraw) setElementData(localPlayer, "afk", true) end end addCommandHandler("afk", setPlayerAFK)
  10. Walid

    Doesn't work

    it must be like this if getElementData(localPayer,"afk") == true then
  11. Walid

    Doesn't work

    function dxDraw() dxDrawText("You are now AFK!\nType /afk to come back!", 432, 266, 1015, 331, tocolor(255, 255, 255, 255), 2.00, "bankgothic", "left", "top", false, false, false, false, false) end function setPlayerAFK() local wanted = getPlayerWantedLevel(localPlayer) if getElementData(localPlayer, "afk", true) then return outputChatBox("You are already AFK!", 255, 0, 0) end if isPedInVehicle(localPlayer) or wanted > 1 then return outputChatBox("Unable to go AFK!", 255, 0, 0) end if getElementData(localPlayer, "afk") then setElementFrozen(localPlayer, false) setElementData(localPlayer, "afk", false) setElementAlpha(localPlayer, 255) removeEventHandler("onClientRender", root, dxDraw) fadeCamera(true) else setElementFrozen(localPlayer, true) setElementData(localPlayer, "invincible", true) setElementAlpha(localPlayer, 100) fadeCamera(false) addEventHandler("onClientRender", root, dxDraw) setElementData(localPlayer, "afk", true) end end addCommandHandler("afk", setPlayerAFK)
  12. Walid

    no

    Does the command "/load" work when you use it in F8? The command is in server side or client side?
  13. i know The closing tag of a PHP block at the end of a file is optional, but in some cases omitting it is helpful when using include() or require().
  14. Walid

    help

    it's server side code check your meta.xml file
  15. baz it's not defined in your code. attachElements ( baz, nemesi, 0.2, 0.1, 0.5, 0, 90, 0 )
  16. Walid

    help

    there is nothing wrong here.
  17. i recommand you to use db functions. dbConnect dbExec dbQuery dbPoll dbFree Anyways executeSQLQuery( 'CREATE TABLE IF NOT EXISTS SerialData ( serialPlayer TEXT, key STRING, value TEXT )' ) function setSerialData(serial,key,value) if getSerialData( serial, key ) then executeSQLQuery( 'UPDATE SerialData SET serialPlayer = ?, key = ?, value = ?', serial, tostring(key), tostring(value)) else executeSQLQuery( 'INSERT INTO SerialData( serialPlayer, key, value ) VALUES( ?, ?, ? )', serial, tostring(key), tostring(value)) end end function getSerialData(serial,key) local result = executeSQLQuery( 'SELECT value FROM SerialData WHERE key = ? AND serialPlayer = ?', tostring(key), serial ) if type(result) == "table" and #result == 0 or not result then return false else return tostring (result[1]["value"]) end end function removeSerialData(serial,key) if getSerialData(serial,key) then executeSQLQuery( 'DELETE FROM SerialData WHERE key = ? AND serialPlayer = ?', tostring(key), serial ) return true end end function Load(_,cur) local serial = getAccountSerial (cur) if serial then -- Your Code here end end addEventHandler("onPlayerLogin",root,Load)
  18. local colRec = createColRectangle (-1203.599609375, 2814.75, 500,500) local colRad = createRadarArea (-782.689453125, 656.4794921875, 1700,2200,0,0,0,100) local col = {colRec,colRad} addEventHandler ("onClientPlayerDamage",localPlayer, function (attacker) for i , v in pairs (col) do if isElementWithinColShape (source, v) then cancelEvent () end end end )
  19. Walid

    .

    lol just replace equal with bigger than. function setMuscle(player,cmd,number) if isElement(player) then if not tonumber(number) then return end if getPedStat(player,23) > 1000 then return end setPedStat (player,23, tonumber(number)) end end addCommandHandler("muscle",setMuscle) /muscle 800
  20. Walid

    .

    Try this function setMuscle(player,cmd,number) if isElement(player) then if not tonumber(number) then return end if getPedStat(player,23) == 1000 then return end setPedStat (player,23, tonumber(number)) end end addCommandHandler("muscle",setMuscle)
  21. Walid

    Music

    make sound as a global variable , just remove local then use sth like this if ( sound and isElement(sound)) then stopSound (sound ) -- or destroy it destroyElement(sound) end
  22. @Xeon that's wrong you need to add the element here anyways function onGuiClick() if (source == GUIEditor.button[1]) then local rowa = guiGridListGetSelectedItem( GUIEditor.gridlist[1] ) local namea = guiGridListGetItemText( GUIEditor.gridlist[1], rowa, columna) local rowb = guiGridListGetSelectedItem( GUIEditor.gridlist[2] ) local nameb = guiGridListGetItemText( GUIEditor.gridlist[2], rowb, columnb) if (rowa and rowa ~= -1) then if namea == "Pershing Square" then triggerServerEvent("pershingsquarespawn", localPlayer) elseif namea == 'Idlewood Gas Station (IGS)' triggerServerEvent("IGS", localPlayer) end elseif (rowb and rowb ~= -1) then if nameb == "Army (287)" then setElementModel(localPlayer,287) end end guiSetVisible(GUIEditor.window[1], false) showCursor(false) end end addEventHandler("onClientGUIClick", root, onGuiClick)
  23. this function it only enable/disable the GUI element and he is asking about How to disable pasting in a edit box.
  24. What i already tested it , working fine try to stop the resource delete the db then start the resource. I reconnected from my server and work finally Thank you. You are welcome.
×
×
  • Create New...