Search the Community

Showing results for tags 'lua'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • community.mtasa.com
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash
  • Private Bugtracker

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Gang


Location


Occupation


Interests

Found 274 results

  1. Callum

    FREE Scripting Lessons!

    I have launched a new, entirely free service that offers personal tutoring to anybody who wants to learn new MTA skills, including: Setting up an MTA Server Resources / scripts / meta.xml Writing Lua code MTA concepts such as events, timers, client-side interfaces, etc. SQL and other data storage methods I've been in the MTA community for coming up to 11 years now, and have worked with many of the 'big servers' that exist today, so the information will be delivered by people (including myself) with plenty of experience. The few students I'm already tutoring are well on their way to writing some basic MTA scripts already, after only a few days (totaling 4-5 hours). If you want to get involved, be sure to join the Discord server. You can also click here to see the recommended syllabus. If you know of anybody else who wants to learn to script, be sure to let them know of this great offer!
  2. GLC

    PLS HELP MEE

    --------------------- -- Player Ranking List -- --------------------- WindowSiralama2 = guiCreateWindow(245, 115, 450, 500, "Sıralama", false) guiSetProperty(WindowSiralama2, "CaptionColour", "FF1C90E1") guiWindowSetSizable(WindowSiralama2, false) guiWindowSetMovable(WindowSiralama2,false) guiSetVisible(WindowSiralama2, false) guiSetAlpha(WindowSiralama2, 1) centerWindow(WindowSiralama2) KapatButonSiralama2 = guiCreateButton(340, 466, 100, 24, "Kapat", false, WindowSiralama2) guiSetProperty(KapatButonSiralama2, "NormalTextColour", "FF2CFB03") LevelSiralamaButton = guiCreateButton(10, 466, 100, 24, "Level", false, WindowSiralama2) guiSetProperty(LevelSiralamaButton, "NormalTextColour", "FF2CFB03") ParaSiralamaButton = guiCreateButton(120, 466, 100, 24, "Para(Banka)", false, WindowSiralama2) guiSetProperty(ParaSiralamaButton, "NormalTextColour", "FF2CFB03") ZamanSiralamaButton = guiCreateButton(230, 466, 100, 24, "Zaman", false, WindowSiralama2) guiSetProperty(ZamanSiralamaButton, "NormalTextColour", "FF2CFB03") WindowSiralamaList2 = guiCreateGridList(5, 20, 440, 440, false, WindowSiralama2) local column = guiGridListAddColumn(WindowSiralamaList2, "Sıra", 0.20 ) local column1 = guiGridListAddColumn(WindowSiralamaList2, "Oyuncu Adı", 0.40 ) local column2 = guiGridListAddColumn(WindowSiralamaList2, "Level", 0.30 ) guiGridListSetSortingEnabled(WindowSiralamaList2, false) WindowSiralamaList3 = guiCreateGridList(5, 20, 440, 440, false, WindowSiralama2) local column = guiGridListAddColumn(WindowSiralamaList3, "Sıra", 0.20 ) local column1 = guiGridListAddColumn(WindowSiralamaList3, "Oyuncu Adı", 0.40 ) local column2 = guiGridListAddColumn(WindowSiralamaList3, "Para", 0.30 ) guiGridListSetSortingEnabled(WindowSiralamaList3, false) guiSetVisible(WindowSiralamaList3,false) WindowSiralamaList4 = guiCreateGridList(5, 20, 440, 440, false, WindowSiralama2) local column = guiGridListAddColumn(WindowSiralamaList4, "Sıra", 0.20 ) local column1 = guiGridListAddColumn(WindowSiralamaList4, "Oyuncu Adı", 0.40 ) local column2 = guiGridListAddColumn(WindowSiralamaList4, "Zaman", 0.30 ) guiGridListSetSortingEnabled(WindowSiralamaList4, false) guiSetVisible(WindowSiralamaList4,false) addEvent("SetData",true) addEventHandler("SetData",root,function ( Table ) guiGridListClear( WindowSiralamaList2 ) for i = 1,30 do local row = guiGridListAddRow ( WindowSiralamaList2 ) if ( Table [ i ].score ) then ---> fr_client.lua:2192 guiGridListSetItemText( WindowSiralamaList2, row, column, Table[i].sira , false, false ) guiGridListSetItemText( WindowSiralamaList2, row, column1, tostring(Table[i].name) , false, false ) guiGridListSetItemText( WindowSiralamaList2, row, column2, Table [ i ].score , false, false ) guiGridListSetItemColor(WindowSiralamaList2, row, column1, 255, 255, 0) guiGridListSetItemColor(WindowSiralamaList2, row, column2, 0, 180, 255) guiGridListSetItemColor(WindowSiralamaList2, row, column, 255, 0, 0) end end end) addEvent("SetData2",true) addEventHandler("SetData2",root,function ( Table ) guiGridListClear( WindowSiralamaList4 ) for i = 1,30 do local row = guiGridListAddRow ( WindowSiralamaList4 ) if ( Table [ i ].score ) then ---> fr_client.lua:2208 guiGridListSetItemText( WindowSiralamaList4, row, column, Table[i].sira , false, false ) guiGridListSetItemText( WindowSiralamaList4, row, column1, tostring(Table[i].name) , false, false ) guiGridListSetItemText( WindowSiralamaList4, row, column2, Table [ i ].score , false, false ) guiGridListSetItemColor(WindowSiralamaList4, row, column1, 255, 255, 0) guiGridListSetItemColor(WindowSiralamaList4, row, column2, 0, 180, 255) guiGridListSetItemColor(WindowSiralamaList4, row, column, 255, 0, 0) end end end) addEvent("updateTopMoney",true) addEventHandler("updateTopMoney",root,function ( Table ) guiGridListClear( WindowSiralamaList3 ) for i = 1,30 do local row = guiGridListAddRow ( WindowSiralamaList3 ) if ( Table [ i ].score ) then ---> fr_client.lua:2224 guiGridListSetItemText( WindowSiralamaList3, row, column, Table[i].sira , false, false ) guiGridListSetItemText( WindowSiralamaList3, row, column1, tostring(Table[i].name) , false, false ) guiGridListSetItemText( WindowSiralamaList3, row, column2, "$"..formatNumber(tostring(Table[i].score)).."" , false, false ) guiGridListSetItemColor(WindowSiralamaList3, row, column1, 255, 255, 0) guiGridListSetItemColor(WindowSiralamaList3, row, column2, 0, 180, 255) guiGridListSetItemColor(WindowSiralamaList3, row, column, 255, 0, 0) end end end) addEventHandler ( "onClientGUIClick", resourceRoot,function() if source == KapatButonSiralama2 then guiSetVisible(WindowSiralama2,false) elseif source == LevelSiralamaButton then if not durum1 then triggerServerEvent("getTop4", localPlayer) durum1 = true setTimer(function() durum1 = false end,60000,1) end if guiGetVisible(WindowSiralamaList3) then guiSetVisible(WindowSiralamaList3,false) end if guiGetVisible(WindowSiralamaList4) then guiSetVisible(WindowSiralamaList4,false) end guiSetVisible(WindowSiralamaList2,true) elseif source == ParaSiralamaButton then if not durum2 then triggerServerEvent("getTop3", localPlayer) durum2 = true setTimer(function() durum2 = false end,60000,1) end if guiGetVisible(WindowSiralamaList2) then guiSetVisible(WindowSiralamaList2,false) end if guiGetVisible(WindowSiralamaList4) then guiSetVisible(WindowSiralamaList4,false) end guiSetVisible(WindowSiralamaList3,true) elseif source == ZamanSiralamaButton then if not durum3 then triggerServerEvent("getTop4", localPlayer) durum3 = true setTimer(function() durum3 = false end,60000,1) end if guiGetVisible(WindowSiralamaList2) then guiSetVisible(WindowSiralamaList2,false) end if guiGetVisible(WindowSiralamaList3) then guiSetVisible(WindowSiralamaList3,false) end guiSetVisible(WindowSiralamaList4,true) end end) function formatNumber(n) if (not n) then return "Error catching data" end local left,num,right = string.match(n,'^([^%d]*%d)(%d*)(.-)$') return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right end Can you edit it, please? ERROR: [gameplay]\freeroam\fr_client.lua:2192 attempt to index field '?' (a nil value) ERROR: [gameplay]\freeroam\fr_client.lua:2208: attempt to index field '?' (a nil value) ERROR: [gameplay]\freeroam\fr_client.lua:2224 attempt to index field '?' (a nil value)
  3. for index, info in ipairs(blips) do dxSetRenderTarget(MiniMap["RenderTarget"], true) local bx = info.x local by = info.y local actualDist = getDistanceBetweenPoints2D(playerX, playerY, bx, by) local dist = actualDist/(worldMaxSize/((worldWidth+worldHeight)/2)) local rot = findRotation(bx, by, playerX, playerY)-camZ local blipX, blipY = getPointFromDistanceRotation( (MiniMap_x+MiniMap["width"]+MiniMap_x)/2, (MiniMap_y+MiniMap_y+MiniMap["height"])/2, math.min(dist, math.sqrt((MiniMap_y+MiniMap_y+MiniMap["height"])/2-MiniMap_y^2 + MiniMap_x+MiniMap["width"]-(MiniMap_x+MiniMap["width"]+MiniMap_x)/2^2)), rot ) local blipX = math.max(MiniMap_x, math.min(MiniMap_x+MiniMap["width"], blipX)) local blipY = math.max(MiniMap_y, math.min(MiniMap_y+MiniMap["height"], blipY)) local color = 255 dxDrawImage(blipX - blipSize/2, blipY - blipSize/2, blipSize, blipSize, "blips/".. info.blipID ..".png",0,0,0,tocolor(255,2555,255,255)) dxSetRenderTarget() end Why not working? No errors/warnings..
  4. br99pedro

    [HELP] Failed to call

    This is my problem ERROR: dayzmode/lib/team/s_team.lua:1: call: failed to call 'dayzconnect:MySQL' ERROR: dayzmode/lib/system/player.lua:1: call: failed to call 'dayzconnect:players' Im using this call ( getResourceFromName ( "dayzconnect" ), "MySQL", 1, "2", "three" ) <export function="MySQL"/> <include resource="dayzmap"/> <include resource="dayzmode"/> <include resource="dayzbase"/> <include resource="dayzcache"/> <include resource="object_preview"/> I do not know what to do anymore
  5. Help with this error! [19-05-08 19:57:15] ERROR: dayzconnect/class.lua:6: bad argument #1 to 'format' (string expected, got boolean) local XML = xmlLoadFile('connect.xml') local SET = xmlNodeGetChildren(XML)[1] local GET = xmlNodeGetAttribute local name,host,user,pass = GET(SET,''),GET(SET,''),GET(SET,''),GET(SET,'') xmlUnloadFile(XML) local Connect = Connection('mysql',('dbname=%s;host=%s'):format(name,host),user,pass) if Connect then outputServerLog('Successfully connect to MySQL server!') local mysql = {} mysql.connect = Connect function mysql.query(query,...) local qhandle = Connect:query(query,...) local r1,r2,r3 = qhandle:poll(-1) if not r1 then outputServerLog(('Query failed: errCode: %d - errMsg: %s'):format(r2,r3)) return false end return r1,r2,r3 end function mysql.exec(query,...) return Connect:exec(query,...) end local admin = { 'B95DA274DD099F546BA0C174D4BE1FB3', '8F6BF86822B5B77D4C34DFA249A595B3', 'CF62F88A8428C6B60B4A44E9BB930EB3', '05B31534456419BB563E021D675171A1', '8954600385BB91CF6E860EDE1E8C8292', } function mysql.server() local query = mysql.query('SELECT * FROM `central` WHERE `name` = ?',getServerName()) if query then if query[1] then return query[1] else mysql.exec('INSERT INTO `central` (`name`,`admin`) VALUES (?,?)',getServerName(),toJSON(admin)) return mysql.server() end end end mysql.server = mysql.server() function MySQL() return mysql end else outputServerLog('Couldnt connect to MySQL server!') getThisResource():stop() end
  6. Hi, I'm having some problems and I'm having a hard time resolving them. This is the .log ================================================================== = Multi Theft Auto: San Andreas v1.5.6 [64 bit] ================================================================== = Server name : Default MTA Server = Server IP address: auto = Server port : 22003 = = Log file : ..o_linux_x64/mods/deathmatch/logs/server.log = Maximum players : 32 = HTTP port : 22005 = Voice Chat : Disabled = Bandwidth saving : Medium ================================================================== [19-05-03 19:18:26] Resources: 200 loaded, 0 failed [19-05-03 19:18:27] MODULE: Loaded "MySQL 5.0 database module" (0.50) by "Alberto Alonso <rydencillo@gmail.com>" [19-05-03 19:18:27] Starting resources... [19-05-03 19:18:27] Server minclientversion is now 1.5.6-9.16588.0 [19-05-03 19:18:27] INFO: MAPMANAGER: Some important ACL permissions are missing. To ensure the correct functioning of Mapmanager, please write: aclrequest allow mapmanager all [19-05-03 19:18:28] Successfully connect to MySQL server! [19-05-03 19:18:28] ERROR: dayzmode/lib/team/s_team.lua:1: call: failed to call 'dayzconnect:MySQL' [string "?"] [19-05-03 19:18:28] ERROR: dayzmode/lib/system/player.lua:1: call: failed to call 'dayzconnect:MySQL' [string "?"] [19-05-03 19:18:28] ERROR: dayzmode/lib/system/player.lua:221: attempt to index local 'mysql' (a boolean value) [19-05-03 19:18:36] Gamemode 'dayzconnect' started. [19-05-03 19:18:36] Querying MTA master server... success! (Auto detected IP:149.56.252.100) [19-05-03 19:18:36] Authorized serial account protection is enabled for the ACL group(s): `Admin` See http://mtasa.com/authserial [19-05-03 19:18:36] WARNING: <owner_email_address> not set [19-05-03 19:18:36] Server started and is ready to accept connections! [19-05-03 19:18:36] To stop the server, type 'shutdown' or press Ctrl-C [19-05-03 19:18:36] Type 'help' for a list of commands. [19-05-03 19:18:55] Server stopped! [19-05-03 19:18:55] Stopping resources............................ [19-05-03 19:18:55] MODULE: Unloaded "MySQL 5.0 database module" (0.50) by "Alberto Alonso <rydencillo@gmail.com>" [19-05-03 19:18:55] Closing SQLite3 database This is the s_team.lua local mysql = exports.dayzconnect:MySQL() local function getDBTeam(name,host) local query = mysql.query('SELECT * FROM `teams` WHERE `name` = ?',name) if query then if query[1] then if host then outputDebugString(123) return false end return query[1] else mysql.exec('INSERT INTO `teams` (`name`,`host`) VALUES (?,?)',name,host) return getDBTeam(name) end end end local language = { ['createteam'] = {'Created team: ','Создан клан: '}, ['moreinfo'] = {'More info: ','Больше информации: '}, ['doesnotnewteam'] = {'The team with the same name is already registered!','Команда с таким именем уже зарегистрирована!'}, ['ansinviteteam'] = {'Write the chat /yes or /no to accept or refuse an invitation','Напишите в чат /yes или /no чтобы принять или отклонить приглашение'}, ['sendinviteonlyhost'] = {'Send an invitation can only be a team leader!','Отправлять приглашения может только лидер команды!'}, ['playeralreadyteam'] = {'The player is already a member of another team! He must leave her to get an invitation.','Игрок уже состоит в другой команде! Ему необходимо покинуть её, чтобы получить приглашение.'}, ['writebadname'] = {'The name is entered incorrectly!','Имя введено неверно!'}, ['nocreateteambecauseonteam'] = {'You are already a member of a team!','Вы уже состоите в команде!'}, ['leaveteam'] = {'You left the team: ','Вы покинули команду: '}, ['addmode'] = {'Added a new chat mode: team','Добавлен новый режим чата: team'}, ['usemode'] = {'Use Ctrl, to switch the chat mode','Используйте Ctrl, чтобы переключать режимы чата'}, ['usecmd'] = {'Use commands:','Используйте команды:'}, ['info1'] = {'/addplayer PLAYER_NAME [add a player to the team]','/addplayer ИМЯ_ИГРОКА [добавить игрока в команду]'}, ['info2'] = {'/leaveteam [leave team]','/leaveteam [покинуть команду]'}, } local function LANGUAGE(player,name) local lan = language[name] if lan then return lan[player:getData('options',false).language] or lan[1] end return name end local function isPlayerHostOfTeam(player,team) local team = getRegTeam(name) return player:getSerial() == team.host end local function setTeam(player,set) local oldTeam = player:getData('team') player:setData('team',set) player:setData('inviteteam',nil) if set then outputChat(player,LANGUAGE(player,'addmode'),'orange') outputChat(player,LANGUAGE(player,'usemode'),'orange') outputChat(player,LANGUAGE(player,'moreinfo')..'/infoteam','orange') elseif oldTeam then outputChat(player,LANGUAGE(player,'leaveteam')..oldTeam,'orange') end end local function newTeam(host,name) if host:getData('team') then outputChat(host,LANGUAGE(host,'nocreateteambecauseonteam'),'red') else local team = getDBTeam(name,host:getSerial()) if not team then outputChat(host,LANGUAGE(host,'doesnotnewteam'),'red') else outputChat(host,LANGUAGE(host,'createteam')..name,'orange') setTeam(host,name) end end end local function invitePlayerTeam(host,inviteName) local team = host:getData('team') local player = getPlayerFromName(inviteName) if player then if player:getData('team') then outputChat(host,LANGUAGE(host,'playeralreadyteam'),'red') else player:setData('inviteteam',team) outputChat(player,LANGUAGE(player,'ansinviteteam'),'orange') end else outputChat(host,LANGUAGE(host,'writebadname'),'red') end end local function infoTeam(player) outputChat(player,LANGUAGE(player,'usecmd'),'orange') outputChat(player,LANGUAGE(player,'info1'),'orange') outputChat(player,LANGUAGE(player,'info2'),'orange') end function teamCommand(player,cmd,comment) if cmd == 'createteam' then if #comment > 2 and #comment < 32 then return newTeam(player,comment) end elseif (cmd == 'yes' or cmd == 'no') and player:getData('inviteteam') then return setTeam(player,(cmd == 'yes' and player:getData('inviteteam'))) elseif cmd == 'addplayer' then return invitePlayerTeam(player,comment) elseif cmd == 'leaveteam' then return setTeam(player) elseif cmd == 'infoteam' then return infoTeam(player) end end This is the player.lua local mysql = exports.dayzconnect:MySQL() local function dbAccount(player,a) local a = a or {} local dbtype = mysql.server.type local serial = player:getSerial() local query,result = mysql.query('SELECT `serial` FROM '..dbtype..' WHERE `serial` = ?',serial) if query then if result > 0 then return (a.check and mysql.query('SELECT `serial` FROM '..dbtype..' WHERE `serial` = ?',serial)[1]) or true elseif a.create and mysql.exec('INSERT INTO '..dbtype..' (`name`,`serial`,`ip`) VALUES (?,?,?)',player:getName(),serial,player:getIP()) then return false end end end local defaultData = { ['blood'] = 5000, ['thirst'] = 80, ['hunger'] = 75, ['hands'] = false, ['pain'] = false, ['fracture'] = false, ['temperature'] = 36.6, ['damp'] = 0, ['bleeding'] = {0}, } local dataSave = { ['options']=true, ['face']=true, ['team']=true, ['coins']=true, ['spawnclothes']=true, } for name,_ in pairs(defaultData) do dataSave[name] = true end local function dbBackup() local backupPass = '%DayZ+iPanda=Love%' return Account('backup',backupPass) or addAccount('backup',backupPass) end local function setItem(item,source) if item then item.id = nil if source then item.id = tostring(source)..tostring(item) end if type(item.o) == 'table' then local sx,sy = itemSize(item) for n=1,sx*sy do if item.o[n] then item.o[n].id = nil if source then item.o[n].id = tostring(source)..tostring(item.o[n]) end if itemType(item.o[n].n) == 'cont' and type(item.o) == 'table' then local sx,sy = itemSize(item.o[n]) for n2=1,sx*sy do if item.o[n].o[n2] then item.o[n].o[n2].id = nil if source then item.o[n].o[n2].id = tostring(source)..tostring(item.o[n].o[n2]) end else if source then item.o[n].o[n2] = nil else item.o[n].o[n2] = false end end end end else if source then item.o[n] = nil else item.o[n] = false end end end end else item = false end return item end local function playerDefault(player) local playerpoints = getElementsByType('playerpoints') local x,y,z = getElementPosition(playerpoints[math.random(#playerpoints)]) player:spawn(x,y,z+0.1,math.random(360),0,0) for data,value in pairs(defaultData) do player:setData(data,value) end local inventory = resetClothes(player,player:getData('spawnclothes')) for i,item in ipairs(inventory) do player:setData(itemType(item.n),item) if type(item.o) == 'table' then table.insert(inventory[i].o,{n='battery',c=1,id=tostring(player)..'battery'}) table.insert(inventory[i].o,{n='wpn422flash',c=1,id=tostring(player)..'wpn422flash'}) end end player:setData('inventory',inventory) player:setData('pockets',{}) player:fadeCamera(true,4) local avatar = player:getData('avatar') if avatar and isElement(avatar) then avatar:setData('face',player:getData('face')) end end local function saveAccount(player) if player:getData('logedin') then player:setAnimation() player:setData('giveplayer',false) if player:isDead() then playerDefault(player) end local x,y,z = getElementPosition(player) if player:isInWater() then z = math.max(z,0)+10 end local pos = toJSON({math.round(100,x,y,z,getPedRotation(player))}) local data = {} for name,value in pairs(player:getAllData()) do if dataSave[name] then if name == 'hands' and value then value = setItem(value) end data[name] = value end end local data = toJSON(data) local inventory = {} for i,item in ipairs(player:getData('inventory')) do inventory[i] = setItem(item) end local inventory = toJSON(inventory) dbAccount(player,{create=true}) mysql.exec( 'UPDATE '..mysql.server.type..' SET `name` = ?, `ip` = ?, `pos` = ?, `data` = ?, `inventory` = ? WHERE `serial` = ?', player:getName(),player:getIP(),pos,data,inventory,player:getSerial() ) end end local function playerLogin(player,accData) local x,y,z,rot = unpack(fromJSON(accData.pos)) setElementPosition(player,x,y,z+0.1) setPedRotation(player,rot) player:setCameraTarget(player) player:fadeCamera(true,4) end local function playerSpawn(player) playerDefault(player) player:setCameraTarget(player) saveAccount(player) end addEvent('Spawn',true) addEventHandler('Spawn',root,playerSpawn) local function playerWasted(ammo,attacker,weapon,bodypart) source:fadeCamera(false,0) triggerClientEvent(source,'setBlackScreen',source,'You are dead') local x,y,z = getElementPosition(source) source:removeFromVehicle() if not source:isInWater() then local ped = Ped(source:getModel(),x,y,z,getPedRotation(source)) ped:removeClothes(0) ped:removeClothes(2) ped:removeClothes(3) ped:setData('face',source:getData('face')) local hands = source:getData('hands') if hands then triggerEvent('createItem',ped,hands) end local loot = {} for i,item in ipairs(source:getData('inventory')) do loot[i] = setItem(item,ped) source:setData(itemType(item.n),false) ped:setData(itemType(item.n),item) end local data = { loot = loot, } ped:setData('data',data) ped:kill() end source:setPosition(6000,6000,0) --playerSpawn(source) end addEventHandler('onPlayerWasted',root,playerWasted) local function destroyAvatar(player) local avatar = player:getData('avatar') if avatar and isElement(avatar) then avatar:destroy() end end local function createAvatar(player) destroyAvatar(player) local ped = Ped(0,6000,6000,10) ped:setFrozen(true) ped:removeClothes(0) ped:removeClothes(2) ped:removeClothes(3) ped:setData('face',player:getData('face')) ped:setData('noattach',true) player:setData('avatar',ped) end addEventHandler('onPlayerQuit',root,function() saveAccount(source) destroyAvatar(source) end) function mysql.destroy() mysql.connect:destroy() mysql.connect = nil outputServerLog('Destroy connect to MySQL server!') end addEventHandler('onResourceStop',resourceRoot,function() setGameSpeed(0.1) for _,player in ipairs(getElementsByType('player')) do if player:getData('logedin') then saveAccount(player) player:setFrozen(true) end end mysql.destroy() local backup = dbBackup() saveVehicles(backup) saveTents(backup) end) addEventHandler('onResourceStart',resourceRoot,function() for _,player in ipairs(getElementsByType('player')) do if player:getData('logedin') then createAvatar(player) end player:setFrozen(false) end local backup = dbBackup() if backup then if backup:getData('vehicles') then for _,data in ipairs(fromJSON(backup:getData('vehicles'))) do local vehpart = {} local vehdoor = {} for i=0,5 do vehpart[i] = data.vehpart[i+1] vehdoor[i] = data.vehdoor[i+1] end data.vehpart = vehpart data.vehdoor = vehdoor createVeh(data) end end if backup:getData('tents') then for _,data in ipairs(fromJSON(backup:getData('tents'))) do createTent(data) end end end end) --[[ addEventHandler('onPlayerLogin',root,function() -- if not AdminSerial[source:getSerial()] then -- return cancelEvent(true) -- end end) --]] addEventHandler('onPlayerStealthKill',root,function()cancelEvent()end) addEventHandler('onPlayerChangeNick',root,function()cancelEvent()end) addEventHandler('onPlayerJoin',root,function() for _,stat in ipairs({24,69,70,71,72,73,74,75,76,77,78,79,160,229,230}) do if stat == 69 or stat == 73 or stat == 75 then setPedStat(source,stat,500) else setPedStat(source,stat,999) end end setPedStat(source,23,300) setPedFightingStyle(source,5) for _,control in ipairs({'look_behind','next_weapon','previous_weapon','vehicle_look_behind','vehicle_look_right','vehicle_look_left','radar','action','change_camera'}) do toggleControl(source,control,false) end source:showHudComponent('all',false) source:showHudComponent('crosshair',true) source:setNametagShowing(false) showChat(source,false) source:removeClothes(0) source:removeClothes(2) source:removeClothes(3) local options = { language = 1, vperson = 3, } source:setData('options',options) local inventory,spawnclothes = resetClothes(source) source:setData('spawnclothes',spawnclothes) source:setData('inventory',inventory) source:setData('pockets',{}) source:setData('chatbox',{}) source:setData('coins',0) local db = dbAccount(source,{check=true}) if db then source:setDimension(db.id) for name,value in pairs(fromJSON(db.data)) do if name == 'hands' and value then value = setItem(value,source) end source:setData(name,value) end local inventory = {} for i,item in ipairs(fromJSON(db.inventory)) do inventory[i] = setItem(item,source) end source:setData('inventory',inventory) else for i,player in ipairs(getElementsByType('player')) do if player == source then source:setDimension(i) break end end end for i,admin in ipairs(fromJSON(mysql.server.admin)) do if admin == source:getSerial() then source:setData('admin','admin'..i) end end end) function spawnOrLogin(player) local accData = dbAccount(player,{check=true}) if accData and accData.pos then playerLogin(player,accData) else playerSpawn(player) end createAvatar(player) player:setDimension(0) end That's it, I do not know what else to do.
  7. A simple script of dressable characters and deformable faces. You can move every vertex of the head with a simple displacement shader. The script is in test state right now, I'll create a new editor later. Hope you like it.
  8. I want attach images to my message in default mta chat with a word, but i dont know how to attach the image to the message.. Anyone can help, and show me a example?
  9. Sugestoes de como começaram, ajudariam bastante
  10. Grozz

    [SHOW] 3D GUI Library

    I made a 3D GUI System in MTA:SA. You can place 3D GUI Elements (Buttons, Textboxes, Labels, Lists, Checkboxes, Sliders, etc.) wherever you want. It's not public yet.
  11. Olá pessoas deliciosamente bonitas! Bom, estou desenvolvendo um save-system por SQLite, porém, na parte de salvar as coordenadas do jogador, do contrário de salvar cada um dos tipos de coordenadas em uma coluna (X - Y - Z) eu queria salvar em uma única coluna (Coordenadas), mas como vocês devem saber, dados obtidos de um db são retornados como string, então utilizei Vector3 e tonumber, mas com o tonumber retorna um valor nulo, e sem ele retorna uma string, como eu poderia fazer para retornar o valor original de coordenadas? Código: local x2, y2, z2 = 675.99396,-1692.27075,8.70498 -- LUGAR QUE VAI SPAWNAR QUANDO CRIAR CONTA NOVA local db = exports.ds_sqlite db:exec("CREATE TABLE IF NOT EXISTS Usuarios (Nick TEXT, Usuario TEXT, Serial TEXT, Skin INT, Dinheiro INT, Coordenadas TEXT, Interior INT, Dimensao INT, Procurado INT)") function loadUsuarios(player, acc) local accName = getAccountName(getPlayerAccount(player)) local datas = db:query("SELECT * FROM Usuarios WHERE Usuario=? LIMIT 1", accName) if (datas and type(datas) == "table" and #datas > 0) then -- @Datas setElementData(player, "CRP:Skin", tonumber(datas[1]["Skin"])) setElementData(player, "CRP:Dinheiro", tonumber(datas[1]["Dinheiro"])) setElementData(player, "CRP:Coordenadas", datas[1]["Coordenadas"]) setElementData(player, "CRP:Interior", tonumber(datas[1]["Interior"])) setElementData(player, "CRP:Dimensao", tonumber(datas[1]["Dimensao"])) setElementData(player, "CRP:Procurado", tonumber(datas[1]["Procurado"])) iprint(datas[1]["Coordenadas"]) -- @Funções setCameraTarget(player, player) fadeCamera(player, true, 2.0) spawnPlayer(player, Vector3(datas[1]["Coordenadas"])) setElementPosition(player, Vector3(datas[1]["Coordenadas"])) setElementModel(player, tonumber(datas[1]["Skin"])) setPlayerMoney(player, tonumber(datas[1]["Dinheiro"])) setElementInterior(player, tonumber(datas[1]["Interior"])) setElementDimension(player, tonumber(datas[1]["Dimensao"])) setPlayerWantedLevel(player, tonumber(datas[1]["Procurado"])) else setCameraTarget(player, player) fadeCamera(player, true, 2.0) spawnPlayer(player, x2, y2, z2) setElementPosition(player, x2, y2, z2) local x, y, z = getElementPosition(player) db:exec("INSERT INTO Usuarios VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", getPlayerName(player):gsub("#%x%x%x%x%x%x", ""), accName, getPlayerSerial(player), getElementModel(player), getPlayerMoney(player), x..","..y..","..z + 0.7, getElementInterior(player), getElementDimension(player), getPlayerWantedLevel(player)) end end function saveUsuarios(player, acc) local accName = getAccountName(getPlayerAccount(player)) local datas = db:query("SELECT * FROM Usuarios WHERE Usuario=? LIMIT 1", accName) if (#datas > 0) then local x, y, z = getElementPosition(player) db:query("UPDATE Usuarios SET Nick=?, Usuario=?, Serial=?, Skin=?, Dinheiro=?, Coordenadas=?, Interior=?, Dimensao=?, Procurado=?", getPlayerName(player):gsub("#%x%x%x%x%x%x", ""), accName, getPlayerSerial(player), getElementModel(player), getPlayerMoney(player), x..","..y..","..z + 0.7, getElementInterior(player), getElementDimension(player), getPlayerWantedLevel(player)) end end addEventHandler("onPlayerLogin", root, function() for index, players in ipairs(getElementsByType("player")) do if (players == source) then local account = getPlayerAccount(players) loadUsuarios(players, account) end end end ) addEventHandler("onPlayerQuit", root, function() for index, players in ipairs(getElementsByType("player")) do if (players == source) then local account = getPlayerAccount(players) if (account) then saveUsuarios(players, account) end end end end )
  12. biscoitoimproprio

    Ajuda em um script de anim

    Pessoal, estou querendo criar um script com a animação de cruzar os braços, que seria time, tentei fazer ai abaixo mas não pega, acho que fiz algo errado, me ajudem. (Esse e meu primeiro script)
  13. CLIENT: function cancelTazerDamage(attacker, weapon, bodypart, loss) if (weapon==24) then -- deagle local mode = getElementData(attacker, "handTaser") if (mode==true) then cancelEvent() end end end addEventHandler("onClientPlayerDamage", localPlayer, cancelTazerDamage) local cFunc = {} local cSetting = {} cSetting["shots"] = {} cSetting["shot_calcs"] = {} local last_shot = 1 cFunc["draw_shot"] = function(x1, y1, z1, x2, y2, z2) table.insert(cSetting["shots"], last_shot, {x1, y1, z1, x2, y2, z2}) local lastx, lasty, lastz = x1, y1, z1 local dis = getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2) cSetting["shot_calcs"][last_shot] = {} last_shot = last_shot+1 end cFunc["wait_shot"] = function() toggleControl("fire", false) setTimer(function() toggleControl("fire", true) end, 15000, 1) end cFunc["shot_check"] = function(wp, _, _, hitX, hitY, hitZ, element, startX, startY, startZ) if(wp == 24) and (getElementData(localPlayer,"handTaser"))then cFunc["shot_weapon"](hitX, hitY, hitZ, startX, startY, startZ) cancelEvent() if(source == localPlayer) then cFunc["wait_shot"]() end end end cFunc["anim_check"] = function(attacker, wep, bodypart,loss) if(wep == 24) and (getElementData(localPlayer,"handTaser"))then local playerX,playerY,playerZ = getElementPosition(localPlayer) local targetX,targetY,targetZ = getElementPosition(source) if getDistanceBetweenPoints3D(playerX,playerY,playerZ,targetX,targetY,targetZ) <= 12 then triggerServerEvent("tazerFired", getRootElement(), source) end end end addEventHandler("onClientPlayerWeaponFire", getRootElement(), cFunc["shot_check"]) addEventHandler("onClientPedDamage", getRootElement(),cFunc["anim_check"]) addEventHandler("onClientPlayerDamage", getRootElement(),cFunc["anim_check"]) addEventHandler("onClientResourceStart",resourceRoot,function() setElementData(localPlayer, "tazed",0) end) addEventHandler("onClientRender",getRootElement(),function() if getElementData(localPlayer, "tazed") == 1 then toggleAllControls(false, false, false) toggleControl("fire", false) toggleControl("sprint", false) toggleControl("crouch", false) toggleControl("jump", false) toggleControl('next_weapon',false) toggleControl('previous_weapon',false) toggleControl('aim_weapon',false) end end) SERVER: local cFunc = {} local cSetting = {} function tazerFired(target) if (isElement(target) and getElementType(target)=="player") then fadeCamera ( target, false, 1.0, 255, 255, 255 ) setElementData(target, "tazed", 1) toggleAllControls(target, false, false, false) setPedAnimation(target, "ped", "FLOOR_hit_f", -1, false, false, true) setTimer(removeAnimation, 30000, 1, target) end end addEvent("tazerFired", true ) addEventHandler("tazerFired", getRootElement(), tazerFired) function removeAnimation(thePlayer) if (isElement(thePlayer) and getElementType(thePlayer)=="player") then fadeCamera(thePlayer, true, 0.5) if getElementData(thePlayer,"isAnim") then setElementFrozen(thePlayer,true) setPedAnimation(thePlayer,"sweet","sweet_injuredloop",-1,false,false,false) else setPedAnimation(thePlayer,nil,nil) toggleAllControls(thePlayer, true, true, true) end setElementData(thePlayer, "tazed", 0) end end I do not get any errors/warnings in debugscript 3, just simply does not working the script.. What wrong in this codes? :s
  14. doctor

    Use more LUA files (require)

    Hello there! I just started to develop some fun scripts to the MTA SA (1.5.6) Im not a professional LUA programmer but as good i see on forums (stack overflow etc.) there is a way to import or use functions from other lua files with "require" My problem is that the "require" isnt working for me and i cant import functions from other lua file.I will not paste code because i tried every possible combinations of using the "require" Is there some way to use functions from other file? can i use "require" or there is a alternative for it? Thank you for your answrs 😊
  15. В сыгранную и скилловую команду требуется разработчик LUA, с опытом работы в MTA (Multi Theft Auto) от 5 месяцев. Что мы готовы предложить?• Заработную плату от 70.000 рублей в месяц — выплата 2 раза в месяц;• Работу с новыми продуктовыми релизами — минимум задач по рефакторингу;• Комфортные рабочие условия;• Оперативную реакцию команды на все рабочие вопросы.Чего мы ожидаем от вас?• Опыт программирования на LUA;• Профильный опыт разработки MTA-проектов от 5 месяцев;• Понимание основных принципов ООП;• Базовые знания MySQL и XML.Отдельным плюсом будет:• Опыт работы с API и интеграцией внешних сервисов к игровому моду;• Знание методологии оценки нагрузки скриптов и модулей на сервера, а также принципов оптимизации кода; Для связи пишите на почту: hr@nextrp.ru
  16. Boa noite, eu estudei um pouco na wiki e fiz um script de bar, assim, o script do bar não fui eu que fiz, apenas coloquei um painel e alguns sistemas, talvez eu venda + talvez não porque fiz outro parecido só que de limpar ficha e ficou mais exclusivo.. assim vamos lá, primeiramente são 4 bares, com o interior 11, assim que entra ne qualquer um deles, tem o ped, em cima do ped coloquei um dxDrawText mandando o player pressionar a letra "M" para abrir o cursor que é a função com nome de "Nametag", e depois clicar no ped para abrir o painel menu para compra a bebida que ele deseja, mas após abrir clicar no ped e o painel menu ter aberto, a função "Nametag" ( A que manda o player pressionar a letra M e clicar no ped, ou seja o texto continua no ped mesmo com o painel-menu aberto ), e também não seta o walkingStyle.. voces poderiam me informar o erro e como resolve-lo ? c.lua --[[ ################################################ # # # RESOURCE DESENVOLVIDO por: # # < #Horus > # # # # # ################################################ ]] local ped = createPed(240, 497.283, -77.876, 998.765, 0) local ped2 = createPed(240, 497.283, -77.876, 998.765, 0) local ped3 = createPed(240, 497.283, -77.876, 998.765, 0) local ped4 = createPed(240, 497.283, -77.876, 998.765, 0) setElementInterior(ped, 11) setElementDimension(ped, 1) setElementFrozen(ped, true) setElementInterior(ped2, 11) setElementDimension(ped2, 2) setElementFrozen(ped2, true) setElementInterior(ped3, 11) setElementDimension(ped3, 3) setElementFrozen(ped3, true) setElementInterior(ped4, 11) setElementDimension(ped4, 4) setElementFrozen(ped4, true) local dxfont0_fonte = dxCreateFont("font/fonte.ttf", 10) local screenW, screenH = guiGetScreenSize() local resW, resH = 1360,768 local x, y = (screenW/resW), (screenH/resH) function setBlur(state) setElementData(localPlayer, "showBlur", state) end function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end function dxDrawLinedRectangle( x, y, width, height, color, _width, postGUI ) _width = _width or 1 dxDrawLine ( x, y, x+width, y, color, _width, postGUI ) -- Top dxDrawLine ( x, y, x, y+height, color, _width, postGUI ) -- Left dxDrawLine ( x, y+height, x+width, y+height, color, _width, postGUI ) -- Bottom return dxDrawLine ( x+width, y, x+width, y+height, color, _width, postGUI ) -- Right end function cancelPedDamage(attacker) cancelEvent() end addEventHandler("onClientPedDamage", ped, cancelPedDamage) addEventHandler("onClientPedDamage", ped2, cancelPedDamage) addEventHandler("onClientPedDamage", ped3, cancelPedDamage) addEventHandler("onClientPedDamage", ped4, cancelPedDamage) function drawDrinks() tocolor1 = tocolor(0, 0, 0, 150) if isCursorOnElement(screenW * 0.3257, screenH * 0.4115, screenW * 0.3272, screenH * 0.0469) then -- CATUABA tocolor1 = tocolor(16, 102, 231, 100) end tocolor2 = tocolor(0, 0, 0, 150) if isCursorOnElement(screenW * 0.3257, screenH * 0.4583, screenW * 0.3272, screenH * 0.0469) then -- VODCA tocolor2 = tocolor(16, 102, 231, 100) end tocolor3 = tocolor(0, 0, 0, 150) if isCursorOnElement(screenW * 0.3257, screenH * 0.5052, screenW * 0.3272, screenH * 0.0469) then -- CERVEJA tocolor3 = tocolor(16, 102, 231, 100) end tocolorF = tocolor(217, 0, 5, 0) if isCursorOnElement(screenW * 0.6426, screenH * 0.3490, screenW * 0.0221, screenH * 0.0417) then -- CLOSE tocolorF = tocolor(217, 0, 5, 150) end -- ################# BACKGROUND ################# dxDrawRectangle(screenW * 0.3140, screenH * 0.3490, screenW * 0.3507, screenH * 0.3997, tocolor(0, 0, 0, 150), false) dxDrawRectangle(screenW * 0.3140, screenH * 0.3490, screenW * 0.3507, screenH * 0.0417, tocolor(0, 0, 0, 150), false) -- ################# BUTTONS ################# dxDrawRectangle(screenW * 0.3257, screenH * 0.4115, screenW * 0.3272, screenH * 0.0469, tocolor1, false) -- CATUABA dxDrawRectangle(screenW * 0.3257, screenH * 0.4583, screenW * 0.3272, screenH * 0.0469, tocolor2, false) -- VODCA dxDrawRectangle(screenW * 0.3257, screenH * 0.5052, screenW * 0.3272, screenH * 0.0469, tocolor3, false) -- CERVEJA dxDrawRectangle(screenW * 0.6426, screenH * 0.3490, screenW * 0.0221, screenH * 0.0417, tocolorF, false) -- CLOSE -- ################# IMAGENS ################# dxDrawImage(screenW * 0.3287, screenH * 0.4180, screenW * 0.0191, screenH * 0.0352, "", 0, 0, 0, tocolor(255, 255, 255, 217), false) dxDrawImage(screenW * 0.3287, screenH * 0.5573, screenW * 0.0191, screenH * 0.0339, "", 0, 0, 0, tocolor(255, 255, 255, 217), false) dxDrawImage(screenW * 0.3257, screenH * 0.6458, screenW * 0.0265, screenH * 0.0430, "", 0, 0, 0, tocolor(254, 254, 254, 205), false) dxDrawImage(screenW * 0.3287, screenH * 0.4661, screenW * 0.0191, screenH * 0.0352, "", 0, 0, 0, tocolor(255, 255, 255, 217), false) dxDrawImage(screenW * 0.3287, screenH * 0.5143, screenW * 0.0191, screenH * 0.0352, "", 0, 0, 0, tocolor(255, 255, 255, 217), false) dxDrawImage(screenW * 0.3287, screenH * 0.6042, screenW * 0.0191, screenH * 0.0339, "", 0, 0, 0, tocolor(255, 255, 255, 217), false) -- ################# TEXTOS ################# dxDrawText("Bar Passa Tempo - MENU", screenW * 0.4280, screenH * 0.3600, screenW * 0.4324, screenH * 0.3984, tocolor(255, 255, 255, 202), 1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("X", screenW * 0.6500, screenH * 0.3555, screenW * 0.7610, screenH * 0.3984, tocolor(255, 255, 255, 202), 1.30, "default-bold", "left", "top", false, false, false, true, false) dxDrawText("Catuaba", screenW * 0.3522, screenH * 0.4232, screenW * 0.4632, screenH * 0.4661, tocolor(255, 255, 255, 202), 1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("Vodca", screenW * 0.3522, screenH * 0.4714, screenW * 0.4632, screenH * 0.5143, tocolor(255, 255, 255, 202), 1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("Cerveja", screenW * 0.3522, screenH * 0.5183, screenW * 0.4632, screenH * 0.5573, tocolor(255, 255, 255, 202), 1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("#FF0000R$ #FFFFFF200", screenW * 0.6044, screenH * 0.4245, screenW * 0.7154, screenH * 0.4674, tocolor(255, 255, 255, 202), 1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("#FF0000R$ #FFFFFF150", screenW * 0.6044, screenH * 0.4674, screenW * 0.7154, screenH * 0.5104, tocolor(255, 255, 255, 202), 1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("#FF0000R$ #FFFFFF100", screenW * 0.6044, screenH * 0.5182, screenW * 0.7154, screenH * 0.5612, tocolor(255, 255, 255, 202), 1.00, dxfont0_fonte, "left", "top", false, false, false, true, false) dxDrawText("Selecione uma bebida abaixo:", screenW * 0.4350, screenH * 0.3898, screenW * 0.4324, screenH * 0.7487, tocolor(255, 255, 255, 202), 0.8, dxfont0_fonte, "left", "top", false, false, false, true, false) end function render() local screenx, screeny, worldx, worldy, worldz = getCursorPosition() local px, py, pz = getCameraMatrix() local hit, x, y, z, elementHit = processLineOfSight ( px, py, pz, worldx, worldy, worldz ) local tx, ty, tz = getElementPosition(localPlayer) local rx, ry, rz = getElementPosition(ped) local distancia = getDistanceBetweenPoints3D(tx, ty, tz, rx, ry, rz) if not isEventHandlerAdded("onClientRender", root, drawDrink) then if (distancia < 5) then if hit then if elementHit == ped then addEventHandler("onClientRender", root, drawDrinks) showCursor(true) showChat(false) setElementData(localPlayer, "showBlur", true) end if elementHit == ped2 then addEventHandler("onClientRender", root, drawDrinks) showCursor(true) showChat(false) setElementData(localPlayer, "showBlur", true) end if elementHit == ped3 then addEventHandler("onClientRender", root, drawDrinks) showCursor(true) showChat(false) setElementData(localPlayer, "showBlur", true) end if elementHit == ped4 then addEventHandler("onClientRender", root, drawDrinks) showCursor(true) showChat(false) setElementData(localPlayer, "showBlur", true) end end end end end addEventHandler("onClientClick", root, render) local rootElement = getRootElement() local screenWidth, screenHeight = guiGetScreenSize() local maxrange = 9 function Nametag() local pedX, pedY, pedZ = getElementPosition(ped) local sx, sy = getScreenFromWorldPosition (pedX,pedY,pedZ +1) local cameraX, cameraY, cameraZ = getCameraMatrix() if sx then if getDistanceBetweenPoints3D(cameraX,cameraY,cameraZ,pedX,pedY,pedZ) <= maxrange then if not getElementData(localPlayer, "showBlur") then dxDrawRectangle(sx - x*110,sy + y*57, screenW * 0.2514, screenH * 0.0630, tocolor(0, 0, 0, 165), false) dxDrawText("Garçom - Bebidas e Diversão;",sx - 25 ,sy + 60,screenWidth, screenHeight,tocolor ( 255, 255, 255, 230 ), 0.9,dxfont0_fonte) dxDrawText('Pressione #FF0000"M" #FFFFFFe clique no garçom para abrir o menu!',sx - 100,sy + 80,screenWidth, screenHeight,tocolor ( 255, 255, 255, 230 ), 0.8,dxfont0_fonte, "left", "top", false, false, false, true, false) end end end end addEventHandler("onClientRender",rootElement, Nametag) function closePanel(_,state) if isEventHandlerAdded("onClientRender", root, drawDrinks) then if state == "down" then if isCursorOnElement(screenW * 0.6426, screenH * 0.3490, screenW * 0.0221, screenH * 0.0417) then showCursor(false) showChat(true) playSound("sfx/hit.mp3", false) removeEventHandler("onClientRender", root, drawDrinks) setElementData(localPlayer, "showBlur", false) end end end end addEventHandler("onClientClick", root, closePanel) function Catuaba(_,state) if isEventHandlerAdded("onClientRender", root, drawDrinks) then if state == "down" then if isCursorOnElement(screenW * 0.3257, screenH * 0.4115, screenW * 0.3272, screenH * 0.0469) then setBlur(false) elseif (not isTimer(timerExpireDrinks)) then triggerServerEvent("server:onPlayerBuyDrinkBVS", resourceRoot, 200) else playSound("sfx/hit.mp3", false) outputChatBox("Você ainda está com efeito da bebida, espere mais um pouco para beber de novo.", 255, 0, 0) removeEventHandler("onClientRender", root, drawDrinks) showCursor(false) end end end end addEventHandler("onClientClick", root, Catuaba) function Vodca(_,state) if isEventHandlerAdded("onClientRender", root, drawDrinks) then if state == "down" then if isCursorOnElement(screenW * 0.3257, screenH * 0.4583, screenW * 0.3272, screenH * 0.0469) then setBlur(false) elseif (not isTimer(timerExpireDrinks)) then triggerServerEvent("server:onPlayerBuyDrinkBVS", resourceRoot, 150) else playSound("sfx/hit.mp3", false) outputChatBox("Você ainda está com efeito da bebida, espere mais um pouco para beber de novo.", 255, 0, 0) removeEventHandler("onClientRender", root, drawDrinks) showCursor(false) end end end end addEventHandler("onClientClick", root, Vodca) function Cerveja(_,state) if isEventHandlerAdded("onClientRender", root, drawDrinks) then if state == "down" then if isCursorOnElement(screenW * 0.3257, screenH * 0.5052, screenW * 0.3272, screenH * 0.0469) then setBlur(false) elseif (not isTimer(timerExpireDrinks)) then triggerServerEvent("server:onPlayerBuyDrinkBVS", resourceRoot, 100) else playSound("sfx/hit.mp3", false) outputChatBox("Você ainda está com efeito da bebida, espere mais um pouco para beber de novo.", 255, 0, 0) removeEventHandler("onClientRender", root, drawDrinks) showCursor(false) end end end end addEventHandler("onClientClick", root, Cerveja) function currentEffectDrinks() ---------------------------------------------------------- timerControlDrinks = setTimer(function() setPedControlState(localPlayer, "walk", true) end, 100, 0) setWindVelocity(100, 100, 0) setCameraShakeLevel(255) ---------------------------------------------------------- timerExpireDrinks = setTimer(function() ---------------------------------------------------------- resetWindVelocity() setCameraShakeLevel(1) if isTimer(timerControlDrinks) then killTimer(timerControlDrinks) end setPedControlState(localPlayer, "walk", false) outputChatBox("O efeito da bebida acabou.", 0, 255, 0) triggerServerEvent("resetWalkingStyle",resourceRoot) ---------------------------------------------------------- end, math.random(40000, 60000), 1) end addEvent("client:currentEffectDrinks", true) addEventHandler("client:currentEffectDrinks", resourceRoot, currentEffectDrinks) function isCursorOnElement( posX, posY, width, height ) if isCursorShowing( ) then local mouseX, mouseY = getCursorPosition( ) local clientW, clientH = guiGetScreenSize( ) local mouseX, mouseY = mouseX * clientW, mouseY * clientH if ( mouseX > posX and mouseX < ( posX + width ) and mouseY > posY and mouseY < ( posY + height ) ) then return true end end return false end s.lua local markersBarPositions = { {2348.547, -1372.678, 24.398, 501.900, -67.600, 999.700, 11, 1}, -- 1 {1000.592, -919.914, 42.328, 501.900, -67.600, 999.700, 11, 2}, -- 2 {2369.240, 1984.234, 10.820, 501.900, -67.600, 999.700, 11, 3}, -- 3 {-2432.25, -183.043, 35.312, 501.900, -67.600, 999.700, 11, 4}, -- 4 } local markersBarEnter = {} local markersBarExit = {} for i=1, #markersBarPositions do local xEnter, yEnter, zEnter, xExit, yExit, zExit, intEnter, dimEnter = unpack(markersBarPositions[i]) markersBarEnter[i] = createMarker(xEnter, yEnter, zEnter+1, "arrow", 1.5, 0, 16, 102, 231) local blip = createBlip(xEnter, yEnter, zEnter, 49) setBlipVisibleDistance(blip, 300) markersBarExit[i] = createMarker(xExit, yExit, zExit+0.1, "arrow", 1.5, 255, 0, 0, 255) setElementInterior(markersBarExit[i], intEnter, xExit, yExit, zExit-1) setElementDimension(markersBarExit[i], dimEnter) function enterBarBV:~(hitElement, matchingDimension) if (getElementType(hitElement) == "player") and (matchingDimension) then local vehicle = getPedOccupiedVehicle(hitElement) local playerAccount = getPlayerAccount(hitElement) if (not vehicle) then if (playerAccount) then if (not isGuestAccount(playerAccount)) then setElementInterior(hitElement, intEnter, xExit, yExit-2, zExit) setElementDimension(hitElement, dimEnter) setElementPosition(hitElement, xExit, yExit-2, zExit) setElementRotation(hitElement, 0, 0, 180) end end end end end addEventHandler("onMarkerHit", markersBarEnter[i], enterBarBV:~) function exitBarBV:~(hitElement, matchingDimension) if (getElementType(hitElement) == "player") and (matchingDimension) then setElementInterior(hitElement, 0, xEnter, yEnter-5, zEnter) setElementDimension(hitElement, 0) setElementPosition(hitElement, xEnter, yEnter-5, zEnter) end end addEventHandler("onMarkerHit", markersBarExit[i], exitBarBV:~) end function onPlayerBuyDrinkBVS(price) local money = getPlayerMoney(client) if (money >= price) then takePlayerMoney(client, price) local atualHealth = getElementHealth(client) setElementHealth(client, atualHealth + 20) playSound("sfx/hit.mp3", false) ----------------------------------------------------- setPedWalkingStyle(client, 126) triggerClientEvent(client, "client:currentEffectDrinks", resourceRoot) ----------------------------------------------------- outputChatBox("Drink comprado com sucesso.", client, 16, 102, 231) else playSound("sfx/hit.mp3", false) outputChatBox("Você não possui dinheiro suficiente.", client, 255, 0, 0) end end addEvent("server:onPlayerBuyDrinkBVS", true) addEventHandler("server:onPlayerBuyDrinkBVS", resourceRoot, onPlayerBuyDrinkBVS) function resetWalkingStyle() setPedWalkingStyle(client, 0) end addEvent("resetWalkingStyle", true) addEventHandler("resetWalkingStyle", resourceRoot, resetWalkingStyle)
  17. Client.lua: function processLockUnlock(vehicle) if vehicle then local vehicleID = tonumber(getElementData(vehicle, "veh:id")) or -1 local vehFaction = tonumber(getElementData(vehicle, "veh:faction")) or 0 local vehOwner = tonumber(getElementData(vehicle, "veh:owner")) or -1 local vehJobID = tonumber(getElementData(vehicle, "veh:jobvehID")) or -1 local locked = isVehicleLocked(vehicle) local vehID = getElementModel(vehicle) local vehName = getVehicleRealName(vehID) if isPedInVehicle(localPlayer) then playSounds("lockin") else playSounds("lockout") end if locked then triggerServerEvent("vehicleLock", localPlayer,localPlayer, vehicle, false) else triggerServerEvent("vehicleLock", localPlayer,localPlayer, vehicle, true) end else outputChatBox("#FFFFFF Nincs kulcsod ehhez a járműhöz.", 169,139,101, true) end end local klikkTimer = false function setVehicleLockState() if klikkTimer then return end if isTimer(klikkTimerRun) then return end klikkTimer = true klikkTimerRun = setTimer(function() klikkTimer = false end,1000,1) local vehicle = getPedOccupiedVehicle ( localPlayer ) if vehicle then processLockUnlock(vehicle) else local int2 = getElementInterior(localPlayer) local dim2 = getElementDimension(localPlayer) local mx,my,mz = getElementPosition(localPlayer) local interior = getElementData(localPlayer, "interior") or false if not interior then for k,v in ipairs(getElementsByType("vehicle")) do local x,y,z = getElementPosition(v) local int = getElementInterior(v) local dim = getElementDimension(v) local dist = getDistanceBetweenPoints3D(x,y,z,mx,my,mz) if dist <= 3 and int2 == int and dim2 == dim then processLockUnlock(v) return end end end end end bindKey("k", "down", setVehicleLockState) setTimer(function() if not bindKey("k", "down", setVehicleLockState) then bindKey("k", "down", setVehicleLockState) end end, 1000, 0) Server.lua: addEvent("vehicleLock",true) addEventHandler("vehicleLock",getRootElement(),function(player,veh,value) setVehicleLocked(veh, value) veh:setData("veh:status", value) end) No errors / warnings in debugscript... if i press the [K] button, nothing happens... what wrong in this code? how to fix?
  18. here's a video about the bug..: How to fix this bug? I tried many things, but unsuccessfully.. :s Here the code: Client.lua: local sX, sY = guiGetScreenSize() setElementData(localPlayer,"name",nil) GUIEditor = { button = {}, edit = {} } GUIEditor.button[1] = guiCreateButton(0.72, 0.74, 0.03, 0.04, ">", true) kuldottpmek = {} fogadottpmek = {} GUIEditor.edit[1] = guiCreateEdit(0.38, 0.74, 0.34, 0.04, ".", true) guiEditSetMaxLength(GUIEditor.edit[1], 150) local dxfont0_gothic = dxCreateFont(":mta_wintertime/gothic.ttf", 14) local screenW, screenH = guiGetScreenSize() local players = getElementsByType ( "player" ) addEventHandler("onClientRender", root, function() local players = getElementsByType ( "player" ) local elem = 0 local fpm = 0 local kpm = 0 local uzenet = guiGetText(GUIEditor.edit[1]) dxDrawRectangle(screenW * 0.3722, screenH * 0.2722, screenW * 0.3833, screenH * 0.5100, tocolor(0, 0, 0, 162), false) dxDrawRectangle(screenW * 0.1757, screenH * 0.2722, screenW * 0.1896, screenH * 0.5100, tocolor(0, 0, 0, 162), false) dxDrawText("Játékoslista", screenW * 0.1764, screenH * 0.2722, screenW * 0.3653, screenH * 0.3167, tocolor(255, 255, 255, 255), 1.00, dxfont0_gothic, "center", "center", false, false, false, false, false) for id,player in ipairs(players) do local plname = getPlayerName(player) elem = elem + 1 dxDrawText(plname, screenW * 0.1764, screenH * 0.2500+(elem*70), screenW * 0.3653, screenH * 0.3578, tocolor(255, 255, 255, 255), 0.65, dxfont0_gothic, "left", "center", false, false, true, true, false) dxDrawRectangle(screenW * 0.1764, screenH * 0.2850+(elem*35), screenW * 0.1889, screenH * 0.0367, tocolor(0, 0, 0, 162), false) end dxDrawText(getElementData(localPlayer,"name") or "Válassz játékost", screenW * 0.3722, screenH * 0.2722, screenW * 0.7556, screenH * 0.3167, tocolor(255, 255, 255, 255), 1.00, dxfont0_gothic, "center", "center", false, false, false, true, false) dxDrawText(getElementData(localPlayer,"name") and "Elérhető most" or "", screenW * 0.5278, screenH * 0.3056, screenW * 0.6014, screenH * 0.3411, tocolor(255, 255, 255, 255), 0.65, dxfont0_gothic, "center", "center", false, false, false, true, false) dxDrawRectangle(screenW * 0.3722, screenH * 0.3467, screenW * 0.3833, screenH * 0.3844, tocolor(0, 0, 0, 162), false) for k,v in ipairs(kuldottpmek) do kpm = kpm + 1 dxDrawRectangle(screenW * 0.3722, screenH * 0.2775+(kpm*62), screenW * 0.3833, screenH * 0.0633, tocolor(94, 192, 254, 162), false) dxDrawText("Te:", screenW * 0.3729, screenH * 0.1430+(kpm*124), screenW * 0.7556, screenH * 0.4367, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "center", false, false, false, true, false) dxDrawText(v, screenW * 0.3729, screenH * 0.3050+(kpm*62), screenW * 0.7556, screenH * 0.4733, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, true, true, false, false) for k,v in ipairs(fogadottpmek) do kpm = kpm + 1 dxDrawRectangle(screenW * 0.3722, screenH * 0.2775+(kpm*62), screenW * 0.3833, screenH * 0.0633, tocolor(255, 255, 254, 162), false) dxDrawText(getElementData(localPlayer,"name")..":", screenW * 0.3729, screenH * 0.1430+(kpm*124), screenW * 0.7556, screenH * 0.4367, tocolor(110, 110,111, 200), 1.00, "default-bold", "left", "center", false, false, false, true, false) dxDrawText(v, screenW * 0.3729, screenH * 0.3050+(kpm*62), screenW * 0.7556, screenH * 0.4733, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, true, true, false, false) end end end ) function onClientClick(button, state) local elem = 0 if button == "left" and state == "down" then for k, v in ipairs(players) do local plname = getPlayerName(v) elem = elem+1 if isInBox(screenW * 0.1764, screenH * 0.2850+(elem*35), screenW * 0.1889, screenH * 0.0367) then if plname == getPlayerName(localPlayer) then return end setElementData(localPlayer,"name",plname) kuldottpmek = {} fogadottpmek = {} end end end end addEventHandler("onClientClick", root, onClientClick) function isInBox(xS,yS,wS,hS) if(isCursorShowing()) then local cursorX, cursorY = getCursorPosition() cursorX, cursorY = cursorX*sX, cursorY*sY if(cursorX >= xS and cursorX <= xS+wS and cursorY >= yS and cursorY <= yS+hS) then return true else return false end end end function trig1() if getElementData(localPlayer,"name") == nil then return end local nev =getElementData(localPlayer,"name") or "" local targetPlayer = getPlayerFromName ( nev ) if targetPlayer then local uzenet = guiGetText(GUIEditor.edit[1]) table.insert(kuldottpmek,uzenet) end end addEvent("uzenet",true) addEventHandler("uzenet",root,trig1) function trig2() if getElementData(localPlayer,"name") == nil then return end local nev =getElementData(localPlayer,"name") or "" local targetPlayer = getPlayerFromName ( nev ) if targetPlayer then local uzenet = guiGetText(GUIEditor.edit[1]) table.insert(fogadottpmek,uzenet) end end addEvent("uzenet2",true) addEventHandler("uzenet2",root,trig2) function test() if getElementData(localPlayer,"name") == nil then return end local uzenet = guiGetText(GUIEditor.edit[1]) triggerServerEvent("pmuzenet",localPlayer,getLocalPlayer(),uzenet) end addEventHandler("onClientGUIClick",GUIEditor.button[1],test,false) Server.lua: function privateMessage(thePlayer) local sendToName = getElementData(thePlayer,"name") local toPlayer = getPlayerFromParticalName (sendToName) triggerClientEvent(thePlayer,"uzenet",toPlayer) triggerClientEvent(toPlayer,"uzenet2",thePlayer) setElementData(toPlayer,"fogadott",true) setElementData(thePlayer,"fogadott",false) end addEvent("pmuzenet",true) addEventHandler("pmuzenet",root,privateMessage) function getPlayerFromParticalName(thePlayerName) local thePlayer = getPlayerFromName(thePlayerName) if thePlayer then return thePlayer end for _,thePlayer in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then return thePlayer end end return false end
  19. I want create a dx private message system, like the fb messenger.. But how to make it possible? Or where can i download a script like this? sorry for my bad english..
  20. DeadthStrock

    Immortal Peds 0_0

    Hello ! I have a probblem. Everytime when I creating a ped in the server using 'createPed' function, the ped that creating can't be killed [ immortal ]. I don't like that way. The ped should be able to killed. Did you know to fix this ? createPed(0, 0, 0, 5)
  21. Hello my friends ! I just trying to move an object away when someone fire on it. I created below client and server side codes. Client Side :- addEventHandler("onClientPlayerWeaponFire",root, function (_,_,_,_,_,_,h) if h and getElementType(h) == "vehicle" then triggerServerEvent("onFired",resourceRoot,h) end end ) Server Side :- addEvent("onFired",true) addEventHandler("onFired",root, function (h) setElementVelocity(h,0.1,0.1,0.1) end ) But the problem in here is, when fire in different directions, the velocity / force acted on the vehicle in same direction. Can you please help me to change the force direction of the vehicle according to the fire direction ? I thing maths should be applied in here [ may not :p ]. However, I'm really newbie in some of lua maths. [ math.sine, math.cos, math.tan, math.#%$...BLA.. BLA..]. So, at least little help will very useful !!
  22. local redcircle = dxCreateTexture("teszt.png") addEventHandler("onClientRender", root, function() dxDrawMaterialLine3D(-1989.73804, 214.91431, 50,-1989.73804, 214.91431,43.1096496582031, redcircle, 6, tocolor(255,255,255),0,5,6) end) I change numbers, but i cannot rotate the image... how to rotate the image? sorry for my bad english..
  23. Boa tarde pessoal! Tudo certo? Então eu comecei a desenvolver uns trabalhos pra MTA, porém to enfrentando alguns problemas quando eu rodo eles em um servidor com mais de um jogador, por exemplo esse trabalho de carregador que eu estou desenvolvendo ainda, ele consiste em pegar a carga e levar para a balsa e dai em diante fazer a entrega do mesmo, mas na parte de fazer a entrega ainda não fiz, meu problema é o seguinte, quando o jogador pega a carga, é criado um marker aonde ele tem que levar a carga para ela aprecer em cima da balsa certo? Ok até aí beleza, o problema é se eu pegar a carga e outro player ir no mesmo lugar do marker que faz a carga ir para a balsa, ele ativa e a minha carga que eu ia levar some e aparece la sem eu ter ativado o marker, então meu problema é esse o script ele ta entendo como todos os players fossem um só (cada player que começa a trabalhar seja diferente que o outro), eu queria saber como eu faço pra bloquear isso abaixo está o código: server-side mCarregamento = createMarker(-2253.13, 2387.62, 3.95, "cylinder", 2, 255, 0, 0, 255, getRootElement()) balsa = createVehicle (454, -2224.43, 2432.65, 2.14, 0, 0, 45) function criarObjeto(thePlayer) if getPedOccupiedVehicle(thePlayer) then return end if thePlayer and isElement(thePlayer) and getElementType(thePlayer) == "player" then if source == mCarregamento then obj1 = createObject(964, -2260.14, 2382.28, 3.90, 0, 0, 0, true) setObjectScale (obj1, 0.5) ox, oy, oz = getElementPosition(obj1) mObjeto = createMarker(ox, oy, oz, "cylinder", 2.5, 255, 0, 0, 255, thePlayer) addEventHandler("onMarkerHit", mObjeto, carregarObjeto) end end end addEventHandler("onMarkerHit", mCarregamento, criarObjeto) function carregarObjeto(thePlayer) if getPedOccupiedVehicle(thePlayer) then return end if thePlayer and isElement(thePlayer) and getElementType(thePlayer) == "player" then if source == mObjeto then setPedAnimation( thePlayer, "CARRY", "liftup", 1.0, false ) setTimer(function() setPedAnimation( thePlayer, nil ) setPedAnimation( thePlayer, "CARRY", "crry_prtial", 4.1, true, true, true ) attachElementToElement(obj1, thePlayer, 0, 0.5, 0.3) toggleControl( thePlayer, "jump", false ) toggleControl( thePlayer, "fire", false ) destroyElement(mObjeto) mEntrega = createMarker(-2230.40, 2438.80, 1.49, "cylinder", 2, 255, 0, 0, 255, thePlayer) mEntrega2 = createMarker(-2230.40, 2438.80, 1.49, "cylinder", 2, 255, 0, 0, 0, thePlayer) bEntrega = createBlipAttachedTo(mEntrega, 0, 2, 255, 0, 0, 255, 0, 999, thePlayer) addEventHandler("onMarkerHit", mEntrega, entregarObjeto) end, 1000, 1) end end end function entregarObjeto(thePlayer) if getPedOccupiedVehicle(thePlayer) then return end if thePlayer and isElement(thePlayer) and getElementType(thePlayer) == "player" then if source == mEntrega then setPedAnimation( thePlayer, "CARRY", "liftup", 1.0, false ) setTimer(function () setPedAnimation( thePlayer, "CARRY", "crry_prtial", 4.1, true, true, true ) toggleControl( thePlayer, "jump", true ) toggleControl( thePlayer, "fire", true ) destroyElement(mEntrega) destroyElement(bEntrega) end, 1000, 1) addEventHandler("onMarkerHit", mEntrega2, carregarBalsa) destroyElement(mEntrega2) end end end function carregarBalsa(thePlayer) if getPedOccupiedVehicle(thePlayer) then return end if thePlayer and isElement(thePlayer) and getElementType(thePlayer) == "player" then if source == mEntrega then attachElementToElement(obj1, balsa, 0, 0, 0.3) createBlipAttachedTo(obj1, 0, 2, 255, 0, 0, 255, 0, 999, thePlayer) end end end E outra coisa se for possível, eu quero criar algo que tenha varias caixas para varias coordenadas por exemplo, quero que cada caixa que criar o jogador entregasse e ela ficasse em outra coordenada dentro da balsa. Eu teria que usar a condição FOR mas eu não entendo como ela funciona, se poder me ajudar fico muito grato pelo meu aprendizado. Obs( o barco que estou utilizando está com textura modificada ).