Jump to content

GTX

Members
  • Posts

    1,273
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by GTX

  1. GTX

    I have problem

    Oh then, guiGridListSetSelectedItem
  2. GTX

    3d line

    Don't really know how he did it, but I think he replaced an object in MTA and then constantly create it. Or he drawn material line and then somehow check if an element hits it.
  3. local sound function startSound (killer, weapon, bodypart) sound = playSound("Spawn/music/music.mp3") setSoundVolume(sound, 0.5) end addEventHandler("onClientPlayerWasted", getLocalPlayer(), startSound) function destroySound() if isElement(sound) then stopSound(sound) end end addEventHandler("onClientPlayerSpawn", getLocalPlayer(), destroySound)
  4. GTX

    I have problem

    Tested your script. It works fine. local x, y = 1,1 window = guiCreateWindow(519*x,214*y,347*x,282*y,"24/7 Shop",false) sevenShopList = guiCreateGridList(11*x,25*y,326*x,218*y,false,window) guiGridListSetSelectionMode(sevenShopList,0) guiGridListAddColumn(sevenShopList,"ID:",0.19,window) guiGridListAddColumn(sevenShopList,"Name:",0.48,window) guiGridListAddColumn(sevenShopList,"Price",0.18,window) buy = guiCreateButton(13*x,249*y,134*x,23*y,"Buy",false,window) reject = guiCreateButton(199*x,249*y,134*x,23*y,"Close ",false,window) guiWindowSetSizable(window,false) --guiSetVisible (window,false) local client = getLocalPlayer() Weapons = { {1,1,400}, {2,2,1500}, {5,5,550}, {6,6,700}, {7,7,850}, {8,8,1500}, {9,9,2000}, {10,10,800}, {12,12,800}, {12,12,800},{12,12,800},{12,12,800},{12,12,800},{12,12,800},{12,12,800},{12,12,800},{12,12,800} } function DD() for k,v in ipairs (Weapons) do local row = guiGridListAddRow(sevenShopList) guiGridListSetItemText(sevenShopList, row, 1,v[1], false, false) guiGridListSetItemText(sevenShopList, row, 2, getWeaponNameFromID(v[2]), false, false) guiGridListSetItemText (sevenShopList, row, 3,tostring(v[3]).."$" , false, false) end end function weaponGUI(Weapons) guiGridListClear(sevenShopList) DD() guiSetVisible(window, true) showCursor(true) end addEvent("sevenShopshowGUI",true) addEventHandler("sevenShopshowGUI",root,weaponGUI) addEventHandler("onClientGUIClick",root, function () if (source == reject) then guiSetVisible(window, false) showCursor(false) elseif (source == buy) then if (guiGridListGetSelectedItem (sevenShopList)) then local weapID = guiGridListGetItemText ( sevenShopList, guiGridListGetSelectedItem (sevenShopList) , 1 ) local weapName = guiGridListGetItemText ( sevenShopList, guiGridListGetSelectedItem (sevenShopList) , 2 ) local weapPrice = Weapons[guiGridListGetSelectedItem (sevenShopList)+1][3] local row = guiGridListAddRow ( sevenShopList ) local rowCount = guiGridListGetRowCount ( sevenShopList ) guiSetVisible(window, false) showCursor(false) triggerServerEvent("weapon_Name",getLocalPlayer(),weapID,weapName,weapPrice) end end end) -- function arr(key) outputDebugString("execute: function arr()") -- debug if isElement(sevenShopList) then local scrollPos = guiGridListGetVerticalScrollPosition(sevenShopList) outputDebugString("scrollPos: " .. tostring(scrollPos)) -- debug if key == "arrow_d" then guiGridListSetVerticalScrollPosition(sevenShopList, scrollPos+10) else guiGridListSetVerticalScrollPosition(sevenShopList, scrollPos-10) end else outputDebugString("sevenShopList isn't an element.") -- debug end end bindKey("arrow_d", "down", arr) bindKey("arrow_u", "down", arr)
  5. That is stack overflow, can be seen from far. Set sound as global variable. function destroySound() stopSound(sound) end addEventHandler("onClientPlayerSpawn", getLocalPlayer(), destroySound )
  6. I think it would be easier to use processLineOfSight since you can most easily place it and you don't need any calculations or so. local vehicle = getPedOccupiedVehicle(localPlayer) -- Your vehicle local x, y, z = getElementPosition(vehicle) -- Position of hunter local dist = getElementDistanceFromCentreOfMassToBaseOfModel(vehicle) -- Gets ground of hunter, so the process line doesn't collide with hunter itself. local offset = 2 -- How much units under the hunter should it take to attach a vehicle? local hit, _, _, _, hitElement = processLineOfSight(x, y, z-dist, x, y, z-dist-offset, false, true, false, false, false) if hit and getElementType(hitElement) == "vehicle" then outputChatBox("You can attach "..getVehicleName(hitElement)) -- Returns vehicle element and outputs vehicle name. end Put this in onClientRender or so. If you don't know where process line is, use dxDrawLine3D to see and test it.
  7. Because parameter you've choosen in function is thePlayer, change it to userText. --1st script which start the 1st trigger (This is ok) (ClientSide) local userText = dxLibEditGetText(cInterface.tab_6.extraTab.edit) or "" cInterface.tab_6.extraTab.messageText = "#00FF00Preview: #FFFFFF"..userText triggerServerEvent("setAccountDataText",getLocalPlayer(),tostring(userText)) --2nd script which recieve the trigger (ServerSide) function setAccountDataText(userText) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then setAccountData ( playeraccount, "nameTagText",tostring(userText) ) outputChatBox("SetAccountData setted text: "..tostring(userText)) end end addEvent ( "setAccountDataText", true ) addEventHandler ( "setAccountDataText", getRootElement(),setAccountDataText)
  8. Oh, I see. I'm sorry, this should work: local playerTeamA = getPlayerTeam(player) if playerTeamA then local playerTeamB = getTeamName(playerTeamA) dxDrawText ( playerTeamB, sx, sy - offset, sx, sy*0.94 - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default-bold", "center", "bottom", false, false, false, true ) dxDrawText ( getPlayerNametagText(player), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default-bold", "center", "bottom", false, false, false, true ) else dxDrawText ( getPlayerNametagText(player), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default-bold", "center", "bottom", false, false, false, true ) end
  9. If you want to spawn player on ground, use: getGroundPosition -- OR processLineOfSight
  10. local playerTeamA = getPlayerTeam(player) local playerTeamB = getTeamName(playerTeamA) if playerTeamA then dxDrawText ( playerTeamB, sx, sy - offset, sx, sy*0.94 - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default-bold", "center", "bottom", false, false, false, true ) dxDrawText ( getPlayerNametagText(player), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default-bold", "center", "bottom", false, false, false, true ) else dxDrawText ( getPlayerNametagText(player), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default-bold", "center", "bottom", false, false, false, true ) end
  11. As I said, use DB functions. local handler = dbConnect("mysql", "dbname=YOUR DATABASE;host=YOUR IP", "YOUR USERNAME", "YOUR PASSWORD") function getUsername(source) local query = dbQuery(handler, "SELECT * FROM users WHERE serial=? AND online='1'", getPlayerSerial(source)) if query then local result = dbPoll(handler, -1) if result then return result end dbFree(query) end return false end And it's used like this: local username = exports.login_mysql:getUsername(player) outputChatBox(username[1]["username"])
  12. local sound function startSound (killer, weapon, bodypart) sound = playSound("music/music.mp3") setSoundVolume(sound, 0.5) end addEventHandler("onClientPlayerWasted", getLocalPlayer(), startSound) function destroySound() if isElement(sound) then stopSound(sound) end end addEventHandler("onClientPlayerSpawn", getLocalPlayer(), destroySound)
  13. GTX

    I have problem

    Maybe try guiGridListSetVerticalScrollPosition(sevenShopList, 50) only? I don't know, function might be bugged.
  14. You can't stream sound from there, I tried. They have such complicated system. You need some kind of timestamp and convert it into something and stuff.
  15. This forum is not a request forum. Read this before posting: viewtopic.php?f=91&t=47897
  16. Nope, nope and nope. Read before posting: viewtopic.php?f=91&t=47897 You can create it yourself. createObject
  17. GTX

    Help

    What? List of players in a team? getPlayersInTeam Or leave specific team? setPlayerTeam(PLAYER, nil)
  18. Do not connect to MySQL every time you trigger! Also, I suggest you to switch to: dbConnect dbQuery dbPoll dbFree This might work: function getUsername(source) local handler = mysql_connect("localhost", "root", "BLABLABLA", "BLABLABLA") local result = mysql_query(handler, "SELECT * FROM users WHERE serial = '"..getPlayerSerial( source ).."' AND online = '1';") -- Execute the query if (result) then while true do local row = mysql_fetch_assoc(result) if (not row) then break end --[[ outputChatBox(row["username"].." is your username.", source, 0, 255, 0) ]]-- end return row mysql_free_result(result) -- Free the result end end addEvent( "getUsername", true ) addEventHandler( "getUsername", getRootElement(), getUsername )
  19. GTX

    i need help

    guiCreateGridList -- Create the grid list. guiGridListAddRow -- Add rows.
  20. GTX

    I have problem

    Hmm, function might be bugged then if that doesn't work. Try this: function arr(key) outputDebugString("execute: function arr()") -- debug if isElement(sevenShopList) then local scrollPos = guiGridListGetVerticalScrollPosition(sevenShopList) outputDebugString("scrollPos: " .. tostring(scrollPos)) -- debug if key == "arrow_d" then guiGridListSetVerticalScrollPosition(sevenShopList, scrollPos-50) else guiGridListSetVerticalScrollPosition(sevenShopList, scrollPos+50) end else outputDebugString("sevenShopList isn't an element.") -- debug end end bindKey("arrow_d", "down", arr) bindKey("arrow_u", "down", arr)
  21. GTX

    Permisson

    if #getElementsByType"player" == 1 then end
  22. Bonsai is right. Open your files on server side, send them to client with latent function and then cache them.
  23. GTX

    I have problem

    "Doesn't work" doesn't help me. I don't know what's wrong, the code seems alright.
  24. GTX

    I have problem

    addEventHandler("onClientGUIClick",root, function () if (source == reject) then guiSetVisible(window, false) showCursor(false) elseif (source == buy) then if (guiGridListGetSelectedItem (sevenShopList)) then local weapID = guiGridListGetItemText ( sevenShopList, guiGridListGetSelectedItem (sevenShopList) , 1 ) local weapName = guiGridListGetItemText ( sevenShopList, guiGridListGetSelectedItem (sevenShopList) , 2 ) local weapPrice = Weapons[guiGridListGetSelectedItem (sevenShopList)+1][3] local row = guiGridListAddRow ( sevenShopList ) guiGridListSetItemText ( sevenShopList, row, column, message, false, false ) local rowCount = guiGridListGetRowCount ( sevenShopList ) guiSetVisible(window, false) showCursor(false) triggerServerEvent("weapon_Name",getLocalPlayer(),weapID,weapName,weapPrice) end end end) function arr() local scrollPos = guiGridListGetVerticalScrollPosition(sevenShopList) guiGridListSetVerticalScrollPosition(sevenShopList, scrollPos+1) end bindKey("arrow_d", "down", arr) function arr2() local scrollPos = guiGridListGetVerticalScrollPosition(sevenShopList) guiGridListSetVerticalScrollPosition(sevenShopList, scrollPos-1) end bindKey("arrow_u", "down", arr2)
×
×
  • Create New...