-
Posts
619 -
Joined
-
Last visited
Everything posted by Flaker
-
Weird ... I do not think that it would help, but try: (Just for test) function showSupport () if guiGetVisible ( supportWindow ) == true then guiSetVisible( supportWindow, false ) showCursor( false ) guiSetInputEnabled( false ) else guiSetVisible( supportWindow, true ) showCursor( true ) guiSetInputEnabled( true ) end end bindKey("f3", "down", showSupport ) p.s. Perhaps the problem in some other script?
-
Some info about variable: x = 1 --Global variable. x = nil --Delete x local x = 1 -- it's local variable. (This variable exists only within this file.) function test_func() --Open function local x = 1 --This variable exists only within this function (test_func). while i < x do local y = i * 2 --local variable for while loop (exists only within While-loop ) i = i + 1 end end --Close function Usually, there is no need to remove the global variables, but if the lifetime of your variable is small, use local variable. If it became necessary to remove a global variable, just set it to "nil" Often, you can see such variable: local foo = foo This code creates a local variable "foo" and initializes it to the value of global variable "foo". This idiom is useful when you want to save the original value of "foo" in case other function will change the global variable "foo". Also, it speeds up access to the variable "foo".
-
Try this, but not sure cuz UNTESTED: p.s. U should create buttons for Send Text function (For example: SendRus; SendSpan etc...) if (source == SendRus) then - it mean: if player click on "SendRus" button, then do something... etc. --CLIENT SIDE GUIEditor_Window = {} GUIEditor_TabPanel = {} GUIEditor_Tab = {} GUIEditor_Edit = {} GUIEditor_Memo = {} GUIEditor_Window[1] = guiCreateWindow(167,128,949,523,"Chats",false) guiSetVisible(GUIEditor_Window[1], false) GUIEditor_TabPanel[1] = guiCreateTabPanel(32,39,893,460,false,GUIEditor_Window[1]) GUIEditor_Tab[1] = guiCreateTab("Help",GUIEditor_TabPanel[1]) GUIEditor_Edit[1] = guiCreateEdit(25,388,762,35,"",false,GUIEditor_Tab[1]) GUIEditor_Memo[1] = guiCreateMemo(23,27,791,339,"",false,GUIEditor_Tab[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Tab[2] = guiCreateTab("Main",GUIEditor_TabPanel[1]) GUIEditor_Edit[2] = guiCreateEdit(25,388,762,35,"",false,GUIEditor_Tab[2]) GUIEditor_Memo[2] = guiCreateMemo(23,27,791,339,"",false,GUIEditor_Tab[2]) guiMemoSetReadOnly(GUIEditor_Memo[2],true) GUIEditor_Tab[3] = guiCreateTab("Arabic",GUIEditor_TabPanel[1]) GUIEditor_Edit[3] = guiCreateEdit(25,388,762,35,"",false,GUIEditor_Tab[3]) GUIEditor_Memo[3] = guiCreateMemo(23,27,791,339,"",false,GUIEditor_Tab[3]) guiMemoSetReadOnly(GUIEditor_Memo[3],true) GUIEditor_Tab[4] = guiCreateTab("Russian",GUIEditor_TabPanel[1]) GUIEditor_Edit[4] = guiCreateEdit(25,388,762,35,"",false,GUIEditor_Tab[4]) GUIEditor_Memo[4] = guiCreateMemo(23,27,791,339,"",false,GUIEditor_Tab[4]) guiMemoSetReadOnly(GUIEditor_Memo[4],true) GUIEditor_Tab[5] = guiCreateTab("Spanish",GUIEditor_TabPanel[1]) GUIEditor_Edit[5] = guiCreateEdit(25,388,762,35,"",false,GUIEditor_Tab[5]) GUIEditor_Memo[5] = guiCreateMemo(23,27,791,339,"",false,GUIEditor_Tab[5]) guiMemoSetReadOnly(GUIEditor_Memo[5],true) GUIEditor_Tab[6] = guiCreateTab("Turkish",GUIEditor_TabPanel[1]) GUIEditor_Edit[6] = guiCreateEdit(25,388,762,35,"",false,GUIEditor_Tab[6]) GUIEditor_Memo[6] = guiCreateMemo(23,27,791,339,"",false,GUIEditor_Tab[6]) guiMemoSetReadOnly(GUIEditor_Memo[6],true) GUIEditor_Tab[7] = guiCreateTab("French",GUIEditor_TabPanel[1]) GUIEditor_Edit[7] = guiCreateEdit(25,388,762,35,"",false,GUIEditor_Tab[7]) GUIEditor_Memo[7] = guiCreateMemo(23,27,791,339,"",false,GUIEditor_Tab[7]) guiMemoSetReadOnly(GUIEditor_Memo[7],true) GUIEditor_Tab[8] = guiCreateTab("German",GUIEditor_TabPanel[1]) GUIEditor_Edit[8] = guiCreateEdit(25,388,762,35,"",false,GUIEditor_Tab[8]) GUIEditor_Memo[8] = guiCreateMemo(23,27,791,339,"",false,GUIEditor_Tab[8]) guiMemoSetReadOnly(GUIEditor_Memo[8],true) GUIEditor_Tab[9] = guiCreateTab("Indian",GUIEditor_TabPanel[1]) GUIEditor_Edit[9] = guiCreateEdit(25,388,762,35,"",false,GUIEditor_Tab[9]) GUIEditor_Memo[9] = guiCreateMemo(23,27,791,339,"",false,GUIEditor_Tab[9]) guiMemoSetReadOnly(GUIEditor_Memo[9],true) GUIEditor_Tab[10] = guiCreateTab("Ireland",GUIEditor_TabPanel[1]) GUIEditor_Edit[10] = guiCreateEdit(25,388,762,35,"",false,GUIEditor_Tab[10]) GUIEditor_Memo[10] = guiCreateMemo(23,27,791,339,"",false,GUIEditor_Tab[10]) guiMemoSetReadOnly(GUIEditor_Memo[10],true) GUIEditor_Tab[11] = guiCreateTab("Italian",GUIEditor_TabPanel[1]) GUIEditor_Edit[11] = guiCreateEdit(25,388,762,35,"",false,GUIEditor_Tab[11]) GUIEditor_Memo[11] = guiCreateMemo(23,27,791,339,"",false,GUIEditor_Tab[11]) guiMemoSetReadOnly(GUIEditor_Memo[11],true) GUIEditor_Tab[12] = guiCreateTab("Portuguese",GUIEditor_TabPanel[1]) GUIEditor_Edit[12] = guiCreateEdit(25,388,762,35,"",false,GUIEditor_Tab[12]) GUIEditor_Memo[12] = guiCreateMemo(23,27,791,339,"",false,GUIEditor_Tab[12]) guiMemoSetReadOnly(GUIEditor_Memo[12],true) addEventHandler("onClientGUIClick",root, --U should create Buttons for send Player's msg! (For example: SendRus; SendSpan etc...) function () if (source == SendRus) then --If player click on "SendRus" button then local msg = guiGetText ( GUIEditor_Edit[4] ) --We get player's message from GUIEditor_Edit[4] triggerServerEvent ( "setMemoText", localPlayer, localPlayer, GUIEditor_Memo[4], msg) elseif (source == SendSpan) then local msg = guiGetText ( GUIEditor_Edit[5] ) triggerServerEvent ( "setMemoText", localPlayer, localPlayer, GUIEditor_Memo[5], msg) end end ) bindKey('f2','down',function() guiSetVisible(GUIEditor_Window[1],not(guiGetVisible(GUIEditor_Window[1]))) showCursor(guiGetVisible(GUIEditor_Window[1])) end) --SERVER SIDE function setMemoTextInLines (MemoElement, thePlayer, Text) local pNick = getPlayerName ( thePlayer ) local cur_text = guiGetText ( MemoElement ) guiSetText ( MemoElement, cur_text.."\n"..pNick..":"..Text) end addEvent ( "setMemoText", true ) addEventHandler ( "setMemoText", root, function ( thePlayer, MemoElement, Text ) setMemoTextInLines (MemoElement, thePlayer, Text) end ) addCommandHandler ( "help", function ( player, cmd, ... ) local text = table.concat ( { ... }, " " ) if (text) then local msg = tostring(text) setMemoTextInLines (GUIEditor_Memo[1], player, msg) else outputChatBox("[usage] /help [TEXT]",player,0,255,0) end end )
-
Try this: function gui_create () local wdwMain = guiCreateWindow(227,759,486,78,"",false) local imgGUI5 = guiCreateStaticImage(776,670,334,172,"images/gui5.png",false) local imgGUI1 = guiCreateStaticImage(235,778,79,73,"images/gui1.png",false) local imgGUI2 = guiCreateStaticImage(353,770,211,90,"images/gui2.png",false) local imgGUI3 = guiCreateStaticImage(594,727,124,137,"images/gui3.png",false) showPlayerHudComponent ("ammo", false) showPlayerHudComponent ("armour", false) showPlayerHudComponent ("breath", false) showPlayerHudComponent ("clock", false) showPlayerHudComponent ("health", false) showPlayerHudComponent ("money", false) showPlayerHudComponent ("weapon", false) addEventHandler("onClientRender",client,renderFunc) end addEventHandler("onClientResourceStart",client, gui_create) function renderFunc() local wid = getWeaponNameFromID(getPedWeapon(localPlayer)) local cl_player_health = tostring(math.floor(getElementHealth( localPlayer ))) local cl_player_armor = tostring(math.floor(getPedArmor ( localPlayer ))) local cl_player_ammo = tostring(math.floor(getPedTotalAmmo(localPlayer))) dxDrawRectangle(1152.0,864.0,5.0,5.0,tocolor(255,255,255,255),false) dxDrawRectangle(0.0,821.0,1152.0,41.0,tocolor(0,0,0,170),false) dxDrawRectangle(1152.0,863.0,5.0,5.0,tocolor(255,255,255,255),false) dxDrawText(""..cl_player_armor.."",673.0,835.0,742.0,861.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) dxDrawText(""..cl_player_ammo.."",480.0,835.0,549.0,861.0,tocolor(255,255,0,255),1.0,"default","left","top",false,false,false) dxDrawText(""..cl_player_health.."",287.0,835.0,356.0,861.0,tocolor(255,0,0,255),1.0,"default","left","top",false,false,false) dxDrawText(""..wid.."",480.0,845.0,356.0,861.0,tocolor(255,255,0,255),1.0,"default","left","top",false,false,false) end
-
local teamZombie = createTeam("Zombies") function onSpawnSlothBot() local x, y, z = getElementPosition (source) local rot = 0 local int = getElementInterior(source) local dim = getElementDimension(source) local weapon = 0 setTeamFriendlyFire(teamZombie,false) for i = 1,10 do local skin = math.random(21,23) local dec = math.random(20,300) exports.slothbot:spawnBot(x+dec, y+dec, z, rot, skin, int, dim, teamZombie, weapon) end end addEvent("onSpawnSlothBot",true) addEventHandler("onSpawnSlothBot",getRootElement(),onSpawnSlothBot) function onBotWasted(attacker, weapon, bodypart) if (attacker) then local x,y,z = getElementPosition(attacker) local rot = 0 local int = getElementInterior(attacker) local dim = getElementDimension(attacker) local weapon = 0 local skin = math.random(21,23) local dec = math.random(20,300) exports.slothbot:spawnBot(x + dec, y + dec, z, rot, skin, int, dim, teamZombie, weapon) else outputDebugString("Attacker doesn't exist") end end addEvent("onBotWasted",true) addEventHandler("onBotWasted",getRootElement(),onBotWasted)
-
WIKI: https://wiki.multitheftauto.com/wiki/EngineLoadDFF https://wiki.multitheftauto.com/wiki/EngineLoadTXD How to change 287 skin: (example) Meta.xml: "tex/287.txd" /> "tex/287.dff" /> Client.lua: function clientsetup() local txd = engineLoadTXD ( "tex/287.txd") --287 - Model ID engineImportTXD ( txd, 287 ) local dff = engineLoadDFF ( "tex/287.dff", 287) engineReplaceModel ( dff, 287 ) end addEventHandler("onClientResourceStart", resourceRoot, clientsetup)
-
check "mods/deathmatch/mtaserver.conf" in MTA folder... In this file u can change server autorun More info about it: https://wiki.multitheftauto.com/wiki/Server_mtaserver.conf#resource
-
createBlipAttachedTo ( vehicle, 53, 2, 255, 0, 0, 255, 0, 99999.0, hitPlayer)
-
Use this code for "elMarker" function. function elMarker( hitPlayer ) if ( getElementType(hitPlayer) == "player" and hitPlayer == localPlayer and not(isPedInVehicle(localPlayer)) ) then guiSetVisible ( carrosWindow, true ) showCursor(true) end end addEventHandler ( "onClientMarkerHit", carrosMarker, elMarker)
-
Example: createColPolygon ( fX, fY, fX1, fY1, fX2, fY2, fX3, fY3 ) fX, fY - This is coordinates of the first point (X, Y) fX1, fY2 - This is coordinates of the second point (X, Y) fX3, fY3 - This is coordinates of the third point (X, Y) etc... U should have more then 2 points! ( >=3 ) You can have as many points as you required to create the colshape. (But not less than 3)
-
Try: local teamZombie = createTeam("Zombies") function onSpawnSlothBot() local x, y, z = getElementPosition (source) local rot = 0 local int = getElementInterior(source) local dim = getElementDimension(source) local weapon = 0 setTeamFriendlyFire(teamZombie,false) math.randomseed(os.time()) for i = 1,10 do local skin = math.random(21,23) local dec = math.random(10,200) exports.slothbot:spawnBot(x+dec, y+dec, z, rot, skin, int, dim, teamZombie, weapon) end end addEvent("onSpawnSlothBot",true) addEventHandler("onSpawnSlothBot",getRootElement(),onSpawnSlothBot) function onBotWasted(attacker, weapon, bodypart) if (attacker) then local x,y,z = getElementPosition(attacker) local rot = 0 local int = getElementInterior(attacker) local dim = getElementDimension(attacker) local weapon = 0 math.randomseed(os.time()) local skin = math.random(21,23) local dec = math.random(10,200) exports.slothbot:spawnBot(x + dec, y + dec, z, rot, skin, int, dim, teamZombie, weapon) else outputDebugString("Attacker doesn't exist") end end addEvent("onBotWasted",true) addEventHandler("onBotWasted",getRootElement(),onBotWasted)
-
Try this code: local teamZombie = createTeam("Zombies") function onSpawnSlothBot() local x, y, z = getElementPosition (source) local rot = 0 local int = getElementInterior(source) local dim = getElementDimension(source) local weapon = 0 setTeamFriendlyFire(teamZombie,false) for i = 1,10 do local skin = math.random(21,23) local dec = math.random(5,40) exports.slothbot:spawnBot(x+dec, y+dec, z, rot, skin, int, dim, teamZombie, weapon) end end addEvent("onSpawnSlothBot",true) addEventHandler("onSpawnSlothBot",getRootElement(),onSpawnSlothBot) function onBotWasted(attacker, weapon, bodypart) if (attacker) then local x,y,z = getElementPosition(attacker) local rot = 0 local int = getElementInterior(attacker) local dim = getElementDimension(attacker) local weapon = 0 local skin = math.random(21,23) local dec = math.random(7,40) exports.slothbot:spawnBot(x + dec, y + dec, z, rot, skin, int, dim, teamZombie, weapon) else outputDebugString("Attacker doesn't exist") end end addEvent("onBotWasted",true) addEventHandler("onBotWasted",getRootElement(),onBotWasted)
-
You spawn bots in "onSpawnSlothBot" event! In order to spawn bots, need to call this Event! Otherwise, you just did not execute the code inside the function "onSpawnSlothBot" Are you sure, that you have triggered "onSpawnSlothBot" event?
-
Try this: (instead of 11 and 26 strings) local dec = math.random(7,40) call ( getResourceFromName ( "slothbot" ), "spawnBot", x+v, y+dec, z, rot, skin, int, dim, teamZombie, weapon)
-
Try to create veh on serverside...
-
Да ты скидывай код сразу) Глянем, исправим) Вобще в каждой функции свой source, и лучше не заменять его значение. Тоесть "enteringPlayer" это просто первый аргумент, который ты можешь назвать например thePlayer итд... И потом использовать его в функции... Примерно так: Аргументы функции: function enterVehicle ( player enteringPlayer, int seat, player jacked, int door) Как объявляют функцию: function enterVehicle ( thePlayer, seat , jacked_player, door) где: thePlayer это игрок который садится в машину seat это место на которое thePlayer садится jacked_player это игрок который будет выкинут из машины door это дверь в которую садится thePlayer Главное в определенном порядке все объявлять
-
Or try this, if u want export bank balance from 50'p bank system: function FindReachPlayers( nPlayersCount ) if type( nPlayersCount ) == 'number' then local nStart = 0 local nIndexRemove = 0 local aReturnPlayers = { } local aReachPlayers = { } for _, pPlayer in pairs( getElementsByType 'player' ) do local accountName = getAccountName ( getPlayerAccount ( pPlayer ) ) local bank_money = tonumber( exports.bank:getBankAccountBalance(accountName) ) -- exports.RESOURCE_NAME:FUNCTION( ARGUMENTS ) table.insert( aReachPlayers, { [ pPlayer ] = bank_money } ) end for n = 1, nPlayersCount do for nIndex, a in ipairs( aReachPlayers ) do for pPlayer, nMoney in pairs( a ) do if nStart < nMoney then table.insert( aReturnPlayers, { [ pPlayer ] = nMoney } ) nStart = nMoney nIndexRemove = #aReturnPlayers end end end table.remove( aReachPlayers, nIndexRemove ) nIndexRemove = 0 nStart = 0 end return aReturnPlayers end return false end
-
https://wiki.multitheftauto.com/wiki/Resource:Editor#Starting_a_new_map
-
Try this: function onChat(source,_,...) local gang_members = {} local account = getPlayerAccount ( source ) local accountName = getAccountName ( account ) local gangName = exports.gang_system:getAccountGang ( accountName ) local msg = table.concat({...}, " ") local nick = getPlayerName(source) if (gangName) and not(gangName == 'None') then local gang_members = exports.gang_system:getGangMembers ( gangName ) for id, cur_player in ipairs (gang_members) do outputChatBox("#FF00FF(GC) "..nick..": #FFFFFF"..msg,cur_player,255,100,0,true) end end end addCommandHandler("gc",onChat) btw, I just found it:
-
Yes, and we can use dbExec with it)
