Jump to content

proracer

Members
  • Posts

    499
  • Joined

  • Last visited

Everything posted by proracer

  1. No, it's still the same ..
  2. Hello everyone, I wanted to make like avatar selection but when someone clicks multiple items it draws images over it, do you guys have any idea how to fix? I have tried multiple times with setElementData, inserting data into tables and checking if he clicked before and destroyElement or guiSetVisible to false but none of them works. Code: GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Grid = {} -- GUI Interface GUIEditor_Window[1] = guiCreateWindow(334,298,565,406,"XG Avatar | - Made by Pr0RaC3R - |",false) GUIEditor_Grid[1] = guiCreateGridList(9,25,253,372,false,GUIEditor_Window[1]) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) column1 = guiGridListAddColumn(GUIEditor_Grid[1],"Avatar Category",0.5) column2 = guiGridListAddColumn(GUIEditor_Grid[1],"Select avatar",0.5) for i = 1, 10 do row = guiGridListAddRow(GUIEditor_Grid[1]) end guiGridListSetItemText ( GUIEditor_Grid[1], row, column1, 'Retro', false, false ) GUIEditor_Button[1] = guiCreateButton(273,359,132,36,"Save as default avatar",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(422,359,125,36,"Remove my avatar",false,GUIEditor_Window[1]) guiSetVisible ( GUIEditor_Window[1], false ) function drawAvatarPanel ( ) bindKey ( 'F7', 'down', showAvatarPanel ) end addEventHandler ( 'onClientResourceStart', resourceRoot, drawAvatarPanel ) function showAvatarPanel ( ) isVisible = guiGetVisible ( GUIEditor_Window[1] ) if (isVisible) then guiSetVisible ( GUIEditor_Window[1], false ) showCursor ( false ) end if (not isVisible) then guiSetVisible ( GUIEditor_Window[1], true ) showCursor ( true ) end end function onGridListClickShowColumn2Items ( button ) if (button) == 'left' and (guiGridListGetItemText(GUIEditor_Grid[1],guiGridListGetSelectedItem(GUIEditor_Grid[1]))) == 'Retro' then guiGridListSetItemText ( GUIEditor_Grid[1], 1, 2, 'Address', false, false ) guiGridListSetItemText ( GUIEditor_Grid[1], 2, 2, 'Ads', false, false ) guiGridListSetItemText ( GUIEditor_Grid[1], 3, 2, 'Calendar', false, false ) guiGridListSetItemText ( GUIEditor_Grid[1], 4, 2, 'Comment', false, false ) guiGridListSetItemText ( GUIEditor_Grid[1], 5, 2, 'Home', false, false ) guiGridListSetItemText ( GUIEditor_Grid[1], 6, 2, 'Mail', false, false ) guiGridListSetItemText ( GUIEditor_Grid[1], 7, 2, 'News', false, false ) guiGridListSetItemText ( GUIEditor_Grid[1], 8, 2, 'RSS', false, false ) guiGridListSetItemText ( GUIEditor_Grid[1], 9, 2, 'Search', false, false ) guiGridListSetItemText ( GUIEditor_Grid[1], 10, 2, 'Sign', false, false ) end end addEventHandler ( 'onClientGUIClick', root, onGridListClickShowColumn2Items ) function onGridListClickShowImage ( button ) if (button) == 'left' and (guiGridListGetItemText(GUIEditor_Grid[1],guiGridListGetSelectedItem(GUIEditor_Grid[1]))) == 'Address' then Picture1 = guiCreateStaticImage ( 357, 130, 128, 128, 'retro/address_128.png', false, GUIEditor_Window[1] ) elseif ( button ) == 'left' and (guiGridListGetItemText(GUIEditor_Grid[1],guiGridListGetSelectedItem(GUIEditor_Grid[1]))) == 'Ads' then Picture2 = guiCreateStaticImage ( 357, 130, 128, 128, 'retro/ads_128.png', false, GUIEditor_Window[1] ) elseif ( button ) == 'left' and (guiGridListGetItemText(GUIEditor_Grid[1],guiGridListGetSelectedItem(GUIEditor_Grid[1]))) == 'Calendar' then Picture3 = guiCreateStaticImage ( 357, 130, 128, 128, 'retro/calendar_128.png', false, GUIEditor_Window[1] ) elseif ( button ) == 'left' and (guiGridListGetItemText(GUIEditor_Grid[1],guiGridListGetSelectedItem(GUIEditor_Grid[1]))) == 'Comment' then Picture4 = guiCreateStaticImage ( 357, 130, 128, 128, 'retro/comment_128.png', false, GUIEditor_Window[1] ) elseif ( button ) == 'left' and (guiGridListGetItemText(GUIEditor_Grid[1],guiGridListGetSelectedItem(GUIEditor_Grid[1]))) == 'Home' then Picture5 = guiCreateStaticImage ( 357, 130, 128, 128, 'retro/home_128.png', false, GUIEditor_Window[1] ) end end addEventHandler ( 'onClientGUIClick', root, onGridListClickShowImage ) Take a look at last function it's most important. Picture of bug: It shows 2 pictures because I clicked another one, how I can fix that?
  3. proracer

    admin

    @CitizeN: Some players are old-school from MTA Race and they like ' ! ' commands instead with ' / ' So they like to script commands with ' ! '
  4. proracer

    admin

    Yes, example #2 on that function is about showing admins online with DX Drawing.
  5. proracer

    admin

    There's an example with DX Drawings which is harder: https://wiki.multitheftauto.com/wiki/IsObjectInACLGroup Now that was a hint and now try to script yourself.
  6. proracer

    How to..

    If you are using race mode you can change settings for resource 'race' and set server blur to 0.
  7. You have an example here: https://wiki.multitheftauto.com/wiki/Scripting_the_GUI_-_Tutorial_1
  8. proracer

    Race Stats

    I know that way, but its too way simple and you cant view stats like in XML or SQL.
  9. proracer

    Race Stats

    Well .. Nevermind now, I use XML files now .. lot easier. I installed that module but its more complicated and gives me errors pretty often so nevermind .. now, thx anyway!
  10. Yes, there is Player ID if you mean that. You can do this for testing: for i,v in ipairs ( getElementsByType ( 'player' ) ) do outputChatBox ( i ) end
  11. proracer

    Race Stats

    Hello everyone! I have been working hard on sql based race stats.But unfornunately always when I start resource it says: "no such column: account" Here's a piece of code: function createDB ( ) executeSQLCreateTable ( 'Points', 'account STRING, points INT' ) executeSQLCreateTable ( 'Cash', 'account STRING, cash INT' ) executeSQLCreateTable ( 'Rank', 'account STRING, rank TEXT' ) executeSQLCreateTable ( 'Wins', 'account STRING, wins INT' ) executeSQLCreateTable ( 'Played', 'account STRING, played INT' ) outputChatBox ( 'Successfully created tables.' ) -- Debug String end addEventHandler ( 'onResourceStart', resourceRoot, createDB ) function clientReady ( prev, acc, autologin ) local account = getAccountName ( acc ) local playerName = getPlayerName ( source ) -- CHECK TABLES -- resultTable1 = executeSQLSelect ( 'Points', 'account', "account = '" .. account .. "'" ) resultTable2 = executeSQLSelect ( 'Cash', 'account', "account = '" .. account .. "'" ) resultTable3 = executeSQLSelect ( 'Rank', 'account', "account = '" .. account .. "'" ) resultTable4 = executeSQLSelect ( 'Wins', 'account', "account = '" .. account .. "'" ) resultTable5 = executeSQLSelect ( 'Played', 'account', "account = '" .. account .. "'" ) if (type(resultTable1) == 'table' and #resultTable1 == 0 ) or not resultTable1 then executeSQLInsert ( 'Points', "'" .. account .. "', '0'" ) end if (type(resultTable2) == 'table' and #resultTable2 == 0 ) or not resultTable2 then executeSQLInsert ( 'Cash', "'" .. account .. "', '0'" ) end if (type(resultTable3) == 'table' and #resultTable3 == 0 ) or not resultTable3 then executeSQLInsert ( 'Rank', "'" .. account .. "', 'None'" ) end if (type(resultTable4) == 'table' and #resultTable4 == 0 ) or not resultTable4 then executeSQLInsert ( 'Wins', "'" .. account .. "', '0'" ) end if (type(resultTable5) == 'table' and #resultTable5 == 0 ) or not resultTable5 then executeSQLInsert ( 'Played', "'" .. account .. "', '0'" ) end outputChatBox ( " I'm ready! " ) -- Debug String end addEventHandler ( 'onPlayerLogin', root, clientReady ) Line 16 error: Database query failed: no such column: account But surprisingly it only says that it can't find column 'account' for table: 'Points'.So there is a little hint and I hope you can help me.. But it still outputs to chatbox the last string for debug.
  12. There's a nice explanation here: http://www.lua.org/pil/4.3.5.html or here: http://lua-users.org/wiki/ForTutorial
  13. for i,v in ipairs ( getElementsByType ( 'player' ) ) do setElementHealth ( v, 0 ) end
  14. @norby: Yes, for every Lua function I use that site and if I cant find something there then you can use: http://lua-users.org/wiki/TutorialDirectory
  15. If you want to test many variables you could use elseif
  16. outputChatBox("blabla", root, r, g, b, true) or outputChatBox("blabla", getRootElement(), r, g, b, true)
  17. If you look at each event on MTA Wiki, it says which element is a source for that event.
  18. 1. What should script do? 2. Where is the error?
  19. From first point I can see that you use wrong arguments in getElementData.
  20. Why can't you simply use onPlayerJoin instead of onPlayerConnect?
  21. function onPlayerDiesFunc ( ) outputChatBox ( 'player died' ) end addEventHandler ( "onClientPedWasted", getLocalPlayer ( ), onPlayerDiesFunc )
  22. Well.. I find something but I'm not sure if it works.Go to resources/race/race_server.lua. Go to line 621: fixVehicle(vehicle) - and try to replace with: return Edit: Should work, tested...
  23. XG server runs on stolen maps and scripts too (greetz simon) It doesn't have stolen maps but actually let's take a look - who doesn't have stolen maps..? And no it doesn't run on stolen scripts at all... don't say stuff you don't know. Also it's a fail to insult a clan over MTA Forum as its totally pointless and nobody cares ... @Berni: Stealing and making (or even copying a script) is totally the opposite.
×
×
  • Create New...