Jump to content

JR10

Retired Staff
  • Posts

    2,947
  • Joined

  • Last visited

Everything posted by JR10

  1. JR10

    MTA:SA 1.2 Released!

    Like anyone here care? I can see servers in the browser and my server is just fine. Buggy depends on your scripts and your host, so don't whine about it. Have you ever played on SA-MP? Good luck.
  2. Debug script must say something, like resource is not running..
  3. You better take some Lua tutorial, the comment in Lua is --. function playerChat(message) exports.textspeech:speak( message, "en" ) --Here little edit, error in pasting outputChatBox ( "Message:" ..message.. "." ) end addEventHandler( "onPlayerChat", root,playerChat ) If it's TextSpeech you need to edit the exports line, and change textspeech to TextSpeech.
  4. Just edit the script manually? Or use guiSetText
  5. Like: addCommandHandler ( "vote" , function ( player , cmd , firstArgument ) --Read about addCommandHandler local pollDidStart = exports.votemanager:startPoll { title=firstArgument, percentage=65, timeout=10, allowchange=true, visibleTo=getRootElement(), [1]={'Answer 1'}, [2]={'Answer 2'} } end)
  6. There is no way to get the alpha of a dx text. You need to have variable, which you will use in dxDrawText as the alpha argument.
  7. This is messed up, why are you trying to get near peds, and you have an id argument. Don't you want to bury the ped with the specified id? If so..try this: function buryPeds(player, cmd, id) if hasObjectPermissionTo(player, "command.ban") then if not id then return outputChatBox("Wrong ID specified",player) end local xml = xmlLoadFile("peds.map") for index,node in ipairs(xmlNodeGetChildren(xml)) do if xmlNodeGetAttribute(node, "id") == id then xmlNodeSetName(node, "buried") xmlNodeSetAttribute(node, "buriedBy", getPlayerName(player)) xmlSaveFile(xml) xmlUnloadFile(xml) outputChatBox("Body with ID: " .. id .. " buried successfully.", player, 255, 255, 255, false) for index , ped in ipairs ( getElementsByType ( "ped" , resourceRoot ) ) do if getElementData ( ped , "id" ) == id or getElementID ( ped ) == id then destroyElement(ped) break end end break end end end end addCommandHandler("bury", buryPeds)
  8. gateCol = createColCircle(272.1728515625, 183.5166015625, 1009.171875, 10) setElementInterior(gateCol, 3) gate = createObject(974, 277.03125, 189.408203125, 1007.171875) setElementInterior(gate, 3) addEventHandler("onColShapeHit",gateCol, function (hitElement) moveObject(gate, 280.03125, 189.408203125, 1007.171875) end) 'hitElement' was used in moveObject instead of 'gate'.
  9. Write down your favourite object's id...
  10. JR10

    [WIP] wBot

    Good luck with it.
  11. Looks good, nice work.
  12. Then open the script where the GUI are created, and edit it. Else you need to use guiSetText properly, and several times to accomplish full change.
  13. This doesn't make any sense. You need to set every text in the freeroam to arabic when he clicks on the button.
  14. Was it creating the table with dbQuery? addEventHandler( "onResourceStart", resourceRoot, function( ) local key = dbConnect( "sqlite", "Storedinfo.db" ) dbFree(dbQuery( key, "CREATE TABLE IF NOT EXISTS teleports ( teleportID INT, aX FLOAT, aY FLOAT,aZ FLOAT, aInterior INT, aDimension INT, bX FLOAT, bY FLOAT, bZ FLOAT,bInterior INT, bDimension INT )" ) local result = dbPoll ( dbQuery( key, "SELECT * FROM teleports" ),-1 ) end )
  15. local theTeam = createTeam ( 'Players' ) function assignNewTeam ( ) if theTeam then setPlayerTeam (source, theTeam ) end end addEventHandler ( "onPlayerJoin", getRootElement(), assignNewTeam )
  16. addEventHandler( "onResourceStart", resourceRoot, function( ) local key = dbConnect( "sqlite", "Storedinfo.db" ) dbExec( key, "CREATE TABLE IF NOT EXISTS teleports ( teleportID INT, aX FLOAT, aY FLOAT,aZ FLOAT, aInterior INT, aDimension INT, bX FLOAT, bY FLOAT, bZ FLOAT,bInterior INT, bDimension INT )" ) local result = dbPoll ( dbQuery( key, "SELECT * FROM teleports" ),-1 ) end ) --for key, value in ipairs( result ) do -- dbQuery( value,"(teleportID, value.aX, value.aY, value.aZ, value.aInterior, value.aDimension, value.bX, value.bY, value.bZ, value.bInterior, value.bDimension)" ) local p = { } addEventHandler( "onPlayerQuit", root, function( ) p[ source ] = nil end ) addCommandHandler( "marktele", function( player ) -- this command only makes sense if used with /createteleport if hasObjectPermissionTo( player, "command.createteleport", false ) then -- get all properties we need local x, y, z = getElementPosition( player ) x = math.ceil( x * 100 ) / 100 y = math.ceil( y * 100 ) / 100 z = math.ceil( z * 100 ) / 100 local interior = getElementInterior( player ) local dimension = getElementDimension( player ) -- save them if not p[ player ] then p[ player ] = { } end p[ player ].mark = { x = x, y = y, z = z, interior = interior, dimension = dimension } -- outputChatBox( "Marked teleport position. [" .. table.concat( { "x=" .. x, "y=" .. y, "z=" .. z, "i=" .. interior, "d=" .. dimension }, ", " ) .. "]", player, 0, 255, 153 ) end end ) addCommandHandler( "createtele", function( player, commandName ) local a = p[ player ] and p[ player ].mark if a then local x, y, z = getElementPosition( player ) x = math.ceil( x * 100 ) / 100 y = math.ceil( y * 100 ) / 100 z = math.ceil( z * 100 ) / 100 local interior = getElementInterior( player ) local dimension = getElementDimension( player ) dbExec(key, "INSERT INTO teleports (`aX`, `aY`, `aZ`, `aInterior`, `aDimension`, `bX`, `bY`, `bZ`, `bInterior`, `bDimension`) VALUES (" .. table.concat( { a.x, a.y, a.z, a.interior, a.dimension, x, y, z, interior, dimension }, ", " ) .. ")" ) if insertid then loadTeleport( insertid, a.x, a.y, a.z, a.interior, a.dimension, x, y, z, interior, dimension) outputChatBox( "Teleport created. (ID " .. insertid .. ")", player, 0, 255, 0 ) -- delete the marked position p[ player ].mark = nil else outputChatBox( "SQL-Query failed.", player, 255, 0, 0 ) end else outputChatBox( "You need to set the opposite spot with /markteleport first.", player, 255, 0, 0 ) end end, true ) addCommandHandler( { "deleteteleport", "delteleport" }, function( player, commandName, teleportID ) teleportID = tonumber( teleportID ) if teleportID then local teleport = teleports[ teleportID ] if teleport then if dbExec ("DELETE FROM teleports WHERE teleportID = '" .. teleportID.."'" ) then outputChatBox( "You deleted teleport " .. teleportID .. ".", player, 0, 255, 153 ) -- delete the markers colspheres[ teleport.a ] = nil destroyElement( teleport.a ) colspheres[ teleport.b ] = nil destroyElement( teleport.b ) else outputChatBox( "DB-Query failed.", player, 255, 0, 0 ) end else outputChatBox( "Teleport not found.", player, 255, 0, 0 ) end else outputChatBox( "Syntax: /" .. commandName .. " [id]", player, 255, 255, 255 ) end end, true ) addCommandHandler( "nearbyteleports", function( player, commandName ) if hasObjectPermissionTo( player, "command.createteleport", false ) or hasObjectPermissionTo( player, "command.deleteteleport", false ) then local x, y, z = getElementPosition( player ) local dimension = getElementDimension( player ) local interior = getElementInterior( player ) outputChatBox( "Nearby Teleports:", player, 255, 255, 0 ) for key, value in pairs( colspheres ) do if getElementDimension( key ) == dimension and getElementInterior( key ) == interior then local distance = getDistanceBetweenPoints3D( x, y, z, getElementPosition( key ) ) if distance < 20 then outputChatBox( " Teleport " .. value.id .. ".", player, 255, 255, 0 ) end end end end end ) -- local function useTeleport( player, key, state, colShape ) local data = colspheres[ colShape ] if data then local other = data.other if other then triggerEvent( "onColShapeLeave", colShape, player, true ) -- teleport the player setElementDimension( player, getElementDimension( other ) ) setElementInterior( player, getElementInterior( other ) ) setCameraInterior( player, getElementInterior( other ) ) setElementPosition( player, getElementPosition( other ) ) setCameraTarget( player, player ) triggerEvent( "onColShapeHit", other, player, true ) end end end addEventHandler( "onColShapeHit", resourceRoot, function( element, matching ) if matching and getElementType( element ) == "player" then if not p[ element ] then p[ element ] = { } elseif p[ element ].tp then unbindKey( element, "enter_exit", "down", useTeleport, p[ element ].tp ) end p[ element ].tp = source bindKey( element, "enter_exit", "down", useTeleport, p[ element ].tp ) setElementData( element, "interiorMarker", true, false ) end end ) addEventHandler( "onColShapeLeave", resourceRoot, function( element, matching ) if getElementType( element ) == "player" and p[ element ].tp then unbindKey( element, "enter_exit", "down", useTeleport, p[ element ].tp ) removeElementData( element, "interiorMarker", true, false ) p[ element ].tp = nil end end )
  17. Night, post the code, I lost track of what you're trying to do.
  18. Night, which code exactly?
  19. You can just use dbExec instead of dbFree ( dbQuery. Kenix, I've tested it before, field types are optional.
  20. Oh lol, sorry. You're welcome.
  21. Kenix, you don't have to specify the types. function( ) local key = dbConnect( "sqlite", "Storedinfo.db" ) dbExec ( key, "CREATE TABLE IF NOT EXISTS teleports ( teleportID, aX, aY, aZ, aInterior, aDimension, bX, bY, bZ,bInterior, bDimension )")) local result = dbPoll(dbQuery(key, "SELECT * FROM teleports" ),-1)
  22. function joinHandler ( ) --spawnPlayer (source, -1969.2669677734, 137.71185302734, 30, 0, skin, 0) spawnPlayer (source, -1969.2669677734, 137.71185302734, 30, 0, 0, 0) fadeCamera (source, true) setCameraTarget ( source, source ) end addEventHandler ( "onPlayerJoin" , getRootElement ( ) , joinHandler ) function spawnWasted(player, skin) repeat until spawnPlayer ( player, -2655.02, 625.30, 14.45, 180, skin, 0) fadeCamera(player, true) setCameraTarget(player, player) end addEventHandler("onPlayerWasted", root, function() setTimer(spawnWasted, 1800, 1, source, getElementModel(source)) end ) function greetPlayer ( ) outputChatBox ( "Witaj na Polskim Serwerze Zabawy stworzonym przez Mefisto_PL !" , source, 0, 159, 255 ) end addEventHandler ( "onPlayerLogin", getRootElement(), greetPlayer ) function onPlayerQuit() local playerAccount = getPlayerAccount(source) if (playerAccount) and not isGuestAccount(playerAccount) then local playerMoney = getPlayerMoney(source) local playerSkin = getElementModel(source) setAccountData(playerAccount, "money", playerMoney) setAccountData(playerAccount, "skin", playerSkin) end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuit) function onPlayerLogin() local playerAccount = getPlayerAccount(source) if (playerAccount) and not isGuestAccount(playerAccount) then local playerMoney = tonumber(getAccountData(playerAccount, "money")) local playerSkin = tonumber(getAccountData(playerAccount, "skin")) if (playerMoney and playerSkin) then setPlayerMoney(source, playerMoney) setElementModel(source, playerSkin) end end end addEventHandler("onPlayerLogin", getRootElement(), onPlayerLogin) I added isGuestAccount check to onPlayerLogin. I can't find any difference between Castillo's and mine, I took yours anyway.
×
×
  • Create New...