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

Wysłany: 2014-09-13, 19:37


Zbyklon







Wiek: 50
Na forum: 4290 dni
Posty: 45
Nick w MP: Zbyklon

Piwa: 7

Respekt: 55,3

Witam, ostatnio bawi?em si? skryptem i utworzy?em kilka pojazd?w do SAPD, lecz nst nie wiem jak zrobi? aby pojazd dost?pny by? tylko dla ACL policja lub Team SAPD

oto fragment kodu z przyk?adowym pojazdem :

function infek1(model,x,y,zrx,ry,rznumberplatedirectionvariant1variant2)
if model and and and and rx and ry and rz then
local infek createVehicle(model,x,y,zrx,ry,rznumberplatedirectionvariant1variant2)
removeVehicleSirens(infek)
addVehicleSirens infek22truefalsetruefalse setVehicleSirens infek1, -0.7002.600, -0.50025500255255 )
setVehicleSirens infek20.7002.600, -0.50000255255255 )
setVehicleColor (infek000)
addVehicleUpgrade infek1096 )
end
end

function infek2()
infek1(41122642473.54272460942.7917623519897000"SAPDW 01"false0infek1(41122682473.54272460942.7917623519897000"SAPDW 02"false0)
infek1(4112272.52473.54272460942.7917623519897000"SAPDW 03"false0)
infek1(41122772473.54272460942.7917623519897000"SAPDW 04"false0)
infek1(4112281.252473.54272460942.7917623519897000"SAPDW 05"false0)
infek1(4112285.752473.54272460942.7917623519897000"SAPDW 06"false0)
--infek1(41122682473.54272460942.7917623519897000"SAPDW 00"false0)
end
addEventHandler('onResourceStart',getResourceRootElement(getThisResource()),infek2)


Prosz? o pomoc :>

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-13, 19:47


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

Zbyklon, nadajesz przez setElementData jakie? dane p??niej robisz na sprawdzanie czy dany pojazd ma dan? dane przypisana funkcja getElementData je?eli ma to dales sprawdzasz czy gracz kt?ry pr?buje wej?? do pojazdu (event onVehicleStartEnter ) jest/ma odpowiednie acl i team(Polecam isPlayerInTeam i isPlayerInACL ) je?eli ma to chodzi a jezeli nie to blokujesz wej?cie( funkcj? cancelEvent )

Przydatne Linki:

Więcej informacji znajdziesz w Wikipedii MTA:

setElementData


Więcej informacji znajdziesz w Wikipedii MTA:

getElementData


Więcej informacji znajdziesz w Wikipedii MTA:

onVehicleStartEnter


Więcej informacji znajdziesz w Wikipedii MTA:

isPlayerInTeam


Więcej informacji znajdziesz w Wikipedii MTA:

isPlayerInACL


Więcej informacji znajdziesz w Wikipedii MTA:

cancelEvent


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-13, 19:50


Blur







Wiek: 28
Na forum: 4298 dni
Posty: 47
Nick w MP: Blu

Piwa: 2

Respekt: 50


function infek2()
infek1(41122642473.54272460942.7917623519897000"SAPDW 01"false0infek1(41122682473.54272460942.7917623519897000"SAPDW 02"false0)
infek1(4112272.52473.54272460942.7917623519897000"SAPDW 03"false0)
infek1(41122772473.54272460942.7917623519897000"SAPDW 04"false0)
infek1(4112281.252473.54272460942.7917623519897000"SAPDW 05"false0)
infek1(4112285.752473.54272460942.7917623519897000"SAPDW 06"false0)
--infek1(41122682473.54272460942.7917623519897000"SAPDW 00"false0)
setElementData(infek1,"SAPD",true)
end
addEventHandler('onResourceStart',getResourceRootElement(getThisResource()),infek2)

enterSAPDCar = function (player,seat,jacket)
if seat == 0 then
if getElementData(source,"SAPD") == true then
if isPlayerInTeam(player,"SAPD")
else
cancelEvent()
outputChatBox("Nie jeste? pracownikiem SAPD",player,255,0,0)
end
end
end
end
addEventHandler "onVehicleStartEnter"getRootElement(), enterSAPDCar )



Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-13, 19:54


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

Blur, my pomagamy a nie robimy gotowce bo?e nic ten kole? si? nie nauczy.

[ Dodano: 2014-09-13, 19:55 ]
Blur, naucz si? ten uzywa? funkcji.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-13, 19:55


Blur







Wiek: 28
Na forum: 4298 dni
Posty: 47
Nick w MP: Blu

Piwa: 2

Respekt: 50

luki123luki123, co jest niby nie tak ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-13, 19:59


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

Blur, to isPlayerInTeam takiej funkcji nie ma w mta jest stworzona przez gracza jak by? nie wiedzia? to naucz si? bradziej lua i zapraszam do lektury: https://wiki.multitheftauto.com/wiki/IsPlayerInTeam

[ Dodano: 2014-09-13, 20:01 ]
Kolejne: setElementData(infek1,"SAPD",true) to ci nie podzia?a poniewa? seElementData przypisuje si? do element?w stworzonych na serwer a to nie jest powino by? w funkcji to :
function infek1(model,x,y,zrx,ry,rznumberplatedirectionvariant1variant2)
if model and and and and rx and ry and rz then
local infek createVehicle(model,x,y,zrx,ry,rznumberplatedirectionvariant1variant2)
removeVehicleSirens(infek)
addVehicleSirens infek22truefalsetruefalse setVehicleSirens infek1, -0.7002.600, -0.50025500255255 )
setVehicleSirens infek20.7002.600, -0.50000255255255 )
setVehicleColor (infek000)
addVehicleUpgrade infek1096 )
end
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-13, 20:05


