It is currently Tue 19. Mar 2024 11:13:30

All times are UTC + 1 hour [ DST ]




Post new topic  Post a reply   Page 1 of 1  [ 1 post ] 
Author Message

PostPosted: Sat 23. Mar 2013 20:29:12 
offline
'Monster Truck'
'Monster Truck'
User avatar

Joined: Sat 20. Oct 2012 11:22:39
Posts: 324
Automatická oprava auta při HP nižším než 40%

Spoiler: show
Code:
function fixCar(thePlayer) -- Funkce , nazev a jeji argumenty

local v = getPedOccupiedVehicle(thePlayer) -- Hracovo auto
local h = getElementHealth(v) -- zivot(HP) auta hrace

if v then -- Pokud existuje hrac

-- Pozn.: Zivot auta se neudava v procentech , ale v promilech. Tedy 40% = 400

 if h < 400 then -- Pokud je zivot auta mensi nez 40 %
  fixVehicle(v) -- Opravi auto

  end -- Konec podminky
 end -- Konec podminky
end -- Konec funkce

setTimer(fixCar,50,0) -- Timer(Časovač) , který každých 50 milisekund zkontroluje, a opravi auto.


Přidání libovolného upgrade do vozidla příkazem /auto [ID Upgrade]

Spoiler: show
Code:
function upgradeMyCar(thePlayer, commandName, id) -- Funkce , název a argumenty( hráč, název příkazu, id upgradu )

        if isPedInVehicle (thePlayer) then -- pokud je hráč ve vozidle
            local id = tonumber (id) -- "převede" id na to co hráč napsal (id upgradu)
            local v = getPedOccupiedVehicle (thePlayer) -- auto hráče
            local cmd = addVehicleUpgrade (v, id) -- příkaz

            if cmd then -- pokud hráč použil příkaz
                outputChatBox ("* " .. getVehicleUpgradeSlotName (id) .. " upgrade přidán.", thePlayer,0,255,30  ) -- Vypíše do chatu název přidaného upgrade
            else -- nebo
                outputChatBox ("* Chyba ve přidávání upgradu.", thePlayer,0,255,30 ) -- Vypíše do chatu
            end -- konec podminky

        else --nebo
            outputChatBox ("* Musíš být v autě!", thePlayer,0,255,30) -- Vypíše do chatu
    end -- konec podminky

end -- konec funkce
addCommandHandler ("auto", upgradeMyCar) -- přidá příkaz /auto


Vytvoření vozidla a warpnutí hráče do něj pomocí příkazu /car [ID vozidla]

Spoiler: show
Code:
function myCarWarp(thePlayer, command, vehicleModel) -- Funkce , název a argumenty

   local x,y,z = getElementPosition(thePlayer)
   local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)

        if (createdVehicle == true) then
             outputChatBox("* Vozidlo vytvořeno.",thePlayer)
             warpPedIntoVehicle(thePlayer, createdVehicle)

   if (createdVehicle == false) then
      outputChatBox("* Chyba ve vytváření vozidla",thePlayer)
   end
end
addCommandHandler("car", myCarWarp)

___________________
O spoustě hráčů a lidí jsem si říkal že jsou kokoti, dementi apod.. Tento mně dost fascinoval a zaujal hned první místo !:
Jsi debil Ingnitione ! Je mi líto, ale zaujal jsi první pozici a to na pěkně dlouho


Top
   
 
Display posts from previous:  Sort by  
Post new topic  Post a reply   Page 1 of 1  [ 1 post ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
TOPlist
Powered by phpBB® Forum Software © phpBB Group

©MSHost.cz