Guest User

SimS

a guest
Aug 13th, 2010
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.45 KB | None | 0 0
  1. Ammunation_Window = {}
  2. Ammunation_Image = {}
  3.  
  4. function menu_close()
  5.    showCursor(false)
  6.    guiSetVisible( Ammunation_Window[1], false )
  7. end
  8.  
  9. function menu_show()
  10.    guiSetVisible( Ammunation_Window[1], true )
  11. end
  12.  
  13. local mar = createMarker ( 295.02026367188, -37.797130584717, 1001.515625, cylinder, 1, 255, 0, 0 )
  14. local mar2 = createMarker ( 296.60397338867, -80.450172424316, 1001.515625, cylinder, 1, 255, 0, 0 )
  15. local mar3 = createMarker ( 290.08682250977, -109.44632720947, 1001.515625, cylinder, 1, 255, 0, 0 )
  16. local mar4 = createMarker ( 316.5299987793, -169.61000061035, 999.60101318359, cylinder, 1, 255, 0, 0 )
  17.  
  18. function markertarget()
  19.    setMarkerTarget ( mar, 295.02026367188, -37.797130584717, 1001.515625 )
  20. end
  21.  
  22. function markertarget2()
  23.    setMarkerTarget ( mar2, 296.60397338867, -80.450172424316, 1001.515625 )
  24. end
  25.  
  26. function markertarget3()
  27.    setMarkerTarget ( mar3, 290.08682250977, -109.44632720947, 1001.515625 )
  28. end
  29.  
  30. function markertarget4()
  31.    setMarkerTarget ( mar4, 316.5299987793, -169.61000061035, 999.60101318359 )
  32. end
  33.  
  34. function MarkerHit( hitPlayer, matchingDimension, markerName )
  35.    local x,y,z = getMarkerTarget( source, markerName )    -- get the marker target
  36.    if x ~= false then
  37.    
  38.    if getElementType(hitPlayer)=="player" then
  39.    showCursor(true)
  40.  
  41.    local screenWidth, screenHeight = guiGetScreenSize()
  42.    local windowWidth, windowHeight = 828, 242
  43.    local left = screenWidth/2 - windowWidth/2
  44.    local top = screenHeight/2 - windowHeight/2
  45.    
  46.    --GUI
  47.    Ammunation_Window[1] = guiCreateWindow(left, top, windowWidth, windowHeight,"San Andreas Ammunation",false)
  48.    guiWindowSetSizable(Ammunation_Window[1],false)
  49.    Ammunation_Image[1] = guiCreateStaticImage(35,43,64,64,"images/ammu/katana.png",false,Ammunation_Window[1])
  50.    Ammunation_Image[2] = guiCreateStaticImage(133,41,64,64,"images/ammu/silencer.png",false,Ammunation_Window[1])
  51.    Ammunation_Image[3] = guiCreateStaticImage(232,41,64,64,"images/ammu/deagle.png",false,Ammunation_Window[1])
  52.    Ammunation_Image[4] = guiCreateStaticImage(331,41,64,64,"images/ammu/combatshotgun.png",false,Ammunation_Window[1])
  53.    Ammunation_Image[5] = guiCreateStaticImage(532,41,64,64,"images/ammu/ak47.png",false,Ammunation_Window[1])
  54.    Ammunation_Image[6] = guiCreateStaticImage(634,41,64,64,"images/ammu/m4a1.png",false,Ammunation_Window[1])
  55.    Ammunation_Image[7] = guiCreateStaticImage(431,41,64,64,"images/ammu/tec9.png",false,Ammunation_Window[1])
  56.    Ammunation_Image[8] = guiCreateStaticImage(733,41,64,64,"images/ammu/sniper.png",false,Ammunation_Window[1])
  57.    
  58.    NINJAROPE = guiCreateButton(122,110,83,50,"Comprar\nCorda Ninja\n$12.500",false,Ammunation_Window[1])
  59.    KATANA = guiCreateButton(22,110,83,50,"Comprar\nKatana\n$200",false,Ammunation_Window[1])
  60.    DEAGLE = guiCreateButton(221,110,83,50,"Comprar\nDesert Eagle\n$500",false,Ammunation_Window[1])
  61.    CSHOTGUN = guiCreateButton(321,110,83,50,"Comprar\nC. Shotgun\n$800",false,Ammunation_Window[1])
  62.    AK47 = guiCreateButton(523,110,83,50,"Comprar\nAK47\n$1.600",false,Ammunation_Window[1])
  63.    M4A1 = guiCreateButton(624,110,83,50,"Comprar\nM4A1\n$1.900",false,Ammunation_Window[1])
  64.    TEC9 = guiCreateButton(422,110,83,50,"Comprar\nTEC9\n$600",false,Ammunation_Window[1])
  65.    SNIPER = guiCreateButton(724,110,83,50,"Comprar\nSniper Rifle\n$2.500",false,Ammunation_Window[1])
  66.  
  67.    CLOSE = guiCreateButton(330,179,167,36,"Sair",false,Ammunation_Window[1])
  68.    
  69.    addEventHandler ( "onClientGUIClick", CLOSE, menu_close, false )
  70.    addEventHandler ( "onClientGUIClick", KATANA, gKatana, false )
  71.    addEventHandler ( "onClientGUIClick", DEAGLE, gdeagle, false )
  72.    addEventHandler ( "onClientGUIClick", NINJAROPE, gGrapple, false )
  73.    addEventHandler ( "onClientGUIClick", CSHOTGUN, gShotgun, false )
  74.    addEventHandler ( "onClientGUIClick", TEC9, gTec9, false )
  75.    addEventHandler ( "onClientGUIClick", AK47, gAK47, false )
  76.    addEventHandler ( "onClientGUIClick", M4A1, gM4A1, false )
  77.    addEventHandler ( "onClientGUIClick", SNIPER, gSniper, false )
  78.  
  79.    end
  80. end
  81. end
  82. addEventHandler ( "onClientMarkerHit", getRootElement(), markertarget, mar, MarkerHit, menu_show )
  83. addEventHandler ( "onClientMarkerHit", getRootElement(), markertarget2, mar2, MarkerHit, menu_show )
  84. addEventHandler ( "onClientMarkerHit", getRootElement(), markertarget3, mar3, MarkerHit, menu_show )
  85. addEventHandler ( "onClientMarkerHit", getRootElement(), markertarget4, mar4, MarkerHit, menu_show )
  86.  
  87. function gKatana( thePlayer )
  88.     local money = getPlayerMoney(thePlayer)
  89.     if (money > 199) then  
  90.         takePlayerMoney ( 200 )        
  91.         triggerServerEvent ( "giveweapon", getLocalPlayer(), "8","100" )
  92.         outputChatBox("* Você comprou uma Katana por $200!", thePlayer )
  93.     else
  94.     outputChatBox("* Você não possui dinheiro suficiente!", thePlayer )
  95.     end
  96. end
  97.  
  98. function gdeagle( thePlayer )
  99.     local money = getPlayerMoney(thePlayer)
  100.     if (money > 499) then  
  101.         takePlayerMoney ( 500 )
  102.         triggerServerEvent ( "giveweapon", getLocalPlayer(), "24","200" )
  103.         outputChatBox("* Você comprou uma Desert Eagle por $500!", thePlayer )
  104.     else
  105.     outputChatBox("* Você não possui dinheiro suficiente!", thePlayer )
  106.     end
  107. end
  108.  
  109. function gGrapple( thePlayer )
  110.     local money = getPlayerMoney(thePlayer)
  111.     if (money > 12499) then  
  112.         takePlayerMoney ( 12500 )          
  113.         triggerServerEvent ( "giveweapon", getLocalPlayer(), "23","200" )
  114.         outputChatBox("* Você comprou uma \"Corda Ninja\" por $12.500!", thePlayer )
  115.     else
  116.     outputChatBox("* Você não possui dinheiro suficiente!", thePlayer )
  117.     end
  118. end
  119.  
  120. function gShotgun( thePlayer )
  121.     local money = getPlayerMoney(thePlayer)
  122.     if (money > 799) then  
  123.         takePlayerMoney ( 800 )          
  124.         triggerServerEvent ( "giveweapon", getLocalPlayer(), "27","200" )
  125.         outputChatBox("* Você comprou uma Combat Shotgun por $800!", thePlayer )
  126.     else
  127.     outputChatBox("* Você não possui dinheiro suficiente!", thePlayer )
  128.     end
  129. end
  130.  
  131. function gTec9( thePlayer )
  132.     local money = getPlayerMoney(thePlayer)
  133.     if (money > 599) then  
  134.         takePlayerMoney ( 600 )        
  135.         triggerServerEvent ( "giveweapon", getLocalPlayer(), "32","350" )
  136.         outputChatBox("* Você comprou uma TEC9 por $600!", thePlayer )
  137.     else
  138.     outputChatBox("* Você não possui dinheiro suficiente!", thePlayer )
  139.     end
  140. end
  141.  
  142. function gAK47( thePlayer )
  143.     local money = getPlayerMoney(thePlayer)
  144.     if (money > 1599) then
  145.         takePlayerMoney ( 1600 )  
  146.         triggerServerEvent ( "giveweapon", getLocalPlayer(), "30","350" )
  147.         outputChatBox("* Você comprou uma AK47 por $1.600!", thePlayer )
  148.     else
  149.     outputChatBox("* Você não possui dinheiro suficiente!", thePlayer )
  150.     end
  151. end
  152.  
  153. function gM4A1( thePlayer )
  154.     local money = getPlayerMoney(thePlayer)
  155.     if (money > 1899) then 
  156.         takePlayerMoney ( 1900 )    
  157.         triggerServerEvent ( "giveweapon", getLocalPlayer(), "31","350" )
  158.         outputChatBox("* Você comprou uma M4A1 por $1.900!", thePlayer )
  159.     else
  160.     outputChatBox("* Você não possui dinheiro suficiente!", thePlayer )
  161.     end
  162. end
  163.  
  164. function gSniper( thePlayer )
  165.     local money = getPlayerMoney(thePlayer)
  166.     if (money > 2499) then    
  167.         takePlayerMoney ( 2500 )          
  168.         triggerServerEvent ( "giveweapon", getLocalPlayer(), "34","200" )
  169.         outputChatBox("* Você comprou uma Sniper Rifle por $2.500!", thePlayer )
  170.     else
  171.     outputChatBox("* Você não possui dinheiro suficiente!", thePlayer )
  172.     end
  173. end
  174.  
  175. addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit )
Advertisement
Add Comment
Please, Sign In to add comment