Zbyklon







Wiek: 50
Na forum: 4290 dni
Posty: 45
Nick w MP: Zbyklon

Piwa: 7

Respekt: 55,3

OMG luki mo?na by ja?niej ? :>
Nie jestem jeszcze tak "zaawansowany" xD

Blur nst nie dzia?a :>

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-13, 20:12


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

Zbyklon, haha wiem wiem :D
Kod:
function infek1(model,x,y,zrx,ry,rznumberplatedirectionvariant1variant2)
if model and and and and rx and ry and rz then
local infek createVehicle(model,x,y,zrx,ry,rznumberplatedirectionvariant1variant2)
removeVehicleSirens(infek)
addVehicleSirens infek22truefalsetruefalse setVehicleSirens infek1, -0.7002.600, -0.50025500255255 )
setVehicleSirens infek20.7002.600, -0.50000255255255 )
setVehicleColor (infek000)
addVehicleUpgrade infek1096 )
setElementData(infek,"SAPD","tak")
end
end

function infek2()
infek1(41122642473.54272460942.7917623519897000"SAPDW 01"false0infek1(41122682473.54272460942.7917623519897000"SAPDW 02"false0)
infek1(4112272.52473.54272460942.7917623519897000"SAPDW 03"false0)
infek1(41122772473.54272460942.7917623519897000"SAPDW 04"false0)
infek1(4112281.252473.54272460942.7917623519897000"SAPDW 05"false0)
infek1(4112285.752473.54272460942.7917623519897000"SAPDW 06"false0)
--infek1(41122682473.54272460942.7917623519897000"SAPDW 00"false0)
end
addEventHandler('onResourceStart',getResourceRootElement(getThisResource()),infek2)

function isPlayerInTeam(playerteam)
    assert(isElement(player) and getElementType(player) == "player""Bad argument 1 @ isPlayerInTeam [player expected, got " .. tostring(player) .. "]")
    assert((not team) or type(team) == "string" or (isElement(team) and getElementType(team) == "team"), "Bad argument 2 @ isPlayerInTeam [nil/string/team expected, got " .. tostring(team) .. "]")
    return getPlayerTeam(player) == (type(team) == "string" and getTeamFromName(team) or (type(team) == "userdata" and team or (getPlayerTeam(player) or true)))
end

function wejdz (player,seat,jacket)
if seat == 0 then
    if getElementData(source"SAPD") == "tak" then
        if isPlayerInTeam(player,"SAPD"then
        --//Jeste? Policja
        else
        cancelEvent()
        outputChatBox("Nie jeste? pracownikiem SAPD",player,255,0,0)
        end
    else
    --//Te Auto nie jest Policyjnym    
    end
else
--//Nie chce jedz jako Kierowca    
end
end
addEventHandler('onVehicleStartEnter',"vehicle".,wejdz)

Licz? na piwko prosta z palnika ciep?utkie :D

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-13, 20:20


Zbyklon







Wiek: 50
Na forum: 4290 dni
Posty: 45
Nick w MP: Zbyklon

Piwa: 7

Respekt: 55,3

[2014-09-13 20:19] SAPD restarted successfully
[2014-09-13 20:19] ERROR: Loading script failed: SAPD/test.lua:1: unexpected symbol near '?'
[2014-09-13 20:19] SCRIPT ERROR: SAPD/test.lua:1: unexpected symbol near '?'
[2014-09-13 20:19] WARNING: Script 'SAPD/test.lua' is not encoded in UTF-8. Loading as ANSI...
[2014-09-13 20:19] Starting SAPD

Luki :< nie dzia?a xD

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-13, 20:23


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

Zbyklon, to co? u cb wklej jeszcze raz to:
function infek1(model,x,y,zrx,ry,rznumberplatedirectionvariant1variant2)
if model and and and and rx and ry and rz then
local infek createVehicle(model,x,y,zrx,ry,rznumberplatedirectionvariant1variant2)
removeVehicleSirens(infek)
addVehicleSirens infek22truefalsetruefalse setVehicleSirens infek1, -0.7002.600, -0.50025500255255 )
setVehicleSirens infek20.7002.600, -0.50000255255255 )
setVehicleColor (infek000)
addVehicleUpgrade infek1096 )
setElementData(infek,"SAPD","tak")
end
end

