drk
Members-
Posts
1,607 -
Joined
-
Last visited
Everything posted by drk
-
Solidsnake, it don't works. I tried it here several ways and I can't get it to work if I remove 'for ... in ..... do' and add a text like 'WHAT THE FUCK' in the row it work.
-
client: local marker = createMarker (1605.600, -1625.300, 12.5, "cylinder", 2, 25, 50, 255, 255 ) local cars = { [596] = 'Police LS', [597] = 'Police SF', [598] = 'Police LV', [599] = 'Police Ranger' } window = guiCreateWindow(561,187,260,388,"Spawn Vehicle",false) guiWindowSetSizable(window,false) spawnButton = guiCreateButton(26,317,96,37,"Spawn",false,window) closeButton = guiCreateButton(142,318,96,37,"Close",false,window) carGrid = guiCreateGridList(23,34,210,249,false,window) guiGridListSetSelectionMode(carGrid,0) column = guiGridListAddColumn(carGrid,"Vehicle name",0.85) for id,vehName in ipairs(cars) do local row = guiGridListAddRow ( carGrid ) guiGridListSetItemText ( carGrid, row, column, tostring(vehName), false, false ) end function showWindow() local playerTeam = getPlayerTeam (localPlayer) local teamName = getTeamName ( playerTeam ) if teamName == "Police" then guiSetVisible( window, true ) showCursor(true) end end addEventHandler ("onClientMarkerHit", marker, showWindow) function spawn() triggerServerEvent('onGUIClick',localPlayer) end addEventHandler('onClientGUIClick',spawnButton, spawn, false) function setVisible() guiSetVisible(window,false) showCursor(false) end addEvent('setGUIVisible',true) addEventHandler('setGUIVisible',root,setVisible) function closeWindow() guiSetVisible(window,false) showCursor(false) end addEventHandler ("onClientGUIClick", closeButton, closeWindow, false) server: function spawnVeh( ) local uTeam = getPlayerTeam( source ) if not uTeam or uTeam and getTeamName ( uTeam ) ~= 'Police' then local theVehicle = createVehicle (cars, x, y, z, 0, 0, rotZ) -- you have to change cars to the return of the grid list selected vehicle warpPedIntoVehicle(source,theVehicle) triggerClientEvent('setGUIVisible',source) end end addEvent('onGUIClick',true) addEventHandler('onGUIClick',root,spawnVeh)
-
lol you are crazy. Learn Lua www.lua-users.org/wiki/TutorialDirectory/. If you have any questions about Lua you can PM me. And then start learning the mtasa wiki.
-
You get these errors because 'cars' is nil.
-
Because your table is wrong e.e Your table: local cars = {[596] = true, [597] = true, [598] = true, [599] = true} Correct: local cars = { [596] = 'Vehicle name', [597] = 'Vehicle name', [598] = 'Vehicle name', [599] = 'Vehicle name' } And in this change: for id,vehName in ipairs(cars) do local row = guiGridListAddRow ( carGrid ) guiGridListSetItemText ( carGrid, row, column, tostring(vehName), false, false ) end
-
function setInince(thePlayer) if (hasObjectPermissionTo(thePlayer, "function.banPlayer")) then if (getElementData(thePlayer, "INV") == "true") then setElementData(thePlayer,"INV", "false") outputChatBox("You are no longer Invincible", thePlayer) else setElementData(thePlayer,"INV", "true") outputChatBox("You are now Invincible", thePlayer) end else outputChatBox("You do not have permission for this", thePlayer) end end addCommandHandler("INCI", setInince) Tested.
-
My mistake. Copy my code again.
-
Not the same. Try: Client side: local marker = createMarker (1605.600, -1625.300, 12.5, "cylinder", 2, 25, 50, 255, 255 ) local cars = {[596] = true, [597] = true, [598] = true, [599] = true} window = guiCreateWindow(561,187,260,388,"Spawn Vehicle",false) guiWindowSetSizable(window,false) spawnButton = guiCreateButton(26,317,96,37,"Spawn",false,window) closeButton = guiCreateButton(142,318,96,37,"Close",false,window) carGrid = guiCreateGridList(23,34,210,249,false,window) guiGridListSetSelectionMode(carGrid,2) guiGridListAddColumn(carGrid,"Vehicle name",0.85) for key,vehName in ipairs(cars) do local row = guiGridListAddRow ( carGrid ) guiGridListSetItemText ( carGrid, row, column, vehName, false, false ) end function showWindow() local playerTeam = getPlayerTeam (localPlayer()) local teamName = getTeamName ( playerTeam ) if teamName == "Police" then guiSetVisible( window, true ) showCursor(true) end end addEventHandler ("onClientMarkerHit", marker, showWindow) function spawn() triggerServerEvent('onGUIClick',localPlayer) end addEventHandler('onClientGUIClick',spawnButton, spawn, false) function setVisible() guiSetVisible(window,false) showCursor(false) end addEvent('setGUIVisible',true) addEventHandler('setGUIVisible',root,setVisible) Server: function spawnVeh( ) local uTeam = getPlayerTeam( source ) if not uTeam or uTeam and getTeamName ( uTeam ) ~= 'Police' then local theVehicle = createVehicle (cars, x, y, z, 0, 0, rotZ) -- you have to change cars to the return of the grid list selected vehicle warpPedIntoVehicle(source,theVehicle) triggerClientEvent('setGUIVisible',source) end end addEvent('onGUIClick',true) addEventHandler('onGUIClick',root,spawnVeh)
-
no. First, race mode have map display. To add nextmap, spec, etc start learning Lua.
-
My bad. Change localPlayer() to localPlayer
-
warpPedIntoVehicle is an server-side function. local marker = createMarker (1605.600, -1625.300, 12.5, "cylinder", 2, 25, 50, 255, 255 ) local cars = {[596] = true, [597] = true, [598] = true, [599] = true} window = guiCreateWindow(561,187,260,388,"Spawn Vehicle",false) guiWindowSetSizable(window,false) spawnButton = guiCreateButton(26,317,96,37,"Spawn",false,window) closeButton = guiCreateButton(142,318,96,37,"Close",false,window) carGrid = guiCreateGridList(23,34,210,249,false,window) guiGridListSetSelectionMode(carGrid,2) guiGridListAddColumn(carGrid,"Vehicle name",0.85) for key,vehName in ipairs(cars) do local row = guiGridListAddRow ( carGrid ) guiGridListSetItemText ( carGrid, row, column, vehName, false, false ) end function showWindow() local playerTeam = getPlayerTeam (localPlayer()) local teamName = getTeamName ( playerTeam ) if teamName == "Police" then guiSetVisible( window, true ) showCursor(true) end end addEventHandler ("onClientMarkerHit", marker, showWindow) function spawnVeh( ) local uTeam = getPlayerTeam( localPlayer() ) if not uTeam or uTeam and getTeamName ( uTeam ) ~= 'Police' then local theVehicle = createVehicle (cars, x, y, z, 0, 0, rotZ) triggerServerEvent('warpPedIntoVehicle',localPlayer(),theVehicle) guiSetVisible( window, false) showCursor( false ) end end addEventHandler( "onClientGUIClick", spawnButton , spawnVeh, false )
-
I tried, but I get error. local gui_Table = { gui['profile_label'] = guiCreateLabel((20/800)*sx,(312/600)*sy,(158/800)*sx,(29/600)*sy,'Profile',true,gui['panel']), gui['stats_label'] = guiCreateLabel((20/800)*sx,(358/600)*sy,(158/800)*sx,(29/600)*sy,'Stats',true,gui['panel']), gui['shop_label'] = guiCreateLabel((21/800)*sx,(405/600)*sy,(158/800)*sx,(29/600)*sy,'Shop',true,gui['panel']), gui['top_label'] = guiCreateLabel((21/800)*sx,(452/600)*sy,(158/800)*sx,(29/600)*sy,'Top',true,gui['panel']), gui['sms_label'] = guiCreateLabel((44/800)*sx,(495/600)*sy,(110/800)*sx,(22/600)*sy,'SMS',true,gui['panel']), gui['time_label'] = guiCreateLabel((14/800)*sx,(241/600)*sy,(169/800)*sx,(34/600)*sy,'23:00',true,gui['panel']), gui['time'] = guiCreateStaticImage((13/800)*sx,(210/600)*sy,(172/800)*sx,(77/600)*sy,'_utils/_data/_image/memo_hover.png',true,gui['panel']), gui['panel'] = guiCreateStaticImage((0/800)*sx,(194/600)*sy,(197/800)*sx,(378/600)*sy,'_utils/_data/_image/main.png',true,false), gui['button1'] = guiCreateStaticImage((19/800)*sx,(298/600)*sy,(160/800)*sx,(41/600)*sy,'_utils/_data/_image/button1.png',true,gui['panel']), gui['button2'] = guiCreateStaticImage((19/800)*sx,(344/600)*sy,(160/800)*sx,(41/600)*sy,'_utils/_data/_image/button1.png',true,gui['panel']), gui['button3'] = guiCreateStaticImage((20/800)*sx,(389/600)*sy,(160/800)*sx,(42/600)*sy,'_utils/_data/_image/button1.png',true,gui['panel']), gui['button4'] = guiCreateStaticImage((20/800)*sx,(436/600)*sy,(160/800)*sx,(42/600)*sy,'_utils/_data/_image/button1.png',true,gui['panel']), gui['button5'] = guiCreateStaticImage((45/800)*sx,(488/600)*sy,(111/800)*sx,(30/600)*sy,'_utils/_data/_image/button1.png',true,gui['panel']), gui['more'] = guiCreateStaticImage((76/800)*sx,(527/600)*sy,(44/800)*sx,(37/600)*sy,'_utils/_data/_image/options.png',true,gui['panel']) } Expected to close '{'
-
I want to make a gui table like this: local gui = { var = guiCreateLabel(...), var2 = guiCreateLabel(...) } And use guiSetVisible to set all elements in the table visible?
-
I think he can use tonumber(playersOnline)
-
Not for me. And my computer is a shit.. But you can use onPlayerWasted or onPlayerSpawn. onPlayerWasted addEventHandler('onPlayerWasted',root, function() showPlayerHudComponent('all',false) end) For onPlayerSpawn, the same, only change event name.
-
Why use the two options? Only use a timer... setTimer( function() showPlayerHudComponent('all',false) end end,500,0)
