Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. You can use a table. local state = { } function allowORnot ( player ) outputChatBox ( "check" ) if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( player ) ), aclGetGroup( "Pirate" ) ) then if ( state [ player ] ) then state [ player ] = nil outputChatBox ( "go" ) removeEventHandler ( "onVehicleStartEnter", getRootElement(), pirateBoat ) else state [ player ] = true addEventHandler ( "onVehicleStartEnter", getRootElement(), pirateBoat ) outputChatBox ( "stop" ) end end end addCommandHandler ( "cannon", allowORnot )
  2. Castillo

    GUI help

    Line 45 and 53 , why you wrote name of the button and you already difend this. I didn't change how he wrote it, I just fixed the script errors.
  3. The second argument of addCommandHandler is the command name, not "nil" nor a number.
  4. Castillo

    GUI help

    That's because the problem is not on that part, you have another script errors on the client side. Wnd = guiCreateWindow(550,100,382,450,"Vehicle System",false) guiSetAlpha( Wnd, 1 ) guiWindowSetMovable(Wnd,true) guiWindowSetSizable(Wnd,false) button = guiCreateButton(36,400,110,47,"Exit",false,Wnd) button2 = guiCreateButton(249,400,110,47,"Spawn",false,Wnd) label2 = guiCreateLabel(127,47,242,15,'',false,Wnd) label = guiCreateLabel(127,34,242,15,"Click on the vehicle you want",false,Wnd) guiLabelSetVerticalAlign(label2,"center") guiLabelSetHorizontalAlign(label2,"center",false) showCursor(false) guiSetVisible( Wnd, false ) vehicles = { { "Infernus", 411 } } grid = guiCreateGridList(36,78,300,300,false,Wnd) guiGridListAddColumn(grid, "Vehicles", 0.85) for i,veh in ipairs(vehicles) do row = guiGridListAddRow(grid) guiGridListSetItemText(grid, row, 1, tostring(veh[1]), false, false) guiGridListSetItemData(grid, row, 1, tostring(veh[2])) end function use2() local row, col = guiGridListGetSelectedItem(grid) if (row and col and row ~= -1 and col ~= -1) then local model = tonumber(guiGridListGetItemData(grid, row, 1)) if model ~= "" then triggerServerEvent("CreVehice", localPlayer, model) end end end addEventHandler("onClientGUIClick", button2, use2, false) function close2() if (source == button2) then guiSetVisible(Wnd,false) showCursor(false) end end addEventHandler("onClientGUIClick", button2, close2) function close() if (source == button) then guiSetVisible(Wnd,false) showCursor(false) end end addEventHandler("onClientGUIClick", button, close) function showGUI2 ( ) guiSetVisible ( Wnd, true ) showCursor ( true ) end addEvent ( "showGUI2", true ) addEventHandler ( "showGUI2", getRootElement(), showGUI2 )
  5. I didn't notice that you also used the WRONG event, I told you to use "onPlayerFinishDD", but you used "onPlayerWinDD" again. Copy the code again.
  6. Castillo

    GUI help

    -- client side: function showGUI2 ( ) guiSetVisible ( Wnd, true ) showCursor ( true ) end addEvent ( "showGUI2", true ) addEventHandler ( "showGUI2", getRootElement(), showGUI2 ) -- server side: function showGUI ( hitPlayer ) if ( getElementType ( hitPlayer ) == "player" ) then triggerClientEvent ( hitPlayer, "showGUI2", hitPlayer ) end end addEventHandler ( "onMarkerHit", f, showGUI ) P.S: Stop double-triple posting, use the "EDIT" button.
  7. function raceWin ( ) local playername = getPlayerName ( source ) givePlayerMoney ( source, 500 ) outputChatBox ( "* " .. playername .. " #ABCDEFreceived $500 for being the last survivor!", root, 255, 255, 255, true ) end addEvent ( "onPlayerWinDD", true ) addEventHandler ( "onPlayerWinDD", root, raceWin ) addEvent ( "onPlayerFinishDD", true ) addEventHandler ( "onPlayerFinishDD", root, function ( rank ) if ( rank == 2 ) then givePlayerMoney ( source, 250 ) outputChatBox ( "#ABCDEFYou died in 2nd place and received $250.", source, 255, 255, 255, true) elseif ( rank == 3 ) then givePlayerMoney ( source, 100 ) outputChatBox ( "#ABCDEFYou died in 3rd place and received $100.", source, 255, 255, 255, true) elseif ( rank == 4 ) then givePlayerMoney ( source, 50 ) outputChatBox ( "#ABCDEFYou died in 4th place and received $50.", source, 255, 255, 255, true) elseif ( rank == 5 ) then givePlayerMoney ( source, 25 ) outputChatBox ( "#ABCDEFYou died in 5th place and received $25.", source, 255, 255, 255, true) elseif ( rank == 6 ) then outputChatBox ( "#ABCDEFYou died in 6th place and received nothing.", source, 255, 255, 255, true) end end )
  8. Castillo

    GUI help

    You changed what I mentioned?
  9. Castillo

    Help please

    That's not the full script, and the problem is not on that part you posted.
  10. 'kicked' and 'sourcePlayer' is not defined anywhere, also, you put the reason without the quotes ( to become a string ).
  11. No, is not. You must create a new function, then use that event I told you.
  12. Castillo

    GUI help

    addEventHandler("onMarkerHit",t,showGUI) You are using the variable "t", but your marker variable is "f".
  13. Should be already there, I guess it works when all the edit boxes are created on the same parent element.
  14. The script seems fine, is it set as server side on meta.xml?
  15. Castillo

    Tables

    You're welcome.
  16. Use the event: "onPlayerFinishDD", the first argument is the rank.
  17. Castillo

    Tables

    No, you must put them as strings: femalenames = { "Dwana Sasaki", "Kanisha Leishman", "Luba Peters", "Tina Schwabe", "Loria Rodden" }
  18. Castillo

    GUI help

    Post the server side part.
  19. This is already possible, but it gets disabled when you set the input mode.
  20. It's already there... https://code.google.com/p/mtasa-resourc ... tail?r=914
  21. Castillo

    unbindkey help

    You're welcome. @MADE: That code does the same as mine, just different method, but still, it's not "better".
  22. No, use this: function raceWin ( ) local playername = getPlayerName ( source ) givePlayerMoney ( source, 1000 ) outputChatBox ( "* ".. playername .." took $1000 for being the last survivor!", root, 51, 153, 255 ) end addEvent ( "onPlayerWinDD", true ) addEventHandler ( "onPlayerWinDD", root, raceWin )
×
×
  • Create New...