Jump to content

help plz


SnoopCat

Recommended Posts

i need to make a script for race that if you press a button it gives a hunter for 1 min and then u come back to the last car which function i have to use ??? can someone help me making this part for me ?? its not a script its just a part of script, but idk how to make this part :S

help me to make it plz

Link to comment

Thats how i learn: I Read the wiki, everyday i read a new page and study the exemples. This makes you intelligent. Now, here goes the functions you will need to do this ( clientSide )

guiCreateButton() 
setTimer() 
getElementData() 
setElementData() 
setElementModel() 
guiGetScreenSize() 

And the Events:

OnClientGUIClick() 
onClientResourceStart() 

And here is the page with all the vehicles ID ( https://wiki.multitheftauto.com/wiki/Vehicle_IDs )

Now. At least try, if you really can't do this by yourself i can try teach you.

Link to comment

this is the panel i have i really dont know how to finish the hunter part :S

client:

GUIEditor_Window = {} 
        GUIEditor_Button = {} 
        GUIEditor_Label = {} 
  
GUIEditor_Window[1] = guiCreateWindow(161,215,687,337,"Premium!",false) 
GUIEditor_Label[1] = guiCreateLabel(15,30,524,37,"Utiliza estas Funciones Gratuitamente",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[1],0,255,0) 
guiLabelSetVerticalAlign(GUIEditor_Label[1],"center") 
guiSetFont(GUIEditor_Label[1],"sa-header") 
GUIEditor_Button[1] = guiCreateButton(21,95,155,26,"Hunter - 1 min",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(20,127,155,26,"Humo - Todo el map",false,GUIEditor_Window[1]) 
GUIEditor_Button[3] = guiCreateButton(20,158,155,26,"Reparar",false,GUIEditor_Window[1]) 
GUIEditor_Button[4] = guiCreateButton(20,193,155,26,"Nitro",false,GUIEditor_Window[1]) 
GUIEditor_Button[5] = guiCreateButton(99,126,5,5,"",false,GUIEditor_Button[4]) 
GUIEditor_Button[6] = guiCreateButton(19,228,155,26,"Invicible",false,GUIEditor_Window[1]) 
GUIEditor_Button[7] = guiCreateButton(214,93,155,26,"Indestructible",false,GUIEditor_Window[1]) 
GUIEditor_Button[8] = guiCreateButton(217,129,155,26,"rampa",false,GUIEditor_Window[1]) 
GUIEditor_Button[9] = guiCreateButton(398,280,275,46,"Cerrar [M]",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Button[9],"sa-header") 
GUIEditor_Button[10] = guiCreateButton(218,164,155,26,"Hay",false,GUIEditor_Window[1]) 
  
  
  
  
          
        addEventHandler("onClientGUIClick",getRootElement(), 
        function () 
        if (source == GUIEditor_Button[9]) then 
        guiSetVisible ( GUIEditor_Window[1], false ) 
        showCursor(false) 
        elseif (source == GUIEditor_Button[3]) then 
        triggerServerEvent ("premiumbuyfix", getLocalPlayer()) 
        elseif (source == GUIEditor_Button[4]) then 
        triggerServerEvent ("premiumbuynitro", getLocalPlayer()) 
        elseif (source == GUIEditor_Button[2]) then 
        triggerServerEvent ("premiumbuysmoke", getLocalPlayer()) 
        elseif (source == GUIEditor_Button[8]) then 
        triggerServerEvent ("premiumbuyrampa", getLocalPlayer()) 
        elseif (source == GUIEditor_Button[6]) then 
        triggerServerEvent ("premiumbuyinvisible", getLocalPlayer()) 
        elseif (source == GUIEditor_Button[7]) then 
        triggerServerEvent ("premiumbuyindestructible", getLocalPlayer()) 
        elseif (source == GUIEditor_Button[10]) then 
        triggerServerEvent ("premiumbuyhay", getLocalPlayer()) 
                elseif (source == GUIEditor_Button[1]) then 
        triggerServerEvent ("premiumbuyhunter", getLocalPlayer()) 
           end 
        end) 
          
        addEvent("openPremiumPanel",true) 
        addEventHandler("openPremiumPanel",getRootElement(), 
        function () 
        guiSetVisible (GUIEditor_Window[1], not guiGetVisible(GUIEditor_Window[1])) 
        showCursor(not isCursorShowing()) 
        end) 

Server side :

function showPremiumPanel(thePlayer) 
        local account = getPlayerAccount(thePlayer) 
        if account then 
        local accountname = getAccountName(account) 
        if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "premium" )) then 
            triggerClientEvent (thePlayer, "openPremiumPanel", getRootElement()) 
            else 
            outputChatBox ("Premium: Accesso Denegado", thePlayer, 255, 0, 0) 
                end 
            end 
        end 
          
        addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), 
        function () 
            for index, player in ipairs ( getElementsByType ( "player" ) ) do 
            bindKey ( player, "M", "down", showPremiumPanel ) 
            end 
        end) 
          
        addEventHandler ( "onPlayerJoin", getRootElement(), 
        function () 
            bindKey ( source, "M", "down", showPremiumPanel ) 
        end) 
          
        addEventHandler ( "onResourceStop", getResourceRootElement ( getThisResource() ), 
        function () 
            for index, player in ipairs ( getElementsByType ( "player" ) ) do 
            unbindKey ( player, "M", "down", showPremiumPanel ) 
            end 
        end) 
        
       addEvent("premiumbuysmoke", true) 
