Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. That resource has exported functions, just use them in your script.
  2. You can use google translator, but most common voice is a woman voice. https://community.multitheftauto.com/index.php?p= ... ls&id=3035
  3. local uMyMarker = createMarker ( 1539.3, -1686.8, 13, 'cylinder', 2, 255, 225, 0, 150 ) addEvent ( 'vehicle', true ) addEventHandler ( 'vehicle', root, function ( model ) local uVehicle = createVehicle ( model, 1539.3, -1686.8, 13 ) setTimer( warpPedIntoVehicle, 1000, 1, source, uVehicle ) end ) addEventHandler ( 'onMarkerHit', root, function ( uPlayer ) if ( source == uMyMarker ) then triggerClientEvent ( uPlayer, 'openGUI', uPlayer ) end end )
  4. Post your client side script please.
  5. Oh, you mean to execute a function by voice command, that's not possible I'm afraid, you would have to convert the voice to a text, if I'm right, is not possible.
  6. What do you mean by "voice commands"? do you mean voice chat? if so, then there's a resource called "voice" which let's you chat with your microphone.
  7. Castillo

    Anti-Logout

    addEventHandler ( "onPlayerCommand", root, function ( cmd ) if ( cmd == "logout" ) then kickPlayer ( source, nil, "Este comando esta prohibido." ) cancelEvent ( ) end end )
  8. Castillo

    LUAmatic

    addEventHandler ( "onVehicleDamage", root, function ( loss ) local thePlayer = getVehicleOccupant ( source ) -- Obtenemos el conductor del vehiculo. if ( thePlayer ) then -- Si tiene un conductor. setElementHealth ( thePlayer, getElementHealth ( thePlayer ) - loss / 10 ) -- Dividimos la vida que el vehiculo perdio y se la quitamos al jugador. end end )
  9. @Renkon: El script es server side, osea la variable va a ser para todos los jugadores, no sirve tu idea. @Soren: Crea una tabla luego pones el marker dentro y el dueño del mismo, si existe al presionar la "L", lo destruyes, y si no, lo creas.
  10. Eso ya me di cuenta, la posicion esta mal. addEventHandler ( "onResourceStart", resourceRoot, function ( ) for index, player in ipairs ( getElementsByType ( "player" ) ) do bindKey ( player, "l", "down", linterna ) end end ) addEventHandler ( "onPlayerJoin", root, function ( ) bindKey ( source, "l", "down", linterna ) end ) function linterna ( thePlayer ) local x, y, z = getElementPosition ( thePlayer ) local luz = createMarker ( x, y, z, "corona", 5, 255, 255, 255, 150 ) attachElements ( luz, thePlayer, 0, 0, 0 ) end
  11. Your column name is "Avatar", but your element data is "avatar", lower case "a".
  12. addEventHandler ( "onResourceStart", resourceRoot, function ( ) for index, player in ipairs ( getElementsByType ( "player" ) ) do bindKey ( player, "l", "down", linterna ) end end ) addEventHandler ( "onPlayerJoin", root, function ( ) bindKey ( source, "l", "down", linterna ) end ) function linterna ( thePlayer ) local x, y, z = getElementPosition ( thePlayer ) local luz = createMarker ( x, y, z, "corona", 5, 255, 255, 255, 150 ) attachElements ( luz, thePlayer, x, y, z ) end
  13. Me explicas que es: "attachElemts"? talvez querias poner: attachElements. Ademas, si el script es server side, necesitas usar bindKey al entrar al servidor.
  14. La verdad no te entiendo, me pedis que te diga como crear un comando "/rpg" y ya lo hice.
  15. Pero si el script ese que te arregle es para eso..
  16. Decis entrar en el mismo servidor con el comando? queres que no se pueda hacer eso?
  17. Decis un comando para conectarte a la IP que el jugador pone? E.g: /unirse Si es asi, entonces hay un ejemplo aca: https://wiki.multitheftauto.com/wiki/RedirectPlayer
  18. function redirect ( thePlayer ) redirectPlayer ( thePlayer, "186.9.200.36", 22003 ) end addCommandHandler ( "RPG", redirect )
  19. I'm not going to argue with you, it would be a waste of time.
  20. This script should load data when the player joins and send it to the client side? if so, then you must use onClientResourceStart because onClientPlayerJoin is triggered for everyone but the player who joined.
  21. 1: I never called anyone "kid". 2: I'd, but I test many times the script before posting it here. 3: You'd, you can check your original code. 4: Is "onResourceStart", not "onClientResourceStart". If you don't use this, then you have to declare the functions before adding the events.
  22. local tVehicles = -- what draken was saying is, its alot easier to find and edit it now, the code looks more organized too. { [ 598 ] = true; [ 596 ] = true; [ 597 ] = true; [ 411 ] = true; [ 599 ] = true; } -- Simple Police-Lights by MuLTi! p_lights = {} p_timer = {} p_lvar = {} p_pvar = {} p_lvar2 = {} p_lvar3 = {} p_lvar4 = {} function toggleLights ( thePlayer, cmd, level ) local level = tonumber ( level ) if ( not level ) then outputChatBox ( "#FF0000 Please select a level![1-2]", thePlayer, 255, 255, 255, true ) return end if ( level < 1 ) or ( level > 2 ) then outputChatBox ( "#FF0000 Please select a level between 1-2!", thePlayer, 255, 255, 255, true ) return end local veh = getPedOccupiedVehicle ( thePlayer ) local id = getElementModel ( veh ) if ( tVehicles [ id ] ) then -- You we're using the vehicle element instead of the vehicle model. if ( level == 1 ) then if ( p_lights [ veh ] == 0) or ( p_lights [ veh ] == nil ) then p_pvar [ veh ] = 1 p_lights [ veh ] = 1 outputChatBox ( "#FFFFFFYour Police-lights has been #00FF00enabled.", thePlayer, 0, 200, 100, true ) setVehicleOverrideLights ( veh, 2 ) p_timer [ veh ] = setTimer ( function ( ) if ( p_lvar [ veh ] == 0) or ( p_lvar [ veh ] == nil ) then p_lvar [ veh ] = 1 setVehicleLightState ( veh, 1, 0 ) setVehicleLightState ( veh, 2, 0 ) setVehicleLightState ( veh, 0, 1 ) setVehicleLightState ( veh, 3, 1 ) setVehicleHeadLightColor ( veh, 0, 0, 255 ) else setVehicleLightState ( veh, 3, 0 ) setVehicleLightState ( veh, 0, 0 ) setVehicleLightState ( veh, 1, 1 ) setVehicleLightState ( veh, 2, 1 ) setVehicleHeadLightColor ( veh, 255, 0, 0 ) p_lvar [ veh ] = 0 end end , 500, 0 ) else p_lights [ veh ] = 0 outputChatBox ( "#FFFFFFYour Police-lights has been #00FF00disabled.", thePlayer, 0, 200, 100, true ) if ( isTimer ( p_timer [ veh ] ) ) then killTimer ( p_timer [ veh ] ) end setVehicleLightState ( veh, 0, 0 ) setVehicleLightState ( veh, 1, 0 ) setVehicleLightState ( veh, 2, 0 ) setVehicleLightState ( veh, 3, 0 ) setVehicleHeadLightColor ( veh, 255, 255, 255 ) setVehicleOverrideLights ( veh, 1 ) end elseif ( level == 2 ) then if ( p_lights [ veh ] == 0) or ( p_lights [ veh ] == nil ) then p_lights [ veh ] = 1 outputChatBox ( "#FFFFFFYour Police-lights has been #00FF00enabled.", thePlayer, 0, 200, 100, true ) setVehicleOverrideLights ( veh, 2 ) p_timer [ veh ] = setTimer ( function ( ) if ( p_lvar3 [ veh ] == 4 ) then setTimer ( function ( ) p_lvar3 [ veh ] = 0 end ,1000, 1 ) setTimer ( function ( ) if ( p_lvar4 [ veh ] == 1 ) then p_lvar4 [ veh ] = 0 -- 0 = vorne links 1 = vorne rechts 2 = hinten links 3 = hinten rechts setVehicleLightState ( veh, 1, 0 ) setVehicleLightState ( veh, 2, 0 ) setVehicleLightState ( veh, 0, 1 ) setVehicleLightState ( veh, 3, 1 ) setVehicleHeadLightColor ( veh, 77, 77, 255 ) else setVehicleLightState ( veh, 3, 0 ) setVehicleLightState ( veh, 0, 0 ) setVehicleLightState ( veh, 1, 1 ) setVehicleLightState ( veh, 2, 1 ) setVehicleHeadLightColor ( veh, 255, 77, 77 ) p_lvar4 [ veh ] = 1 end end ,50, 5 ) return end if ( p_lvar2 [ veh ] == 0) or ( p_lvar2 [ veh ] == nil ) then p_lvar2 [ veh ] = 1 -- 0 = vorne links 1 = vorne rechts 2 = hinten links 3 = hinten rechts setVehicleLightState ( veh, 1, 0 ) setVehicleLightState ( veh, 2, 0 ) setVehicleLightState ( veh, 0, 1 ) setVehicleLightState ( veh, 3, 1 ) setVehicleHeadLightColor ( veh, 0, 0, 255 ) else setVehicleLightState ( veh, 3, 0 ) setVehicleLightState ( veh, 0, 0 ) setVehicleLightState ( veh, 1, 1 ) setVehicleLightState ( veh, 2, 1 ) setVehicleHeadLightColor ( veh, 255, 0, 0 ) p_lvar2 [ veh ] = 0 end if ( p_lvar3 [ veh ] == nil ) then p_lvar3 [ veh ] = 0 end p_lvar3 [ veh ] = ( p_lvar3 [ veh ]+1 ) end ,500, 0 ) else p_lights [ veh ] = 0 outputChatBox ( "#FFFFFFYour Police-lights has been #00FF00disabled.", thePlayer, 0, 200, 100, true ) if ( isTimer ( p_timer [ veh ] ) ) then killTimer ( p_timer [ veh ] ) end setVehicleLightState ( veh, 0, 0 ) setVehicleLightState ( veh, 1, 0 ) setVehicleLightState ( veh, 2, 0 ) setVehicleLightState ( veh, 3, 0 ) setVehicleHeadLightColor ( veh, 255, 255, 255 ) setVehicleOverrideLights ( veh, 1 ) end end end end addCommandHandler ( "lights", toggleLights ) addEventHandler ( "onVehicleExplode", getRootElement(), function ( ) if ( p_lights [ source ] == 1 ) then if ( isTimer ( p_timer [ source ] ) ) then killTimer ( p_timer [ source ] ) end end end ) addEventHandler ( "onVehicleRespawn", getRootElement(), function ( ) if ( p_lights [ source ] == 1 ) then if ( isTimer ( p_timer [ source ] ) ) then killTimer ( p_timer [ source ] ) end end end ) addEventHandler ( "onElementDestroy", getRootElement(), function ( ) if ( getElementType ( source ) == "vehicle" ) then if ( p_lights [ source ] == 1 ) then if ( isTimer ( p_timer [ source ] ) ) then killTimer ( p_timer [ source ] ) end end end end )
×
×
  • Create New...