Monsthers Posted November 25, 2015 Share Posted November 25, 2015 Hola e visto un script en el forum scripter del lado de english y lo e utilizado es libre de derechos solo que no borren los derechos de autor! pues vale ese no es el caso, Lo e utilizado y funciona perfecto pero al agregar 2 autos no me deja entrar en otros autos. Primero vean el codigo vehicle1 = createVehicle( 416, 2031.5, -1431.7, 17.3, 0, 0, 359.996 ) -- This car is spawn in hospital ls vehicle2 = createVehicle( 416, 2014.5, -1417.1, 17.3, 0, 0, 262 ) -- This car is spawn in hospital ls vehicle3 = createVehicle( 416, 1182.6, -1338.3, 13.9, 0, 4, 272 ) -- This car is spawn in hospital ls vehicle4 = createVehicle( 416, 1182, -1308.6, 13.9, 0, 3.999, 272 ) -- This car is spawn in hospital ls vehicle = createVehicle( modelID, x, y, z, rotX, rotY, rotZ ) state = setVehicleDoorState ( vehicle, 1, 1 ) function lockPrivate( player, seat, jacked ) if ( source == vehicle1 and vehicle2 or vehicle3 and vehicle4 ) then local playerTeam = getPlayerTeam ( player ) local oldTeamName = getTeamName ( playerTeam ) if ( oldTeamName ~= "Emergency" ) then cancelEvent() exports.SAcommands:sendMessage("*INFO* To use this vehicle, you need to be be spawn as the following: Emergency", 240,240,240) else exports.SAcommands:sendMessage("*INFO* Welcome to your vehicle,Sir!", 240,240,240) end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), lockPrivate ) setVehicleDamageProof(vehicle, true) -----car won't take damage (change it to false if you want to take damage) -----Made by Alen141(ingame name:Jimboy)------ -----Special thanks to : Solidsnake14(ingame name:Castillo)----- -----Visit SAUR Utopia RPG, IP: 128.204.203.103:22003----- -----Feel free to edit script on your own----- -----Don't remove credits----- Asi lo quiero yo que tenga para 4 Vehiculos que son 4 ambulancia que estan spawneada en los 2 hospitales 2 en cada hospital! Si pongo una y no estoy en el team "Emergency" sale el mensaje de que no puede subir y aki el error con 1 solo createvehicle añadido puedo entrar a todos los autos que no sean ambulancia y no sale el mensaje de que no puedo subir! y al agregar 2 createvehicle no me deja entrar a ningun vehiculo si no soy "Emergency" Es decir que al agregar 2 createvehicle ese script utiliza como si todos los autos de gta son solo para el team emergency y asi no lo quiero tambien agregare patrullas pero sera en otro script y no quisiera que pasara lo mismo Aqui el script original vehicle1 = createVehicle( 416, 2031.5, -1431.7, 17.3, 0, 0, 359.996 ) -- This car is spawn in hospital ls vehicle = createVehicle( modelID, x, y, z, rotX, rotY, rotZ ) state = setVehicleDoorState ( vehicle, 1, 1 ) function lockPrivate( player, seat, jacked ) if ( source == vehicle1 ) then local playerTeam = getPlayerTeam ( player ) local oldTeamName = getTeamName ( playerTeam ) if ( oldTeamName ~= "Emergency" ) then cancelEvent() exports.SAcommands:sendMessage("*INFO* To use this vehicle, you need to be be spawn as the following: Emergency", 240,240,240) else exports.SAcommands:sendMessage("*INFO* Welcome to your vehicle,Sir!", 240,240,240) end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), lockPrivate ) setVehicleDamageProof(vehicle, true) -----car won't take damage (change it to false if you want to take damage) -----Made by Alen141(ingame name:Jimboy)------ -----Special thanks to : Solidsnake14(ingame name:Castillo)----- -----Visit SAUR Utopia RPG, IP: 128.204.203.103:22003----- -----Feel free to edit script on your own----- -----Don't remove credits----- Asi mas o menos vino, claro sin el exports a SAcommands ese es otro script, VALE Porfavor si pudieran postear el codigo arreglado ya que es un script muy comun y no se consegue asi otro entra como yo agarre este script en la comunidad english puede que un latino tambien lo use! Link to comment
aka Blue Posted November 25, 2015 Share Posted November 25, 2015 ¿Por qué no usas tablas? Para scripts como esos lo mejor es utilizar tablas. Aquí te hice un pequeño script. No sé si funciona, pruébalo y dime. local ambulancias = { { id, posx, posy, posz, color1, color2, color3, matricula } } function createVehicles ( ) for _, vehicles in ipairs ( ambulancias ) do local ID = vehicles [1] local posx, posy, posz = vehicles [2], vehicles [3], vehicles [4] local color1, color2, color3 = vehicles [5], vehicles [6], vehicles [7] local matricula = vehicles [8] if id and posx and posy and posz and color1 and color2 and matricula then vehiculo = createVehicle ( id, posx, posy, posz, matricula ) setVehicleColor ( vehiculo, color1, color2, color3 ) else outputDebugString ( "[iNFO]: No has colocado bien los argumentos en la tabla de ambulancias" ) end end end addEventHandler ( "onVehicleEnter", getRootElement ( ), function ( player ) if getElementModel ( source ) == vehiculo then if isPlayerInTeam ( player, "Medico" ) then outputChatBox ( "Bienvenido de nuevo "..player..". Que tenga un buen patrullaje.", player, 0, 255, 120 ) else cancelEvent ( ) outputChatBox ( "No eres médico.", player, 255, 0, 0 ) end end end ) Link to comment
Tomas Posted November 26, 2015 Share Posted November 26, 2015 ¿Por qué no usas tablas? Para scripts como esos lo mejor es utilizar tablas. Aquí te hice un pequeño script. No sé si funciona, pruébalo y dime. local ambulancias = { { id, posx, posy, posz, color1, color2, color3, matricula } } function createVehicles ( ) for _, vehicles in ipairs ( ambulancias ) do local ID = vehicles [1] local posx, posy, posz = vehicles [2], vehicles [3], vehicles [4] local color1, color2, color3 = vehicles [5], vehicles [6], vehicles [7] local matricula = vehicles [8] if id and posx and posy and posz and color1 and color2 and matricula then vehiculo = createVehicle ( id, posx, posy, posz, matricula ) setVehicleColor ( vehiculo, color1, color2, color3 ) else outputDebugString ( "[iNFO]: No has colocado bien los argumentos en la tabla de ambulancias" ) end end end addEventHandler ( "onVehicleEnter", getRootElement ( ), function ( player ) if getElementModel ( source ) == vehiculo then if isPlayerInTeam ( player, "Medico" ) then outputChatBox ( "Bienvenido de nuevo "..player..". Que tenga un buen patrullaje.", player, 0, 255, 120 ) else cancelEvent ( ) outputChatBox ( "No eres médico.", player, 255, 0, 0 ) end end end ) Hay un error aquí outputChatBox ( "Bienvenido de nuevo "..player..". Que tenga un buen patrullaje.", player, 0, 255, 120 ) Link to comment
Recommended Posts