addEventHandler("premiumbuysmoke", getRootElement(), 
function() 
       if isPedInVehicle(source) then 
          local x, y, z = getElementPosition( source ) 
          local car = getPedOccupiedVehicle( source ) 
          local ramp = createObject ( 2780, 0, 0, 0, 0, 0, 0 ) 
          attachElements ( ramp, car, 0, -5.255, 0, 0, 45, 118 ) 
          setElementAlpha ( ramp, 0 ) 
      outputChatBox("*Premium: "..getPlayerName(source).." Se Puso Humo",getRootElement(),0,255,0) 
            end 
        end) 
  
    addEvent("premiumbuyfix", true) 
    addEventHandler("premiumbuyfix", getRootElement(), 
       function() 
         if isPedInVehicle(source) then 
             fixVehicle( getPedOccupiedVehicle(source) ) 
             outputChatBox("*Premium: "..getPlayerName(source).." Se ha Reparado",getRootElement(),0,255,0) 
           end 
         end 
    ) 
      
    addEvent("premiumbuynitro", true) 
    addEventHandler("premiumbuynitro", getRootElement(), 
      function() 
        if isPedInVehicle(source) then 
            addVehicleUpgrade(getPedOccupiedVehicle(source),1010) 
            outputChatBox("*Premium: "..getPlayerName(source).." Se Puso Nitro",getRootElement(),0,255,0) 
            end 
      end 
    ) 
  
    addEvent("premiumbuyrampa", true) 
    addEventHandler("premiumbuyrampa", getRootElement(), 
      function() 
        if isPedInVehicle(source) then 
            targetPlayerName = getPlayerFromName ( source )  
            x, y, z = getElementPosition( source ) 
            car = getPedOccupiedVehicle( source ) 
            ramp = createObject(1634, x, y, z, 0, 0, 0) 
            attachElements(ramp, car, 0, 2, 0, 0, 0, 180) 
            outputChatBox("*premium: "..getPlayerName(source).." Se Puso una Rampa!",getRootElement(),0,255,0) 
            end 
      end 
    ) 
     
    addEvent("premiumbuyinvisible", true) 
   addEventHandler("premiumbuyinvisible", getRootElement(), 
     function() 
       if isPedInVehicle(source) then 
          setElementAlpha(getPedOccupiedVehicle(source),0) 
          setElementAlpha(source,0) 
          setPlayerNametagShowing(source, false) 
          setTimer(function() setElementAlpha(source,255) setElementAlpha(getPedOccupiedVehicle(source),255) setPlayerNametagShowing ( source, true )end,120000,1) 
          outputChatBox("*Premium: "..getPlayerName(source).." Se iso Invicible!",getRootElement(),0,255,0) 
          end 
      end 
    ) 
     
    addEvent("premiumbuyindestructible", true) 
  addEventHandler("premiumbuyindestructible", getRootElement(), 
     function() 
      if isPedInVehicle(source) then 
         setVehicleDamageProof(getPedOccupiedVehicle(source),true) 
         setTimer( setVehicleDamageProof, 60000, 1, getPedOccupiedVehicle(source), false) 
         outputChatBox("*Premium: "..getPlayerName(source).." se iso Indestructible ",getRootElement(),0,255,0) 
          end 
      end 
    ) 
     
    addEvent("premiumbuyhay", true) 
  addEventHandler("premiumbuyhay", getRootElement(), 
     function() 
      if isPedInVehicle(source) then  
        x,y,z = getElementPosition( source ) 
        setTimer(function()createObject ( 3374, x, y, z, 90, 0, 0 )end,3000,1) 
        outputChatBox("*Botando Hay en 3 Segundos!",source,0,255,0)      
        outputChatBox("*Premium: "..getPlayerName(source).." tiro un Hay!",getRootElement(),0,255,0) 
          end 
      end 
    ) 
  
  addEvent("premiumbuyhunter", true) 
    addEventHandler("premiumbuyhunter", getRootElement(), 
       function() 
        if isPedInVehicle(source) then  
--there idk what to put to create the hunter by pressing the button "premiumbuyhunter" to create hunter by 1 min and then comimng back to old car-- 
  
          attachElements ( smoke, car, 0, -5.255, 0, 0, 45, 118 )] 

Link to comment

sorry for double post but i have this for the server side for the hunter button

addEvent("premiumbuyhunter", true) 
  addEventHandler("premiumbuyhunter", getRootElement(), 
     function() 
      if isPedInVehicle(source) then 
  theVehicle = getPedOccupiedVehicle ( thePlayer )                                              
            setElementModel ( theVehicle, 425 ) 
  

Link to comment

Try with this:

addEvent("premiumbuyhunter", true) 
addEventHandler("premiumbuyhunter", getRootElement(), 
    function() 
        if isPedInVehicle(source) then 
        local theVehicle = getPedOccupiedVehicle ( source ) 
        setElementData(source,"tempVehicle",getElementModel(theVehicle)) 
        setElementModel ( theVehicle, 425 ) 
        setTimer(function (player)  
        if player then 
            local theVehicle = getPedOccupiedVehicle ( player ) 
            setElementModel(theVehicle,tonumber(getElementData(player,"tempVehicle"))) 
            end 
        end, 60000, 1, source) 
    end 
end) 

Edited by Guest
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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