function infek2()
infek1(41122642473.54272460942.7917623519897000"SAPDW 01"false0infek1(41122682473.54272460942.7917623519897000"SAPDW 02"false0)
infek1(4112272.52473.54272460942.7917623519897000"SAPDW 03"false0)
infek1(41122772473.54272460942.7917623519897000"SAPDW 04"false0)
infek1(4112281.252473.54272460942.7917623519897000"SAPDW 05"false0)
infek1(4112285.752473.54272460942.7917623519897000"SAPDW 06"false0)
--infek1(41122682473.54272460942.7917623519897000"SAPDW 00"false0)
end
addEventHandler('onResourceStart',getResourceRootElement(getThisResource()),infek2)

function isPlayerInTeam(playerteam)
    assert(isElement(player) and getElementType(player) == "player""Bad argument 1 @ isPlayerInTeam [player expected, got " .. tostring(player) .. "]")
    assert((not team) or type(team) == "string" or (isElement(team) and getElementType(team) == "team"), "Bad argument 2 @ isPlayerInTeam [nil/string/team expected, got " .. tostring(team) .. "]")
    return getPlayerTeam(player) == (type(team) == "string" and getTeamFromName(team) or (type(team) == "userdata" and team or (getPlayerTeam(player) or true)))
end

function wejdz (player,seat,jacket)
if seat == 0 then
    if getElementData(source"SAPD") == "tak" then
        if isPlayerInTeam(player,"SAPD"then
        --//Jeste? Policja
        else
        cancelEvent()
        outputChatBox("Nie jeste? pracownikiem SAPD",player,255,0,0)
        end
    else
    --//Te Auto nie jest Policyjnym    
    end
else
--//Nie chce jedz jako Kierowca    
end
end
addEventHandler('onVehicleStartEnter',"vehicle".,wejdz)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-13, 20:31


Zbyklon







Wiek: 50
Na forum: 4290 dni
Posty: 45
Nick w MP: Zbyklon

Piwa: 7

Respekt: 55,3

Znalaz?em problem .. po zmianie z "jeste?" na "jestes" i usuni?ciu "." w ostatnim wersie .. pojazdy si? pojawiaj? .... lecz nie stety ka?dy poza ACL policja i team'em SAPD mo?e wej??

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-13, 20:38


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

Zbyklon, Tylko Team SAPD mo?e wejsc.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-13, 20:49


Zbyklon







Wiek: 50
Na forum: 4290 dni
Posty: 45
Nick w MP: Zbyklon

Piwa: 7

Respekt: 55,3

no w?a?nie m?wi? jestem w team Policja i ka?dy mo?e wej?? do tego pojazdu

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-13, 20:52


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

Zbyklon, tylko na g a ty na f

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-13, 21:08


Zbyklon







Wiek: 50
Na forum: 4290 dni
Posty: 45
Nick w MP: Zbyklon

Piwa: 7

Respekt: 55,3

Ka?dy, KA?DY mo?e wej?? na F ;d

Postaw piwo autorowi tego posta
 

 
Tagi: pojazdy :: acl :: team
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Pojazdy na ACL / Team 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