Jump to content

السلام عليكم في عندي شوية طلبات الله يخليكم


Recommended Posts

طلبي الاول هو بدي اعمل بركة فيها ماء بس المشكلة انه انا مش فاهم كيف هذا السكربت فيا ريت مثال عددي عليه في grove street

-- Setting water properties. 
height = 40 
SizeVal = 2998 
-- Defining variables. 
southWest_X = -SizeVal 
southWest_Y = -SizeVal 
southEast_X = SizeVal 
southEast_Y = -SizeVal 
northWest_X = -SizeVal 
northWest_Y = SizeVal 
northEast_X = SizeVal 
northEast_Y = SizeVal 
  
-- OnClientResourceStart function that creates the water. 
function thaResourceStarting( ) 
    water = createWater ( southWest_X, southWest_Y, height, southEast_X, southEast_Y, height, northWest_X, northWest_Y, height, northEast_X, northEast_Y, height ) 
    setWaterLevel ( height ) 
end 
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), thaResourceStarting) 

طلبي الثاني هو انه هذا الملف بقوم على تدمير السيارة وتفجيرها بس انا بدي اياه زي كيف في الادمن بنل بس شوخذ سيارة اللاعب من دون تفجير

الملفات

server

addEvent ("carSpawn", true) 
addEvent ("carDestroy", true) 
  
  
function carSpawn () 
  if not (isGuestAccount (getPlayerAccount (source))) and not (isPedInVehicle(source)) then 
    if (getElementData (source, "hisCar")) and (getElementData (source, "hisCar") ~= nil) and (getElementType(getElementData (source, "hisCar")) == "vehicle") then 
      setElementVelocity (getElementData (source, "hisCar"), 0,0,0) 
      local x,y,z = getElementPosition (source) 
      setVehicleRotation (getElementData (source, "hisCar"), 0, 0, 0) 
      setElementPosition (getElementData (source, "hisCar"), x+2,y,z +1) 
      outputChatBox ("Car spawned.", source, 255, 0, 0) 
    elseif not (getElementData (source, "hisCar")) then 
      local accountData = getAccountData (getPlayerAccount (source), "funmodev2-car") 
      if (accountData) then 
        carID = getAccountData (getPlayerAccount (source), "funmodev2-car") 
        x,y,z = getElementPosition (source) 
        vehicle = createVehicle (carID, x +2, y, z +1) 
        setElementID (vehicle, getAccountName (getPlayerAccount(source))) 
        setElementData (source, "hisCar", vehicle) 
        outputChatBox ("Car spawned.", source, 255, 0, 0) 
        if (getAccountData (getPlayerAccount(source), "funmodev2-carupg")) then 
          local upgrades = nil 
          local upgrades = {} 
          local upgrades = getAccountData (getPlayerAccount(source), "funmodev2-carupg") 
          for i,v in ipairs (upgrades) do 
            addVehicleUpgrade (vehicle, v) 
          end 
        end 
        if (getAccountData (getPlayerAccount(source), "funmodev2-paintjob")) then 
          local paintjob = getAccountData (getPlayerAccount(source), "funmodev2-paintjob") 
          setVehiclePaintjob (vehicle, paintjob) 
        end 
        if (getAccountData (getPlayerAccount(source), "funmodev2-carcolor1")) and (getAccountData (getPlayerAccount(source), "funmodev2-carcolor2")) then 
          local c1 = getAccountData (getPlayerAccount(source), "funmodev2-carcolor1") 
          local c2 = getAccountData (getPlayerAccount(source), "funmodev2-carcolor2") 
          setVehicleColor (vehicle, c1,c2,0,0) 
        end 
      else 
        outputChatBox ("You haven't got a car.", source, 255, 0, 0) 
      end 
    else 
      outputChatBox ("You're already in a car!", source, 255, 0, 0) 
    end 
  end 
end 
addEventHandler ("carSpawn", getRootElement(), carSpawn) 
  
function carDestroy ()  
  if  not (isGuestAccount (getPlayerAccount (source))) then 
    if (isPedInVehicle (source)) then 
      if (getElementID(getPedOccupiedVehicle(source)) == getAccountName (getPlayerAccount(source))) then 
        setElementHealth (getElementData (source, "hisCar"), 0) 
        destroyElement (getPedOccupiedVehicle (source)) 
        removeElementData (source, "hisCar") 
        outputChatBox ("Car Destroyed.", source, 255, 0, 0) 
      else 
        outputChatBox ("This not your car!", source, 255, 0, 0) 
      end 
    elseif (not (isPedInVehicle (source))) and (getElementData (source, "hisCar")) and (getElementData (source, "hisCar") ~= nil) then 
      setElementHealth (getElementData (source, "hisCar"), 0) 
      outputChatBox ("Car Destroyed.", source, 255, 0, 0) 
      removeElementData (source, "hisCar") 
    end 
  end 
end 
addEventHandler ("carDestroy", getRootElement(), carDestroy) 
  
addEventHandler ("onVehicleExplode", getRootElement(),  
function() 
  local theOwner = getAccountName (getPlayerAccount(getPlayerFromName (getElementID (source)))) 
  if (theOwner) then 
    removeElementData (theOwner, "hisCar") 
  end 
end) 
  
addEventHandler ("onPlayerQuit", getRootElement(),  
function(quitType, reason, responsibleElement) 
  if (getElementData (source, "hisCar")) then 
    blowVehicle (getElementData (source, "hisCar")) 
    removeElementData (source, "hisCar") 
  end 
end) 
  
addEventHandler( "onResourceStop", getResourceRootElement( getThisResource() ), 
    function () 
        for i,v in ipairs (getElementsByType ("player")) do 
            if (getElementData (v, "hisCar")) then 
                setElementHealth (getElementData (v, "hisCar"), 0) 
                removeElementData (v, "hisCar") 
            end 
        end 
    end 
) 
  
function destroyOnExplode () 
    setTimer (destroyElement, 2500, 1, source) 
end 
addEventHandler ("onVehicleExplode", getRootElement(), destroyOnExplode) 
  
  

client

GUIEditor_Label = {} 
  
theWindow = guiCreateWindow(600,200,200,70,"Car Features",false) 
guiWindowSetSizable(theWindow,false) 
guiSetVisible (theWindow, false) 
guiLabelSetHorizontalAlign(GUIEditor_Label[1],"left",false) 
guiSetFont(GUIEditor_Label[1],"default-bold-small") 
spawnBut = guiCreateButton(0.0604,0.320,0.4,0.6,"Spawn",true,theWindow) 
destroyBut = guiCreateButton(0.490,0.320,0.4,0.6,"Destroy",false,theWindow) 
function resourceStart () 
  bindKey ("F3", "down", menuShow) 
end 
addEventHandler ("onClientResourceStart", getResourceRootElement ( getThisResource () ), resourceStart) 
  
function menuShow () 
    visableornot = guiGetVisible (theWindow) 
    if (visableornot == true) then 
        guiSetVisible (theWindow, false) 
        showCursor (false) 
    end 
    if (visableornot == false) then 
        guiSetVisible (theWindow, true) 
        showCursor (true) 
    end 
end 
  
addEvent ("carSpawn", true) 
addEvent ("carDestroy", true) 
  
function guiClick (button, state, absoluteX, absoluteY) 
  if (source == spawnBut) then 
    triggerServerEvent ("carSpawn", getLocalPlayer()) 
  elseif (source == destroyBut) then 
    triggerServerEvent ("carDestroy", getLocalPlayer()) 
  end 
end 
addEventHandler ("onClientGUIClick", getRootElement(), guiClick) 
  

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