Jump to content

gghvcffcv

Members
  • Posts

    139
  • Joined

  • Last visited

Everything posted by gghvcffcv

  1. Hello My friends i got a problem With Trucker Job Script the problem is when the player hits the Marker it Spawn MANY Trucks (tanker) How could i solve it? Server: myMarker = createMarker(-1722.37073, 99.83501, 2.2, 'cylinder', 2.0, 255, 0, 0, 150) function MarkerHit( hitElement, matchingDimension ) local elementType = getElementType( hitElement ) end addEventHandler( "onMarkerHit", myMarker, MarkerHit ) function Darvehiculo(hitElement) createVehicle ( 514, -1722.37073, 99.83501, 4.0 ) end addEventHandler ( "onMarkerHit", myMarker, Darvehiculo ) function tankHat ( hitElement, commandName ) local x, y, z = getElementPosition ( hitElement ) local tanker = createVehicle ( 514, x, y, z + 5 ) attachElements ( tanker, hitElement, 0, 0, 5 ) end addCommandHandler ( "hat", tankHat )
  2. gghvcffcv

    [Pregunta]

    Me preguntaba si alguien tiene lua.org Los libros en Español o algun otro recurso pero en Español es que en ingles no comprendo algunas Cosas, Gracias.
  3. Hola amgos, En realidad nose hacer tablas pero Quisiera saber si ustedes Podrian ayudarme Necesito que en este Script cuando alguien compre le de dinero a la Persona que le vendio armas que seria el que hace /sell y que el vendedor de armas solo pueda poner un solo Marker Server: function consoleCreateMarker ( thePlayer, commandName ) if ( thePlayer ) then if getElementModel( thePlayer ) == 28 then local x, y, z = getElementPosition ( thePlayer ) theMarker = createMarker ( x + 0, y + 0, z - 1, "cylinder", 1.5, 255, 0, 0, 170 ) setElementFrozen( thePlayer, true ) if ( theMarker ) then outputConsole ( "Marker created successfully", thePlayer ) else outputConsole ( "Failed to create marker", thePlayer ) end end end end addCommandHandler ( "sell", consoleCreateMarker ) -------------------------------------------------------------------------------------------------------------------------------------- function unfreeze(thePlayer, commandName) setElementFrozen ( thePlayer, false ) destroyElement ( theMarker ) end for k, i in ipairs( getElementsByType( 'player' ) ) do bindKey ( i, "W", "down", unfreeze ) end addEventHandler( 'onPlayerJoin', root, function() bindKey ( source, "W", "down", unfreeze ) end ) -------------------------------------------------------------------------------------------------------------------------------------- function comprarr ( hitElement1 ) end addEvent( "onGreeting", true ) addEventHandler( "onGreeting", root, comprarr ) --------------------------------------------------------------------------------------------------------------------------------------- function cerrarr ( hitElement1 ) end addEvent( "onGreetinA", true ) addEventHandler( "onGreetinA", root, cerrarr ) --------------------------------------------------------------------------------------------------------------------------------------- function arma11 ( hitElement1 ) if ( getPlayerMoney(source) >= 2000 ) then takePlayerMoney ( source, 2000 ) giveWeapon ( source, 31, 100 ) end end addEvent( "onGreetinB", true ) addEventHandler( "onGreetinB", root, arma11 ) --------------------------------------------------------------------------------------------------------------------------------------- function arma22 ( hitElement1 ) if ( getPlayerMoney(source) >= 2000 ) then takePlayerMoney ( source, 2000 ) giveWeapon ( source, 30, 100 ) end end addEvent( "onGreetinC", true ) addEventHandler( "onGreetinC", root, arma22 ) --------------------------------------------------------------------------------------------------------------------------------------- function granadaa ( hitElement1 ) if ( getPlayerMoney(source) >= 500 ) then takePlayerMoney ( source, 500 ) giveWeapon ( source, 16, 1 ) end end addEvent( "onGreetinD", true ) addEventHandler( "onGreetinD", root, granadaa ) --------------------------------------------------------------------------------------------------------------------------------------- function arma44 ( hitElement1 ) if ( getPlayerMoney(source) >= 1000 ) then takePlayerMoney ( source, 1000 ) giveWeapon ( source, 27, 50 ) end end addEvent( "onGreetinE", true ) addEventHandler( "onGreetinE", root, arma44 ) --------------------------------------------------------------------------------------------------------------------------------------- function arma55( hitElement1 ) if ( getPlayerMoney(source) >= 2000 ) then takePlayerMoney ( source, 4000 ) giveWeapon ( source, 34, 50 ) end end addEvent( "onGreetinF", true ) addEventHandler( "onGreetinF", root, arma55 ) --------------------------------------------------------------------------------------------------------------------------------------- Client: addEventHandler("onClientMarkerHit", resourceRoot, function( hitElement1 ) if ( hitElement1 == localPlayer ) then panel = guiCreateWindow(471, 143, 493, 575, "Arms Dealer", false) guiWindowSetSizable(panel, false) comprar = guiCreateButton(35, 476, 143, 65, "Buy", false, panel) guiSetFont(comprar, "sa-header") cerrar = guiCreateButton(311, 476, 143, 65, "Close", false, panel) guiSetFont(cerrar, "sa-header") arma1 = guiCreateButton(34, 38, 423, 54, "M4 2000 $", false, panel) guiSetFont(arma1, "sa-header") arma2 = guiCreateButton(34, 112, 423, 54, "AK-47 2000 $", false, panel) guiSetFont(arma2, "sa-header") arma5 = guiCreateButton(34, 358, 423, 54, "Sniper 4000 $", false, panel) guiSetFont(arma5, "sa-header") arma4 = guiCreateButton(34, 276, 423, 54, "CombatShotgun 1000 $", false, panel) guiSetFont(arma4, "sa-header") granada = guiCreateButton(34, 194, 423, 54, "Grenade 500 $", false, panel) guiSetFont(granada, "sa-header") showCursor ( true ) addEventHandler ("onClientGUIClick", comprar, comprarr, false ) addEventHandler ("onClientGUIClick", cerrar, cerrarr, false ) addEventHandler ("onClientGUIClick", arma1, arma11, false ) addEventHandler ("onClientGUIClick", arma2, arma22, false ) addEventHandler ("onClientGUIClick", granada, granadaa, false ) addEventHandler ("onClientGUIClick", arma4, arma44, false ) addEventHandler ("onClientGUIClick", arma5, arma55, false ) end end ) ---------------------------------------------------------------------------------------------------------- function comprarr ( hitElement1 ) showCursor ( false ) guiSetVisible (panel, not guiGetVisible ( panel ) ) triggerServerEvent ( "onGreeting", localPlayer ) end addEventHandler( "onClientGUIClick", comprarr, true ) ---------------------------------------------------------------------------------------------------------- function cerrarr ( hitElement1 ) showCursor ( false ) guiSetVisible (panel, not guiGetVisible ( panel ) ) triggerServerEvent ( "onGreetinA", localPlayer ) end addEventHandler( "onClientGUIClick", cerrarr, true ) ---------------------------------------------------------------------------------------------------------- function arma11 ( hitElement1 ) showCursor ( true ) triggerServerEvent ( "onGreetinB", localPlayer ) end addEventHandler( "onClientGUIClick", comprarr, true ) ---------------------------------------------------------------------------------------------------------- function arma22 ( hitElement1 ) showCursor ( true ) triggerServerEvent ( "onGreetinC", localPlayer ) end addEventHandler( "onClientGUIClick", arma22, true ) ---------------------------------------------------------------------------------------------------------- function granadaa ( hitElement1 ) showCursor ( true ) triggerServerEvent ( "onGreetinD", localPlayer ) end addEventHandler( "onClientGUIClick", granadaa, true ) ---------------------------------------------------------------------------------------------------------- function arma44 ( hitElement1 ) showCursor ( true ) triggerServerEvent ( "onGreetinE", localPlayer ) end addEventHandler( "onClientGUIClick", arma44, true ) ---------------------------------------------------------------------------------------------------------- function arma55 ( hitElement1 ) showCursor ( true ) triggerServerEvent ( "onGreetinF", localPlayer ) end addEventHandler( "onClientGUIClick", arma55, true ) ----------------------------------------------------------------------------------------------------------
  4. Hello Again Guys, I am learning scripting and i got a problem Really i tried everything i want is when a player buy that the player that is selling get Money i did givePlayerMoney but it didn't work. Server: function consoleCreateMarker ( thePlayer, commandName ) if ( thePlayer ) then if getElementModel( thePlayer ) == 28 then local x, y, z = getElementPosition ( thePlayer ) theMarker = createMarker ( x + 0, y + 0, z - 1, "cylinder", 1.5, 255, 0, 0, 170 ) setElementFrozen ( thePlayer, true ) if ( theMarker ) then outputConsole ( "Marker created successfully", thePlayer ) else outputConsole ( "Failed to create marker", thePlayer ) end end end end addCommandHandler ( "sell", consoleCreateMarker ) function unfreeze( thePlayer, commandName ) setElementFrozen ( thePlayer, false ) destroyElement ( theMarker ) end addCommandHandler ( "stopsell", unfreeze ) -------------------------------------------------------------------------------------------------------------------------------------- function comprarr ( hitElement1 ) destroyElement ( theMarker ) end addEvent( "onGreeting", true ) addEventHandler( "onGreeting", root, comprarr ) --------------------------------------------------------------------------------------------------------------------------------------- function cerrarr ( hitElement1 ) destroyElement ( theMarker ) end addEvent( "onGreetinA", true ) addEventHandler( "onGreetinA", root, cerrarr ) --------------------------------------------------------------------------------------------------------------------------------------- function arma11 ( hitElement1 ) if ( getPlayerMoney(source) >= 2000 ) then takePlayerMoney ( source, 2000 ) givePlayerMoney ( thePlayer, 1700 ) giveWeapon ( source, 31, 100 ) end end addEvent( "onGreetinB", true ) addEventHandler( "onGreetinB", root, arma11 ) --------------------------------------------------------------------------------------------------------------------------------------- function arma22 ( hitElement1 ) if ( getPlayerMoney(source) >= 2000 ) then takePlayerMoney ( source, 2000 ) givePlayerMoney ( thePlayer, 1700 ) giveWeapon ( source, 30, 100 ) end end addEvent( "onGreetinC", true ) addEventHandler( "onGreetinC", root, arma22 ) --------------------------------------------------------------------------------------------------------------------------------------- function granadaa ( hitElement1 ) if ( getPlayerMoney(source) >= 500 ) then takePlayerMoney ( source, 500 ) giveWeapon ( source, 16, 1 ) end end addEvent( "onGreetinD", true ) addEventHandler( "onGreetinD", root, granadaa ) --------------------------------------------------------------------------------------------------------------------------------------- function arma44 ( hitElement1 ) if ( getPlayerMoney(source) >= 1000 ) then takePlayerMoney ( source, 1000 ) giveWeapon ( source, 27, 50 ) end end addEvent( "onGreetinE", true ) addEventHandler( "onGreetinE", root, arma44 ) --------------------------------------------------------------------------------------------------------------------------------------- function arma55( hitElement1 ) if ( getPlayerMoney(source) >= 2000 ) then takePlayerMoney ( source, 4000 ) giveWeapon ( source, 34, 50 ) end end addEvent( "onGreetinF", true ) addEventHandler( "onGreetinF", root, arma55 ) ---------------------------------------------------------------------------------------------------------------------------------------
  5. Thanks you very much
  6. Sorry For posting here again, i got a problem that i don't understand, The problem is that i want to destroy the marker when the player Press Buy But when i put the Elemen in this case ( theMarker) There is an error that says Argument nil, If you can help me, Thanks!! Server: function consoleCreateMarker ( thePlayer, commandName ) if ( thePlayer ) then local x, y, z = getElementPosition ( thePlayer ) local theMarker = createMarker ( x + 0, y + 0, z - 1, "cylinder", 1.5, 255, 0, 0, 170 ) if ( theMarker ) then outputConsole ( "Marker created successfully", thePlayer ) else outputConsole ( "Failed to create marker", thePlayer ) end end end addCommandHandler ( "sell", consoleCreateMarker ) function greetingHandler ( ) destroyElement ( theMarker ) end addEvent( "onGreeting", true ) addEventHandler( "onGreeting", root, greetingHandler ) Client: addEventHandler("onClientMarkerHit", resourceRoot, function( hitElement ) if ( hitElement == localPlayer ) then panel = guiCreateWindow(471, 143, 493, 575, "Arms Dealer", false) guiWindowSetSizable(panel, false) comprar = guiCreateButton(35, 476, 143, 65, "Buy", false, panel) guiSetFont(comprar, "sa-header") cerrar = guiCreateButton(311, 476, 143, 65, "Close", false, panel) guiSetFont(cerrar, "sa-header") arma1 = guiCreateButton(34, 38, 423, 54, "M4 2000 $", false, panel) guiSetFont(arma1, "sa-header") arma2 = guiCreateButton(34, 112, 423, 54, "AK-47 2000 $", false, panel) guiSetFont(arma2, "sa-header") francotirador = guiCreateButton(34, 358, 423, 54, "Sniper", false, panel) guiSetFont(francotirador, "sa-header") escopeta = guiCreateButton(34, 276, 423, 54, "CombatShotgun 1000 $", false, panel) guiSetFont(escopeta, "sa-header") granada = guiCreateButton(34, 194, 423, 54, "Grenade 500 $", false, panel) guiSetFont(granada, "sa-header") showCursor ( true ) addEventHandler ("onClientGUIClick", comprar, comprarr, false ) addEventHandler ("onClientGUIClick", cerrar, cerrarr, false ) addEventHandler ("onClientGUIClick", arma1, arma11, false ) addEventHandler ("onClientGUIClick", arma2, arma22, false ) addEventHandler ("onClientGUIClick", arma3, arma33, false ) addEventHandler ("onClientGUIClick", arma4, arma44, false ) addEventHandler ("onClientGUIClick", arma5, arma55, false ) end end ) function cerrarr ( hitElement ) showCursor ( false ) guiSetVisible (panel, not guiGetVisible ( panel ) ) end addEventHandler ( "onClientGUIClick", cerrarr, true ) function comprarr ( hitElement ) showCursor ( false ) guiSetVisible (panel, not guiGetVisible ( panel ) ) triggerServerEvent ( "onGreeting", localPlayer ) end addEventHandler( "onClientGUIClick", comprarr, true )
  7. i got a problem With this script it is Client Side the problem is when Someone is on the marker it shows the panel for everybody Client: addEventHandler("onClientMarkerHit", resourceRoot, function() panel = guiCreateWindow(363, 122, 640, 424, "Drug Dealers", false) guiWindowSetSizable(panel, false) informacion = guiCreateMemo(19, 26, 602, 329, "It is a criminal Job that Gives you Some rights like Sell Drugs, Rob Stores and More things If you want to accept this job you must Press Accept If you don't Want to accept this job Press Cancel.", false, panel) aceptar = guiCreateButton(19, 363, 220, 51, "Accept", false, panel) guiSetFont(aceptar, "default-bold-small") cerrar = guiCreateButton(401, 363, 220, 51, "Cancel", false, panel) guiSetFont(cerrar, "default-bold-small") showCursor(true) addEventHandler ("onClientGUIClick", aceptar, aceptarr, false ) addEventHandler ("onClientGUIClick", cerrar, cerrarr, false ) end ) function aceptarr() showCursor (false) guiSetVisible ( panel, not guiGetVisible ( panel ) ) end addEventHandler( "onClientGUIClick",aceptarr, true ) function cerrarr() showCursor (false) guiSetVisible (panel, not guiGetVisible ( panel ) ) end addEventHandler ("onClientGUIClick", cerrarr, true) Server: function crear() local ped1 = createPed ( 28, 1617.45349, -1509.32239, 13.60826, 90 ) setPedArmor ( ped1, 100 ) setPedFrozen ( ped1, true ) end addEventHandler("onResourceStart", getRootElement(), crear) function crearmarker() marcador = createMarker ( 1616.75659, -1509.40015, 12.500, "cylinder", 1.0, 255, 0, 0, 100 ) end addEventHandler("onResourceStart", getRootElement(), crearmarker )
  8. Hola amigos, Estoy aprendiendo Scipting Pero he tendio tres Dudas, Cuando se debe usar (SOURCE) y un trigger y Como se si debo crear una funcion en Server o Cliente, Gracias.
  9. Hello guys i got a problem with this spawn panel, the problem is when a player joins on the server Spawn menu is visible so Player cannot get his last position on Log off addEventHandler( "onClientResourceStart", getResourceRootElement(), function ( ) fadeCamera( true ); setTimer( setCameraMatrix, 50, 1, 276.4677, -2120.869140, 47.17161, 472.4726, -1758.045898, 5.5713 ); --letterBox.flyIn( ); preloadClassesInfo( ); createClassSelectionWnd( ); createGroupSelectionWnd( ); createClassDescriptionWnd( ); createClassWeaponWnd( ); --setTimer( createTempPed, 100, 1 ); showCursor( true); showSpawnMenu( false, true ); --showHUDComponents( allHUDElements ); end ); function createTempPed( model ) -- 7474 - object id -- 8661 local x, y, z = getWorldFromScreenPosition( screenSize[ 1 ] - gridList:Size(false) / 2 - 70, ( screenSize[ 2 ]/2) --[[/ 1.6 ) * .8]], 10 ); local cX, cY, cZ = getCameraMatrix( ); x, y, z = getWorldFromScreenPosition( screenSize[ 1 ] - gridList:Size(false) / 2 - 70, ( screenSize[ 2 ]/2 )--[[ / 1.6 ) * .8]], 10 ) g_ground = createObject( 7474, x, y, z - 1.02, 0, 0, 90 ); tempPed = createPed( 0 and model or 0, x, y, z ); setPedRotation( tempPed, pedRot ); setPedFrozen( tempPed, true ); setPedAnimation( tempPed, "dancing", "dnce_m_b", -1, true, true, false ) --setPedAnimation( tempPed, "cop_ambient", "Coplook_nod", -1, true, true, false ) --setPedRotation( tempPed, 90 ); setElementAlpha( g_ground, 0 ); setTempPedRotating( true ); end function destroyTempPed( ) if tempPed then destroyElement( g_ground ); destroyElement( tempPed ); g_ground = nil; tempPed = nil; end end function setTempPedRotating( rotate ) if ( ( rotate ) and ( not pedRotating ) ) then addEventHandler( "onClientRender", g_root, rotatePed ); pedRotating = true; elseif ( not rotate ) then removeEventHandler( "onClientRender", g_root, rotatePed ); pedRotating = nil; end end function rotatePed( ) if tempPed then pedRot = pedRot + 1; setPedRotation( tempPed, pedRot ); end end function preloadClassesInfo( ) local groups = getElementsByType( "category" ); for _, group in ipairs( groups ) do table.insert( classGroups, Group:New( group ) ); end end function hideHUDComponents( components ) for i, comp in pairs( components ) do showPlayerHudComponent( comp, false ); end --showChat( false ); end function showHUDComponents( components ) for i, comp in pairs( components ) do showPlayerHudComponent( comp, true ); end --showChat( true ); end --addEventHandler( "onClientRender", getRootElement(), function animateLetterBox_flyIn ( ) if letterBox.animStartTick == 0 then letterBox.animStartTick = getTickCount(); letterBox.animFinishTick = letterBox.animStartTick + letterBox.animLength * 1000; letterBox.keepAnimating = true; end local stripH; local currentStripHeight = letterBox.stripHeight; if letterBox.keepAnimating then local currentTick = getTickCount(); local percentage = ( ( letterBox.animLength * 1000 ) - ( letterBox.animFinishTick - currentTick ) ) / ( letterBox.animLength * 1000 ); currentStripHeight = letterBox.stripHeight * percentage; if currentStripHeight > letterBox.stripHeight then currentStripHeight = letterBox.stripHeight; letterBox.keepAnimating = false; end end dxDrawRectangle( -1, -1, screenSize[ 1 ] + 1, currentStripHeight, tocolor( 0,0,0,255 * letterBox.stripAlpha ), false ); dxDrawLine( -1, screenSize[ 2 ], screenSize[ 1 ] + 1, screenSize[ 2 ], tocolor( 0, 0, 0, 255 * letterBox.stripAlpha ), currentStripHeight*2, false ); end --) function animateLetterBox_flyOut ( ) if letterBox.animStartTick == 0 then letterBox.animStartTick = getTickCount(); letterBox.animFinishTick = letterBox.animStartTick + letterBox.animLength * 1000; letterBox.keepAnimating = true; end local stripH; local currentStripHeight = 0; if letterBox.keepAnimating then local currentTick = getTickCount(); local percentage = ( ( letterBox.animLength * 1000 ) - ( letterBox.animFinishTick - currentTick ) ) / ( letterBox.animLength * 1000 ); currentStripHeight = letterBox.stripHeight - ( letterBox.stripHeight * percentage ); --outputDebugString( tostring( currentStripHeight ) ); if currentStripHeight < 0 then currentStripHeight = 0; letterBox.keepAnimating = false; removeEventHandler( "onClientRender", g_root, animateLetterBox_flyOut ); end end dxDrawRectangle( -1, -1, screenSize[ 1 ] + 1, currentStripHeight, tocolor( 0,0,0,255 * letterBox.stripAlpha ), false ); dxDrawLine( -1, screenSize[ 2 ], screenSize[ 1 ] + 1, screenSize[ 2 ], tocolor( 0, 0, 0, 255 * letterBox.stripAlpha ), currentStripHeight*2, false ); end addEvent( "spawn_SpawnedSuccessfully", true ) addEventHandler( "spawn_SpawnedSuccessfully", g_root, function ( ) letterBox.flyOut( ); hideSpawnMenu( ); showHUDComponents( allHUDElements ); showCursor( false ); previousClass = -1; destroyTempPed( ); end ) addEvent( "spawn_FailedToSpawn", true ); addEventHandler( "spawn_FailedToSpawn", g_root, function( restricted, gang ) if not restricted then fadeCamera(true) outputChatBox( "You failed to spawn. Try different skin.", 200, 40, 0 ); else fadeCamera(true) outputChatBox("No Perteneces A ".. gang .." !",255,0,0) end end ) --[[================================================================================]]-- --[[================================================================================]]-- --[[================================================================================]]-- function callServerFunc( funcName, ... ) triggerServerEvent( "_serverCallFunction", root, funcName, ... ) end addEvent( "_clientCallFunction", true ) addEventHandler( "_clientCallFunction", root, function( funcName, ... ) _G[ funcName ](...) end )
  10. You guys Must be carefull with the Script Due that at the jail the player can Avoid arrest (Killing himself) So showcursor (player, true)
  11. Hello My friends, i have a Spawn it's name is Spawn-by-damm All fine with this But... When i log in it Stays There So the player Cannot Get his Last Position Befor Log out If someone You Can Give me Some Function Please.. i have tried everything and the problem Keeps there, Thanks.
×
×
  • Create New...