-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
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 )
-
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.
-
The second argument of addCommandHandler is the command name, not "nil" nor a number.
-
You're welcome.
-
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 )
-
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.
-
-- 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.
-
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 )
-
That's not the full script, and the problem is not on that part you posted.
-
'kicked' and 'sourcePlayer' is not defined anywhere, also, you put the reason without the quotes ( to become a string ).
-
No, is not. You must create a new function, then use that event I told you.
-
addEventHandler("onMarkerHit",t,showGUI) You are using the variable "t", but your marker variable is "f".
-
Should be already there, I guess it works when all the edit boxes are created on the same parent element.
-
The script seems fine, is it set as server side on meta.xml?
-
Use the event: "onPlayerFinishDD", the first argument is the rank.
-
This is already possible, but it gets disabled when you set the input mode.
-
It's already there... https://code.google.com/p/mtasa-resourc ... tail?r=914
-
You're welcome. @MADE: That code does the same as mine, just different method, but still, it's not "better".
-
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 )