It is currently Fri 22. Nov 2024 23:08:56

All times are UTC + 1 hour [ DST ]




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

LazyFox83
 Post subject: Oprava vsech aut (loop)
PostPosted: Wed 09. May 2012 20:18:15 
offline
Hlavní Administrátor
Hlavní Administrátor
User avatar

Joined: Thu 13. Oct 2011 18:32:25
Posts: 1625
Location: Dublin, Irsko

Admin Level: 5
Points: 1 581 548
Cash: $2 088 468
Zdravim, zde vam ukazu jak udelat opravu vsech aut pomoci loopu.
Nejdrive musime ziskat vsechny auta, to udelame pomoci
Code:
auta = getElementsByType("vehicle")

Toto nam vyvrati tabulku se vsemi auty na serveru.
Jak udelame loop? Nasledovne:
Code:
for _,vehicle in ipairs(auta) do
--Co ma vykonat pro kazde auto
end

My chceme udelat opravu, k tomu pouzijeme jednoduse fixVehicle(), tato funkce je k dispozici jak client tak server. Opravi auto tak ze vam da plny HP (oprava motoru) a opravi i viditelne poskozeni (treba rozbite dvere).
Cely kod teda vypada takto:
Code:
auta = getElementsByType("vehicle")

for _,vehicle in ipairs(auta) do
fixVehicle(vehicle)
end


Totalne jednoduchy ;)

___________________
Ten nepodstatnej hlavni admin :D
Image


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:  
TOPlist
Powered by phpBB® Forum Software © phpBB Group

©MSHost.cz