depato123 Posted May 31, 2013 Share Posted May 31, 2013 (edited) Encontré otro que también es de "paradise". Es un sistema de vehículos o algo así, quería saber como puedo remover el link con sql y extraerle solo el sistema de combustible e indicadores de nafta y velocidad http://www.mediafire.com/download/3cqhn ... hicles.zip ¿alguien sabe?, la verdad no tengo idea de como es ese sistema 1: --[[ Copyright (c) 2010 MTA: Paradise This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . ]] local engineState = nil local localPlayer = getLocalPlayer( ) addEventHandler( "onClientVehicleStartEnter", resourceRoot, function( player, seat ) -- save the state for when we're done entering, as GTA automatically turns the engines on if seat == 0 and player == localPlayer then engineState = { vehicle = source, state = getVehicleEngineState( source ) } else engineState = nil end end ) addEventHandler( "onClientVehicleEnter", resourceRoot, function( player, seat ) -- restore the engine state if engineState then if seat == 0 and player == localPlayer and engineState.vehicle == source then setVehicleEngineState( source, engineState.state ) end engineState = nil end end ) 2: --[[ Copyright (c) 2010 MTA: Paradise This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . ]] local vehiclesIgnoringLocked = { [448] = true, [461] = true, [462] = true, [463] = true, [481] = true, [509] = true, [510] = true, [521] = true, [522] = true, [581] = true, [586] = true, -- bikes [430] = true, [446] = true, [452] = true, [453] = true, [454] = true, [472] = true, [473] = true, [484] = true, [493] = true, [595] = true, -- boats [424] = true, [457] = true, [471] = true, [539] = true, [568] = true, [571] = true -- recreational vehicles } -- local addCommandHandler_ = addCommandHandler addCommandHandler = function( commandName, fn, restricted, caseSensitive ) -- add the default command handlers if type( commandName ) ~= "table" then commandName = { commandName } end for key, value in ipairs( commandName ) do if key == 1 then addCommandHandler_( value, fn, restricted, caseSensitive ) else addCommandHandler_( value, function( player, ... ) -- check if he has permissions to execute the command, default is not restricted (aka if the command is restricted - will default to no permission; otherwise okay) if hasObjectPermissionTo( player, "command." .. commandName[ 1 ], not restricted ) then fn( player, ... ) end end ) end end -- check for alternative handlers, such as gotovehicle = gotoveh, gotocar for k, v in ipairs( commandName ) do if v:find( "vehicle" ) then for key, value in pairs( { "veh", "car" } ) do local newCommand = v:gsub( "vehicle", value ) if newCommand ~= v then -- add a second (replaced) command handler addCommandHandler_( newCommand, function( player, ... ) -- check if he has permissions to execute the command, default is not restricted (aka if the command is restricted - will default to no permission; otherwise okay) if hasObjectPermissionTo( player, "command." .. commandName[ 1 ], not restricted ) then fn( player, ... ) end end ) end end end end end -- local p = { } local getPedOccupiedVehicle_ = getPedOccupiedVehicle getPedOccupiedVehicle = function( ped ) local vehicle = isPedInVehicle( ped ) and getPedOccupiedVehicle_( ped ) if vehicle and ( p[ ped ] and p[ ped ].vehicle == vehicle or getElementParent( vehicle ) ~= getResourceDynamicElementRoot( resource ) ) then return vehicle end return false end local function isPedEnteringVehicle( ped ) return getPedOccupiedVehicle_( ped ) and not getPedOccupiedVehicle( ped ) end -- local vehicleIDs = { } local vehicles = { } addEventHandler( "onResourceStart", resourceRoot, function( ) -- Looking at it from a technical point of view, loading vehicles on a non-existant table makes only limited sense if not exports.sql:create_table( 'vehicles', { { name = 'vehicleID', type = 'int(10) unsigned', auto_increment = true, primary_key = true }, { name = 'model', type = 'int(10) unsigned' }, { name = 'posX', type = 'float' }, { name = 'posY', type = 'float' }, { name = 'posZ', type = 'float' }, { name = 'rotX', type = 'float' }, { name = 'rotY', type = 'float' }, { name = 'rotZ', type = 'float' }, { name = 'interior', type = 'tinyint(3) unsigned', default = 0 }, { name = 'dimension', type = 'int(10) unsigned', default = 0 }, { name = 'respawnPosX', type = 'float' }, { name = 'respawnPosY', type = 'float' }, { name = 'respawnPosZ', type = 'float' }, { name = 'respawnRotX', type = 'float' }, { name = 'respawnRotY', type = 'float' }, { name = 'respawnRotZ', type = 'float' }, { name = 'respawnInterior', type = 'int(10) unsigned', default = 0 }, { name = 'respawnDimension', type = 'int(10) unsigned', default = 0 }, { name = 'numberplate', type = 'varchar(8)' }, { name = 'health', type = 'int(10) unsigned', default = 1000 }, { name = 'color1', type = 'tinyint(3) unsigned', default = 0 }, { name = 'color2', type = 'tinyint(3) unsigned', default = 0 }, { name = 'characterID', type = 'int(11)', default = 0 }, { name = 'locked', type = 'tinyint(3) unsigned', default = 0 }, { name = 'engineState', type = 'tinyint(3) unsigned', default = 0 }, { name = 'lightsState', type = 'tinyint(3) unsigned', default = 0 }, { name = 'tintedWindows', type = 'tinyint(3) unsigned', default = 0 }, { name = 'fuel', type = 'float unsigned', default = 100 }, } ) then cancelEvent( ) return end -- load all vehicles local result = exports.sql:query_assoc( "SELECT * FROM vehicles ORDER BY vehicleID ASC" ) if result then for key, data in ipairs( result ) do local vehicle = createVehicle( data.model, data.posX, data.posY, data.posZ, data.rotX, data.rotY, data.rotZ, numberplate ) -- tables for ID -> vehicle and vehicle -> data vehicleIDs[ data.vehicleID ] = vehicle vehicles[ vehicle ] = { vehicleID = data.vehicleID, respawnInterior = data.respawnInterior, respawnDimension = data.respawnDimension, characterID = data.characterID, engineState = not doesVehicleHaveEngine( vehicle ) or data.engineState == 1, tintedWindows = data.tintedWindows == 1, fuel = data.fuel } -- some properties setElementHealth( vehicle, data.health ) if data.health <= 300 then setVehicleDamageProof( vehicle, true ) vehicles[ vehicle ].engineState = false end setVehicleColor( vehicle, data.color1, data.color2, data.color1, data.color2 ) -- most vehicles don't use second/third color anyway setVehicleRespawnPosition( vehicle, data.respawnPosX, data.respawnPosY, data.respawnPosZ, data.respawnRotX, data.respawnRotY, data.respawnRotZ ) setElementInterior( vehicle, data.interior ) setElementDimension( vehicle, data.dimension ) setVehicleLocked( vehicle, data.locked == 1 ) setVehicleEngineState( vehicle, data.engineState == 1 ) setVehicleOverrideLights( vehicle, data.lightsState + 1 ) setElementData( vehicle, "fuel", data.fuel ) end end -- bind a key for everyone for key, value in ipairs( getElementsByType( "player" ) ) do bindKey( value, "k", "down", "lockvehicle" ) bindKey( value, "j", "down", "toggleengine" ) bindKey( value, "l", "down", "togglelights" ) end -- -- Fuel update setTimer( function( ) for vehicle, data in pairs( vehicles ) do if not isElement( vehicle ) or getElementType( vehicle ) ~= "vehicle" then vehicles[ vehicle ] = nil elseif data.engineState and data.fuel and not isVehicleEmpty( vehicle ) and doesVehicleHaveEngine( vehicle ) and doesVehicleHaveFuel( vehicle ) then local vx, vy, vz = getElementVelocity( vehicle ) local speed = math.sqrt( vx * vx + vy * vy ) local loss = ( speed > 0.65 and 2 * speed or speed ) * 0.1 + 0.005 data.fuel = math.max( data.fuel - loss, 0 ) if math.floor( data.fuel + 0.5 ) ~= getElementData( vehicle, "fuel" ) then setElementData( vehicle, "fuel", math.floor( data.fuel + 0.5 ) ) end if data.fuel == 0 then setVehicleEngineState( vehicle, false ) for seat = 0, getVehicleMaxPassengers( vehicle ) do local player = getVehicleOccupant( vehicle, seat ) if player then triggerClientEvent( player, "gui:hint", player, "Out of Fuel", "Your " .. getVehicleName( vehicle ) .. " ran out of fuel!\nTo prevent this from happening, refill it regulary.", 3 ) end end end end end end, 2000, 0 ) end ) addCommandHandler( { "createvehicle", "makevehicle" }, function( player, commandName, ... ) model = table.concat( { ... }, " " ) model = getVehicleModelFromName( model ) or tonumber( model ) if model then local x, y, z, rz = getPositionInFrontOf( player ) local vehicle = createVehicle( model, x, y, z, 0, 0, rz ) if vehicle then local color1, color2 = getVehicleColor( vehicle ) local vehicleID, error = exports.sql:query_insertid( "INSERT INTO vehicles (model, posX, posY, posZ, rotX, rotY, rotZ, numberplate, color1, color2, respawnPosX, respawnPosY, respawnPosZ, respawnRotX, respawnRotY, respawnRotZ, interior, dimension, respawnInterior, respawnDimension) VALUES (" .. table.concat( { model, x, y, z, 0, 0, rz, '"%s"', color1, color2, x, y, z, 0, 0, rz, getElementInterior( player ), getElementDimension( player ), getElementInterior( player ), getElementDimension( player ) }, ", " ) .. ")", getVehiclePlateText( vehicle ) ) if vehicleID then -- tables for ID -> vehicle and vehicle -> data vehicleIDs[ vehicleID ] = vehicle vehicles[ vehicle ] = { vehicleID = vehicleID, respawnInterior = getElementInterior( player ), respawnDimension = getElementDimension( player ), characterID = 0, engineState = false, tintedWindows = false, fuel = 100 } -- some properties setElementInterior( vehicle, getElementInterior( player ) ) setElementDimension( vehicle, getElementDimension( player ) ) setVehicleEngineState( vehicle, false ) setVehicleOverrideLights( vehicle, 1 ) setElementData( vehicle, "fuel", 100 ) -- success message outputChatBox( "Created " .. getVehicleName( vehicle ) .. " (ID " .. vehicleID .. ")", player, 0, 255, 0 ) else destroyElement( vehicle ) outputChatBox( "MySQL-Query failed.", player, 255, 0, 0 ) end else outputChatBox( "Invalid Vehicle Model.", player, 255, 0, 0 ) end else outputChatBox( "Syntax: /" .. commandName .. " [model]", player, 255, 255, 255 ) end end, true ) function create( player, vehicle ) if isElement( player ) and isElement( vehicle ) then local characterID = exports.players:getCharacterID( player ) if characterID then local model = getElementModel( vehicle ) local x, y, z = getElementPosition( vehicle ) local rx, ry, rz = getVehicleRotation( vehicle ) local interior = getElementInterior( vehicle ) local dimension = getElementDimension( vehicle ) local color1, color2 = getVehicleColor( vehicle ) local vehicleID, error = exports.sql:query_insertid( "INSERT INTO vehicles (model, posX, posY, posZ, rotX, rotY, rotZ, numberplate, color1, color2, respawnPosX, respawnPosY, respawnPosZ, respawnRotX, respawnRotY, respawnRotZ, interior, dimension, respawnInterior, respawnDimension, characterID) VALUES (" .. table.concat( { model, x, y, z, rx, ry, rz, '"%s"', color1, color2, x, y, z, rx, ry, rz, interior, dimension, interior, dimension, characterID }, ", " ) .. ")", getVehiclePlateText( vehicle ) ) if vehicleID then local newVehicle = createVehicle( model, x, y, z, rx, ry, rz, getVehiclePlateText( vehicle ) ) -- tables for ID -> vehicle and vehicle -> data vehicleIDs[ vehicleID ] = newVehicle vehicles Edited June 2, 2013 by Guest Link to comment
NodZen Posted May 31, 2013 Share Posted May 31, 2013 Simplemente desactivalos del meta a los demas scripts y deja los que quieres. Link to comment
depato123 Posted June 2, 2013 Author Share Posted June 2, 2013 Simplemente desactivalos del meta a los demas scripts y deja los que quieres. Ya intente hacerlo, pero me deja de funcionar el resource Link to comment
PhantomDamn Posted June 2, 2013 Share Posted June 2, 2013 publica los scripts , no solo el link Link to comment
depato123 Posted June 8, 2013 Author Share Posted June 8, 2013 ¿nadie sabe como extraer el velocímetro y el sistema de gasolina¿ Link to comment
Recommended Posts