Jump to content

[Tablas]Ayuda


Recommended Posts

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 ) 
---------------------------------------------------------------------------------------------------------- 

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...