Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. Castillo

    Otra duda

    -- /pm to message other players local function pm( player, target, message ) outputChatBox( "PM a [" .. exports.players:getID( target ) .. "] " .. getPlayerName( target ) .. ": " .. message, player, 255, 255, 0 ) outputChatBox( "PM de [" .. exports.players:getID( player ) .. "] " .. getPlayerName( player ) .. ": " .. message, target, 255, 255, 0 ) end addCommandHandler( "pm", function( thePlayer, commandName, otherPlayer, ... ) if exports.players:isLoggedIn( thePlayer ) then if otherPlayer and ( ... ) then local message = table.concat( { ... }, " " ) local player, name = exports.players:getFromName( thePlayer, otherPlayer ) if player then if ( getElementData( player, "PMOFF.on") == true ) then pm( thePlayer, player, message ) end end else outputChatBox( "Syntax: /" .. commandName .. " [player] [ooc text]", thePlayer, 255, 255, 255 ) end end end ) addEventHandler( "onPlayerPrivateMessage", root, function( message, recipent ) if exports.players:isLoggedIn( thePlayer ) and exports.players:isLoggedIn( recipent ) then pm( source, recipent, message ) end end cancelEvent( ) end ) function showTextDisplay2(playerSource) if hasObjectPermissionTo( playerSource, "command.kick", false ) or hasObjectPermissionTo( playerSource, "command.deletecar", false ) then setElementData(playerSource, "PMOFF.on", true) outputChatBox( "Quitaste el PM", playerSource, 0, 255, 255 ) else outputChatBox( "No eres administrador", playerSource, 0, 255, 255 ) end end addCommandHandler( "quitarpm", showTextDisplay2 ) function showTextDisplay(playerSource) if hasObjectPermissionTo( playerSource, "command.kick", false ) or hasObjectPermissionTo( playerSource, "command.deletecar", false ) then setElementData(playerSource, "PMOFF.on", false) outputChatBox( "Activaste el PM", playerSource, 0, 255, 255 ) else outputChatBox( "No eres administrador", playerSource, 0, 255, 255 ) end end addCommandHandler( "activarpm", showTextDisplay )
  2. Castillo

    Timer

    setTimer ( restartResource, 3600000, 1, getResourceFromName ( "Move" ) )
  3. If you want the server to be online, then leave it open.
  4. Podes usar mi recurso: https://community.multitheftauto.com/ind ... ls&id=5195
  5. 1: Make sure your server version is at least: 1.3.0 r4557. 2: Make sure your script is set as client side. 3: The weapon must be set as string, so it's "M4", not M4.
  6. addEventHandler( 'onClientResourceStart', resourceRoot, function( pRes ) for i,v in ipairs( getElementsByType( 'object' ) ) do if( getElementModel( v ) == 2916 ) then local iX, iY, iZ = getElementPosition( v ) local iInt = getElementInterior( v ) local iDim = getElementDimension( v ) myMarker = createMarker( iX, iY, iZ, 'cylinder', 2.0, 255, 0, 0, 125 ) setElementInterior( myMarker, iInt ) setElementDimension( myMarker, iDim ) end end end ) addCommandHandler( 'train', function( c ) local p = localPlayer if( isElementWithinMarker( p, myMarker ) ) then local iX, iY, iZ = getPedBonePosition( p, 25 ) object = createObject ( 2916, iX, iY, iZ ) attachElements( object, p, iX, iY, iZ ) else outputChatBox( 'Nope.', p ) end end )
  7. I don't really understand what do you mean, what "base only" means?
  8. I don't really understand why you had to do all that Anderl . local playerJoined addEventHandler ( "onClientPlayerJoin", root, function ( ) if ( isTimer ( removeTimer ) ) then killTimer ( removeTimer ) end removeEventHandler ( "onClientRender", root, drawJoinMessage ) playerJoined = source addEventHandler ( "onClientRender", root, drawJoinMessage ) removeTimer = setTimer ( function ( ) removeEventHandler ( "onClientRender", root, drawJoinMessage ) playerJoined = nil end ,4000, 1 ) end ) function drawJoinMessage ( ) if ( playerJoined and isElement ( playerJoined ) ) then dxDrawText ( "Server: ".. getPlayerName ( playerJoined ) .." has joined the game", 3, 0, 10, 10, tocolor ( 0, 0, 0, 200 ), 0.3, "default" ) end end
  9. Not with a function like that.
  10. Castillo

    Por que :S

    Porque el script se ejecuta en el client side, no se ejecuta para todos, sino para el cliente nada mas.
  11. Vas a tener que hacerlo client side, en cada render comparas la velocidad. Podes usar esta funcion para obtener la velocidad de un elemento, en este caso el vehiculo: https://wiki.multitheftauto.com/wiki/GetElementSpeed
  12. Ese evento se ejecuta al entrar a un vehiculo, sea warpeandolo dentro o entrando manualmente.
  13. addEventHandler ( "onVehicleEnter", root, function ( ) setVehicleHandling ( source, "maxVelocity", 400 ) setVehicleHandling ( source, "engineAcceleration", 35 ) end ) server side.
  14. Usa: getPlayerTeam + getTeamName
  15. GUIEditor_Window = {} GUIEditor_Grid = {} GUIEditor_Window = {} GUIEditor_Grid = {} local x,y = guiGetScreenSize() GUIEditor_Window[1] = guiCreateWindow(x/2-179,y/2-203,358,405,"kill / Deaths",false) guiSetVisible(GUIEditor_Window[1] ,false) GUIEditor_Grid[1] = guiCreateGridList(9,24,340,372,false,GUIEditor_Window[1]) guiGridListAddColumn(GUIEditor_Grid[1],"Player Name",0.5) guiGridListAddColumn(GUIEditor_Grid[1],"Player Kills",0.2) guiGridListAddColumn(GUIEditor_Grid[1],"Player Deaths",0.2) setElementData ( localPlayer, "Kills", 0 ) setElementData ( localPlayer, "Deaths", 0 ) addEventHandler ( "onClientPlayerWasted", root, function ( killer ) if ( killer and killer ~= source ) then local k = getElementData ( killer, "Kills" ) or 0 setElementData ( killer, "Kills", ( k + 1 ) ) end local d = getElementData ( source, "Deaths" ) or 0 setElementData ( source, "Deaths", ( d + 1 ) ) U ( ) end ) function U ( ) guiGridListClear ( GUIEditor_Grid[1] ) local players = getPlayersSortByKills ( ) for index = 1, 20 do local row = guiGridListAddRow ( GUIEditor_Grid[1] ) guiGridListSetItemText ( GUIEditor_Grid[1], row, 1, tostring ( getPlayerName ( players [ index ].element ) ), false, false ) guiGridListSetItemText ( GUIEditor_Grid[1], row, 2, tostring ( players [ index ].kills ), false, false ) guiGridListSetItemText ( GUIEditor_Grid[1], row, 3, tostring ( players [ index ].deaths ), false, false ) end end addEventHandler ( "onClientResourceStart", resourceRoot, U ) function getPlayersSortByKills ( ) local players = { } for index, player in ipairs ( getElementsByType ( "player" ) ) do table.insert ( players, { element = player, kills = getElementData ( player, "Kills" ) or 0, deaths = getElementData ( player, "Deaths" ) or 0 } ) end table.sort ( players, function ( a, b ) return ( tonumber ( a.kills ) or 0 ) > ( tonumber ( b.kills ) or 0 ) end ) return players end Try it.
  16. Castillo

    ID?

    The object model is: 11490, about the interior, I don't know.
  17. function M1 ( ) local vehicle = getPedOccupiedVehicle ( localPlayer ) local x, y, z = getElementPosition( vehicle ) sound1 = playSound3D ( "http://listen.radionomy.com/a-rockradio.m3u", x, y, z, true ) setSoundVolume ( sound1, 5 ) setSoundMaxDistance ( sound1, 10 ) attachElements ( sound1, vehicle ) end
  18. Entonces 'thePlayer' no es un jugador, sino un argumento del evento ese. Tenes que usar 'localPlayer' function M1 ( ) local vehicle = getPedOccupiedVehicle ( localPlayer ) local x,y,z = getElementPosition( vehicle ) sound1 = playSound3D( "http://listen.radionomy.com/a-rockradio.m3u", x, y, z, true ) setSoundVolume( sound, 5 ) setSoundMaxDistance( sound, 10 ) end
  19. Como ejecutas la funcion: "M1"?
  20. Castillo

    top wins

    You're welcome.
  21. Yes, it is. local disabledTeams = { [ "Test" ] = true, [ "Test 2" ] = true } addEventHandler ( "onPlayerChat", root, function ( _, msgType ) if ( msgType == 2 ) then local playerTeam = getPlayerTeam ( source ) if ( disabledTeams [ getTeamName ( playerTeam ) ] ) then cancelEvent ( ) end end end ) Should work.
×
×
  • Create New...