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

Wysłany: 2015-12-06, 15:48


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4330 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

Pomocy robie prace kosiarek i mam blad bo kazdemu respi sie marker jak ktos prace rozpocznie !! !

local rozpocznijkosiarki createMarker(239.86,1033.41,24.28,"cylinder",2.0,0,255,0,255)

punkty = {
 {262.129699707031050.281860351621.993144989014},
 {264.084564208981073.967163085917.064970016479},
 {278.783966064451072.075805664117.635766983032},
 {277.539947509771048.641113281322.602624893188},
 {262.082641601561040.504394531324.127019882202},
 {244.196746826171061.083129882818.712356567383},
 {247.594070434571085.667724609414.979658126831},
 {271.544677734381091.422119140613.475341796875},
 {261.130676269531077.420410156316.51665687561},
}

function celresp (player)
local pkt punkty[math.random(1#punkty)] 
cel createMarker(pkt[1], pkt[2], pkt[3], "checkpoint",4.012322556150,playerblip createBlipAttachedTo(cel41,2,255,0,0,255,0,99999.0,player)
function wjechal (player)
local money math.random(5,15)
destroyElement(cel)
destroyElement(blip)
givePlayerMoney(player,money)
celresp()
end
addEventHandler("onMarkerHit",cel,wjechal)
end


addEventHandler("onMarkerHit",rozpocznijkosiarki,function(player)
local kosiarka createVehicle(572,240.46,1038.46,23.85,346.9,356.7,356.0)
setElementData(kosiarka,"pojazd_wyjdz",true)
setElementData(kosiarka,"pojazd_paliwo",math.random(20,50))
setElementData(kosiarka,"pojazd_opis","Praca Dorywcza\nKoszenie Trawnikow")
warpPedIntoVehicle(player,kosiarka)
celresp()
end)

function usun_pojazd (playerseat)
        if seat == 0 then
        kosiarka getPedOccupiedVehicle (player)
        kosiarka1 getElementData (kosiarka"pojazd_wyjdz")
        if kosiarka1 then
        outputChatBox  ("Skonczyles prace ",player,0,200,0)
        destroyElement (kosiarka)
        destroyElement (blip)
        destroyElement (cel)
        else return end
        end
        end
        addEventHandler ("onVehicleStartExit"getRootElement(), usun_pojazd)
        setTimer(usun_pojazd1200,1,"")

function koniec (player,seat)
destroyElement (kosiarka)
destroyElement (blip)
destroyElement (cel)
end
addEventHandler("onPlayerQuit",getRootElement(),koniec)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-12-06, 15:56


serek123

Lua, MySql, Sql






Wiek: 27
Na forum: 4334 dni
Posty: 217
Nick w MP: Serek.

Piwa: 374

Respekt: 70

zamiast player spr?buj da? source

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-12-06, 16:25


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4330 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

Nie dzia?a.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-12-06, 16:38


Gpla

Loading...






Wiek: 26
Na forum: 3853 dni
Posty: 84
Nick w MP: Loading...

Piwa: 174

Respekt: 55,3

zmie? player na localplayer

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-12-06, 16:47


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4330 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

Nie dziala

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-12-06, 17:17


Jeey

Lua, Grafik






Wiek: 27
Na forum: 4339 dni
Posty: 98
Nick w MP: Jeey

Piwa: 383

Respekt: 80

Ostrzeżeń: 100%
po jakiej to stronie da?e??

[ Dodano: 2015-12-06, 17:18 ]
i dodaj
if el ~= localPlayer then return end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-12-06, 17:28


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4330 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

server

[ Dodano: 2015-12-06, 17:39 ]
nie dziala

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-12-06, 19:27


DamianGames







Wiek: 23
Na forum: 3946 dni
Posty: 75

Piwa: 521

Respekt: 31,5

Ostrzeżeń: 60%

local rozpocznijkosiarki createMarker(239.86,1033.41,24.28,"cylinder",2.0,0,255,0,255)

punkty = {
 {262.129699707031050.281860351621.993144989014},
 {264.084564208981073.967163085917.064970016479},
 {278.783966064451072.075805664117.635766983032},
 {277.539947509771048.641113281322.602624893188},
 {262.082641601561040.504394531324.127019882202},
 {244.196746826171061.083129882818.712356567383},
 {247.594070434571085.667724609414.979658126831},
 {271.544677734381091.422119140613.475341796875},
 {261.130676269531077.420410156316.51665687561},
}

function celresp (player)
local pkt punkty[math.random(1#punkty)] 
cel createMarker(pkt[1], pkt[2], pkt[3], "checkpoint",4.012322556150,thePlayerblip createBlipAttachedTo(cel41,2,255,0,0,255,0,99999.0,thePlayer)
function wjechal (thePlayer)
local money math.random(5,15)
destroyElement(cel)
destroyElement(blip)
givePlayerMoney(thePlayer,money)
celresp()
end
addEventHandler("onMarkerHit",cel,wjechal)
end


addEventHandler("onMarkerHit",rozpocznijkosiarki,function(player)
local kosiarka createVehicle(572,240.46,1038.46,23.85,346.9,356.7,356.0)
setElementData(kosiarka,"pojazd_wyjdz",true)
setElementData(kosiarka,"pojazd_paliwo",math.random(20,50))
setElementData(kosiarka,"pojazd_opis","Praca DorywczanKoszenie Trawnikow")
warpPedIntoVehicle(player,kosiarka)
celresp()
end)

function usun_pojazd (thePlayerseat)
        if seat == 0 then
        kosiarka getPedOccupiedVehicle (thePlayer)
        kosiarka1 getElementData (kosiarka"pojazd_wyjdz")
        if kosiarka1 then
        outputChatBox  ("Skonczyles prace ",thePlayer,0,200,0)
        destroyElement (kosiarka)
        destroyElement (blip)
        destroyElement (cel)
        else return end
        end
        end
        addEventHandler ("onVehicleStartExit"getRootElement(), usun_pojazd)
        setTimer(usun_pojazd1200,1)

function koniec (thePlayer,seat)
destroyElement (kosiarka)
destroyElement (blip)
destroyElement (cel)
end
addEventHandler("onPlayerQuit",getRootElement(),koniec)


Zobacz teraz ;D

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-12-06, 19:39


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4330 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157


local rozpocznijkosiarki createMarker(239.86,1033.41,24.28,"cylinder",2.0,0,255,0,255)

punkty = {
 {262.129699707031050.281860351621.993144989014},
 {264.084564208981073.967163085917.064970016479},
 {278.783966064451072.075805664117.635766983032},
 {277.539947509771048.641113281322.602624893188},
 {262.082641601561040.504394531324.127019882202},
 {244.196746826171061.083129882818.712356567383},
 {247.594070434571085.667724609414.979658126831},
 {271.544677734381091.422119140613.475341796875},
 {261.130676269531077.420410156316.51665687561},
}

function celresp (thePlayer)
local pkt punkty[math.random(1#punkty)] 
cel createMarker(pkt[1], pkt[2], pkt[3], "checkpoint",112322556150,thePlayerblip createBlipAttachedTo(cel41,2,255,0,0,255,0,99999.0,thePlayer)
function wjechal (thePlayer)
local money math.random(5,8)
destroyElement(cel)
destroyElement(blip)
givePlayerMoney(thePlayer,money)
celresp(thePlayer)
end
addEventHandler("onMarkerHit",cel,wjechal)
end


addEventHandler("onMarkerHit",rozpocznijkosiarki,function(thePlayer)
local kosiarka createVehicle(572,240.46,1038.46,23.85,346.9,356.7,356.0)
setElementData(kosiarka,"pojazd_wyjdz",true)
setElementData(kosiarka,"pojazd_paliwo",math.random(20,50))
setElementData(kosiarka,"pojazd_opis","Praca Dorywcza\nKoszenie Trawnikow")
warpPedIntoVehicle(thePlayer,kosiarka)
celresp(thePlayer)
end)

function usun_pojazd (thePlayerseat)
        if seat == 0 then
        kosiarka getPedOccupiedVehicle (thePlayer)
        kosiarka1 getElementData (kosiarka"pojazd_wyjdz")
        if kosiarka1 then
        outputChatBox  ("Skonczyles prace ",thePlayer,0,200,0)
        destroyElement (kosiarka)
        destroyElement (blip)
        destroyElement (cel)
        else return end
        end
        end
        addEventHandler ("onVehicleStartExit"getRootElement(), usun_pojazd)
        setTimer(usun_pojazd1200,1)

function koniec (thePlayer,seat)
destroyElement (kosiarka)
destroyElement (blip)
destroyElement (cel)
end
addEventHandler("onPlayerQuit",getRootElement(),koniec)
Nie dziala

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-12-06, 19:39


Jeey

Lua, Grafik






Wiek: 27
Na forum: 4339 dni
Posty: 98
Nick w MP: Jeey

Piwa: 383

Respekt: 80

Ostrzeżeń: 100%
je?eli chcesz ?eby ty to widzial a inni gracze nie to daj po stronie client

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-12-06, 19:43


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4330 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

ale to da rade na serverze zrobic !

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-12-06, 19:45


DamianGames







Wiek: 23
Na forum: 3946 dni
Posty: 75

Piwa: 521

Respekt: 31,5

Ostrzeżeń: 60%
"BlackTen" napisał/a:

ale to da rade na serverze zrobic !


To prawda ale tw?j skrypt korzysta z funkcji kt?re s? po stronie Clienta wi?c one nie b?d? dzia?a? na s-side u?yj skryptu kt?ry ci poda?em na c-side i powied? czy dzia?a ;D

Lub na swoim na pocz?tku dodaj

local player thePlayer



;D

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-12-06, 20:07


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4838 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3


Więcej informacji znajdziesz w Wikipedii MTA:

setElementVisibleTo



Je?eli co? robisz na server side widoczne dla jednego gracza, to u?yj tego co wy?ej poda?em.

Wiele os?b twierdzi, ?e lepiej jest pisa? na c-side, no niby tak, ale zdarza si?, ?e kto? potrafi uruchomi? sw?j kod na client-side i wtedy mo?e sobie wywolac trigger z server-side ( je?eli taki stworzylismy ) do dawania kasy, namno?y sobie hajsu i elo.

Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-12-06, 20:30


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4330 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

Wszystko ok ale nie usuwa markera jak wyjde z pojazdu:

c-side

local rozpocznijkosiarki createMarker(239.86,1033.41,24.28,"cylinder",2.0,0,255,0,255)

punkty = {
 {262.129699707031050.281860351621.993144989014},
 {264.084564208981073.967163085917.064970016479},
 {278.783966064451072.075805664117.635766983032},
 {277.539947509771048.641113281322.602624893188},
 {262.082641601561040.504394531324.127019882202},
 {244.196746826171061.083129882818.712356567383},
 {247.594070434571085.667724609414.979658126831},
 {271.544677734381091.422119140613.475341796875},
 {261.130676269531077.420410156316.51665687561},
}

function celresp (player)
local pkt punkty[math.random(1#punkty)] 
cel createMarker(pkt[1], pkt[2], pkt[3], "checkpoint",4.012322556150,thePlayerblip createBlipAttachedTo(cel41,2,255,0,0,255,0,99999.0,thePlayer)
function wjechal (thePlayer)
local money math.random(5,15)
destroyElement(cel)
destroyElement(blip)
triggerServerEvent("givePlayerMoney",thePlayer,3,0)
celresp()
end
function usun_pojazd ()
destroyElement(cel)
destroyElement(blip)
end
addEventHandler ("usunkosiarki"rootusun_pojazd)
addEvent("usunkosiarki",true)     
addEventHandler("onClientMarkerHit",cel,wjechal)
end


addEventHandler("onClientMarkerHit",rozpocznijkosiarki,function(player)
triggerServerEvent("autorespkosiarki",getRootElement(),localPlayer)
celresp()
end)


s-side
addEvent("autorespkosiarki",true)
addEventHandler("autorespkosiarki",root,function(player)
local kosiarka createVehicle(572,240.46,1038.46,23.85,346.9,356.7,356.0)
setElementData(kosiarka,"pojazd_wyjdz",true)
setElementData(kosiarka,"pojazd_paliwo",math.random(20,50))
setElementData(kosiarka,"pojazd_opis","Praca Dorywcza\nKoszenie Trawnikow")
warpPedIntoVehicle(player,kosiarka)
function skonczyl (thePlayer,seat)
        if seat == 0 then
        kosiarka getPedOccupiedVehicle (thePlayer)
        kosiarka1 getElementData (kosiarka"pojazd_wyjdz")
        if kosiarka1 then
        outputChatBox  ("Skonczyles prace ",thePlayer,0,200,0)
        destroyElement (kosiarka)
        triggerClientEvent(thePlayer,"usunkosiarki",root)
        else return end
        end
        end
addEventHandler("onVehicleStartExit",root,skonczyl)
setTimer(skonczyl,50,1)
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-12-06, 20:43


DamianGames







Wiek: 23
Na forum: 3946 dni
Posty: 75

Piwa: 521

Respekt: 31,5

Ostrzeżeń: 60%
s-side

addEvent("autorespkosiarki",true)
addEventHandler("autorespkosiarki",root,function(player)
local kosiarka createVehicle(572,240.46,1038.46,23.85,346.9,356.7,356.0)
setElementData(kosiarka,"pojazd_wyjdz",true)
setElementData(kosiarka,"pojazd_paliwo",math.random(20,50))
setElementData(kosiarka,"pojazd_opis","Praca Dorywcza\nKoszenie Trawnikow")
warpPedIntoVehicle(player,kosiarka)
function skonczyl (thePlayer,seat)
        if seat == 0 then
        kosiarka getPedOccupiedVehicle (thePlayer)
        kosiarka1 getElementData (kosiarka"pojazd_wyjdz")
        if kosiarka1 then
        outputChatBox  ("Skonczyles prace ",thePlayer,0,200,0)
        destroyElement (kosiarka)
        destroyElement (cel)
        destroyElement (blip)
        triggerClientEvent(thePlayer,"usunkosiarki",root)
        else return end
        end
        end
addEventHandler("onVehicleStartExit",root,skonczyl)
setTimer(skonczyl,50,1)
end)



Zobacz ;D

Postaw piwo autorowi tego posta
 

 
Tagi: kosiarki
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