Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2012-06-06, 22:37


Marcin^^

Lajk a nie skrypter






Wiek: 29
Na forum: 5170 dni
Posty: 59
Nick w MP: Marcin^^

Piwa: 2

Respekt: 50

Witam, nie wiem dlaczego na SERWERZE na komputerze "LAN" nie dzia?aj? mi oto te kody:

Kod:

setTimer(function()
if not isPedDead(localPlayer) then
local hp=getElementHealth(localPlayer)
setElementHealth(localPlayer, hp-10<0 and 0 or hp-10)
end
end, 10000, 0)


Kod:

policeVehicles = { 598,596,597,599,523,522,490,528,497}
policeSkins= {280,281,282,283,284,285,286}

function enterVehicle ( player, seat, jacked )
if getElementModel(source)==policeVehicles then
if getElementModel(player)==policeSkins then
outputChatBox("Jeste? policjantem, wi?c mo?esz wchodzi?", player)
else
outputChatBox ( "Tylko policjant mo?e wsiada? do tego pojazdu!", player )
end
end
end
addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle )


Kod:

<map edf:definitions="editor_main">
<object id="pd_close" doublesided="false" model="980" interior="0" dimension="0" posX="-1531.69921875" posY="492.099609375" posZ="9" rotX="0" rotY="0" rotZ="357.98950195313"></object>
<object id="pd_open" doublesided="false" model="980" interior="0" dimension="0" posX="-1531.6999511719" posY="492.10000610352" posZ="3.2999999523163" rotX="0" rotY="0" rotZ="357.99499511719"></object>
<object id="object (vgSbikeschl02) (2)" doublesided="false" model="8229" interior="0" dimension="0" posX="-1620.5" posY="747" posZ="-3.5" rotX="0" rotY="0" rotZ="268"></object>
<object id="object (vgSbikeschl02) (3)" doublesided="false" model="8229" interior="0" dimension="0" posX="-1620.5" posY="747" posZ="0.30000001192093" rotX="0" rotY="0" rotZ="267.99499511719"></object>
</map>


Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-06-06, 23:34


Piorun







Wiek: 32
Na forum: 6712 dni
Posty: 1837
Nick w MP: Piorun

Piwa: 516

Respekt: 480,7
Respekt: 480,7

Kod:

setElementHealth(localPlayer, hp-10<0 and 0 or hp-10)

?le u?yta funkcja. W og?le podstawowy b??d, bo nie tak si? warunkuje.

Kod:

if getElementModel(source)==policeVehicles then
if getElementModel(player)==policeSkins then

Stworzy?e? tabel?, a potem zmienn? por?wnujesz do tabel. Nie tak si? robi. W og?le ja bym to zrobi? tak:

przyk?ad tabeli:
Kod:

vehicle = {
[598] = true,
[596] = true,
...
[600] = true
}


Warunek:
Kod:

if vehicle[getElementModel(source)] == true then
...
end


Podpis
Możesz mnie znaleźć na: Facebook
Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-06-06, 23:56


Marcin^^

Lajk a nie skrypter






Wiek: 29
Na forum: 5170 dni
Posty: 59
Nick w MP: Marcin^^

Piwa: 2

Respekt: 50

Kod:


Vehicle =
[598] = true,
[596] = true,
[598] = true,
[597] = true,
[523] = true,
[490] = true,
[528] = true,
[497] = true,

if vehicle[getElementModel(source)] == true then
end

policeSkins= {280,281,282,283,284,285,286}

function enterVehicle ( player, seat, jacked )
if getElementModel(source)==policeVehicles then
if getElementModel(player)==policeSkins then
outputChatBox("Jeste? policjantem, wi?c mo?esz wchodzi?", player)
else
outputChatBox ( "Tylko policjant mo?e wsiada? do tego pojazdu!", player )
end
end
end
addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle )

Taak ?
Kod:

if vehicle[getElementModel(source)] == true then


Tu nic nie zrozumia?em :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-06-07, 02:15


Piorun







Wiek: 32
Na forum: 6712 dni
Posty: 1837
Nick w MP: Piorun

Piwa: 516

Respekt: 480,7
Respekt: 480,7

Uuu .. daleka droga przed tob?. Poucz si? troch? o warunkach w funkcjach, a dopiero potem przychod? z problemami. Chodzi?o mi bardziej, ?e zamiast
Kod:

if getElementModel(source)==policeVehicles then


powinno by? tak jak napisa?em, ale widz?, ?e raczej faktycznie nie rozumiesz o co w tym wszystkich chodzi, wi?c na necie (lub na YT) poczytaj o warunkach - mo?esz poszuka? warunk?w w C++ - to w sumie to samo.

Podpis
Możesz mnie znaleźć na: Facebook
Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-06-07, 16:16


Marcin^^

Lajk a nie skrypter






Wiek: 29
Na forum: 5170 dni
Posty: 59
Nick w MP: Marcin^^

Piwa: 2

Respekt: 50

Co z tym ?
Kod:


<map edf:definitions="editor_main">
<object id="pd_close" doublesided="false" model="980" interior="0" dimension="0" posX="-1531.69921875" posY="492.099609375" posZ="9" rotX="0" rotY="0" rotZ="357.98950195313"></object>
<object id="pd_open" doublesided="false" model="980" interior="0" dimension="0" posX="-1531.6999511719" posY="492.10000610352" posZ="3.2999999523163" rotX="0" rotY="0" rotZ="357.99499511719"></object>
<object id="object (vgSbikeschl02) (2)" doublesided="false" model="8229" interior="0" dimension="0" posX="-1620.5" posY="747" posZ="-3.5" rotX="0" rotY="0" rotZ="268"></object>
<object id="object (vgSbikeschl02) (3)" doublesided="false" model="8229" interior="0" dimension="0" posX="-1620.5" posY="747" posZ="0.30000001192093" rotX="0" rotY="0" rotZ="267.99499511719"></object>
</map>


Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-06-07, 18:54


Riot

3X






Wiek: 29
Na forum: 5729 dni
Posty: 1123
Nick w MP: Riot/3X

Piwa: 286

Respekt: 123
Respekt: 123

Ale to masz w pliku .lua czy .map?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-06-12, 08:43


Wielebny







Wiek: 41
Na forum: 5499 dni
Posty: 257
Nick w MP: Wielebny

Piwa: 1690

Respekt: 180
Respekt: 180Respekt: 180

"Pioruniasty" napisał/a:

Kod:

setElementHealth(localPlayer, hp-10<0 and 0 or hp-10)

?le u?yta funkcja. W og?le podstawowy b??d, bo nie tak si? warunkuje.


Pioruniasty, wszystko jest prawid?owo - to prawidlowa kostrukcja w Lua: warunek and prawda or fa?sz.

Ustawi HP gracza na o 10 mniejszy, chyba ?e mia?by wyj?? ujemny - wtedy ustawi
0.

Postaw piwo autorowi tego posta
 

 
Tagi: analiza :: kodów
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku