Wysłany: 2020-06-02, 01:34
matimevor
Wiek: 26 Na forum: 2194 dni Posty: 7
Nick w MP: imevor
Witam, chcia?bym aby ten kod sprawdza? czy dany gracz jest w grupie acl "Admin"
Kod:
playerAcc = getPlayerAccount(source)
if isObjectInACLGroup("user."..getAccountName(playerAcc), aclGetGroup("Admin")) then
W tym kodzie, nie wiem od czego zale?y jego miejsce i gdzie go wstawi? w ten aktualny... my?l? ju? nad tym dwa dni i dalej nie wiem
addCommandHandler ( "sp" , function( gracz , cmd , auto )
local model = getVehicleModelFromName ( auto )
local x , y , z = getElementPosition ( gracz )
local rx , ry , rz = getElementRotation ( gracz )
local dimension = getElementDimension ( gracz )
local interior = getElementInterior ( gracz )
if not model then
outputChatBox ( "Wpisz: /sp <model pojazdu> Przyk?ad: /sp bullet" , gracz , 255 , 255 , 255 , true )
else
local pojazd = createVehicle ( model , x , y , z , rx , ry , rz )
setElementDimension ( pojazd , dimension )
setElementInterior ( pojazd , interior )
setElementData ( pojazd , "KtoZrespilAuto" , getPlayerName ( gracz ))
setVehiclePlateText ( pojazd , "EasyLifeRPG" )
warpPedIntoVehicle ( gracz , pojazd )
end
end )
addCommandHandler ( "spu" , function( gracz )
for i , v in ipairs ( getElementsByType ( "vehicle" )) do
if getElementData ( v , "KtoZrespilAuto" ) == getPlayerName ( gracz ) then
destroyElement ( v )
end
end
end )
Oczywi?cie daje zimne piwko! Mam nadziej?, ?e pisze w dobrym dziale, a je?eli nie to bardzo przepraszam, ale jestem nowy
[ Dodano : 2020-06-02, 06:46 ]
Podbijam, mo?e kto? zoabczy.
Wysłany: 2020-06-02, 08:13
Wilq
Wiek: 24 Na forum: 4429 dni Posty: 3410
Piwa : 739
M?wi?c po ludzku, kod wykonuje si? od g?ry do do?u.
Weryfikacja uprawnie? musi by? wi?c przed ca?ym kodem wykonuj?cym si? - czyli na pocz?tku, zaraz pod funkcj? "addCommandHandler".
Więcej szczegółów
Wystawiono 1 piw(a):matimevor
Wysłany: 2020-06-02, 19:44
matimevor
Wiek: 26 Na forum: 2194 dni Posty: 7
Nick w MP: imevor
Dobra, a m?g?by? mi to wklepa? w kod? wklepa?em to tak ale nie dzia?a.
addCommandHandler ( "sp" , function( gracz , cmd , auto )
playerAcc = getPlayerAccount ( source )
if isObjectInACLGroup ( "user." .. getAccountName ( playerAcc ), aclGetGroup ( "Admin" )) then
local model = getVehicleModelFromName ( auto )
local x , y , z = getElementPosition ( gracz )
local rx , ry , rz = getElementRotation ( gracz )
local dimension = getElementDimension ( gracz )
local interior = getElementInterior ( gracz )
if not model then
outputChatBox ( "Wpisz: /sp <model pojazdu> Przyk?ad: /sp elegy" , gracz , 255 , 255 , 255 , true )
else
local pojazd = createVehicle ( model , x , y , z , rx , ry , rz )
setElementDimension ( pojazd , dimension )
setElementInterior ( pojazd , interior )
setElementData ( pojazd , "KtoZrespilAuto" , getPlayerName ( gracz ))
setVehiclePlateText ( pojazd , "EasyLifeRPG" )
warpPedIntoVehicle ( gracz , pojazd )
end
end )
addCommandHandler ( "spu" , function( gracz )
for i , v in ipairs ( getElementsByType ( "vehicle" )) do
if getElementData ( v , "KtoZrespilAuto" ) == getPlayerName ( gracz ) then
destroyElement ( v )
end
end
end )
[ Dodano : 2020-06-02, 20:31 ]
podbijam
Wysłany: 2020-06-02, 21:11
adaskOO
Ten który patrzy
Wiek: 24 Na forum: 3732 dni Posty: 249
Nick w MP: adaskOO
Piwa : 3168
Dzia?a?
addCommandHandler ( "sp" , function( gracz , cmd , auto )
playerAcc = getPlayerAccount ( gracz )
if isObjectInACLGroup ( "user." .. getAccountName ( playerAcc ), aclGetGroup ( "Admin" )) then
local model = getVehicleModelFromName ( auto )
local x , y , z = getElementPosition ( gracz )
local rx , ry , rz = getElementRotation ( gracz )
local dimension = getElementDimension ( gracz )
local interior = getElementInterior ( gracz )
if not model then
outputChatBox ( "Wpisz: /sp <model pojazdu> Przyk?ad: /sp elegy" , gracz , 255 , 255 , 255 , true )
else
local pojazd = createVehicle ( model , x , y , z , rx , ry , rz )
setElementDimension ( pojazd , dimension )
setElementInterior ( pojazd , interior )
setElementData ( pojazd , "KtoZrespilAuto" , getPlayerName ( gracz ))
setVehiclePlateText ( pojazd , "EasyLifeRPG" )
warpPedIntoVehicle ( gracz , pojazd )
end
end
end )
addCommandHandler ( "spu" , function( gracz )
for i , v in ipairs ( getElementsByType ( "vehicle" )) do
if getElementData ( v , "KtoZrespilAuto" ) == getPlayerName ( gracz ) then
destroyElement ( v )
end
end
end )
Więcej szczegółów
Wystawiono 1 piw(a):matimevor
Wysłany: 2020-06-02, 22:09
matimevor
Wiek: 26 Na forum: 2194 dni Posty: 7
Nick w MP: imevor
Dzia?a dzi?kuje bardzo! Zimne piwka postawione!
[ Dodano : 2020-06-02, 22:09 ]
[ Dodano : 2020-06-02, 22:26 ]
Dobra, a jakbym chcia? to w innym kodzie, to od czego zale?y?
[ Dodano : 2020-06-02, 22:27 ]
Chodzi mi na przyk?ad o taki kod.
function toggleInvis ( localPlayer )
playerAcc = getPlayerAccount ( source )
if isObjectInACLGroup ( "user." .. getAccountName ( playerAcc ), aclGetGroup ( "Admin" )) then
if ( getElementAlpha ( localPlayer )> 0 ) then
setElementAlpha ( localPlayer , 0 )
else
setElementAlpha ( localPlayer , 255 )
end
end
end
addCommandHandler ( "inv" , toggleInvis )
Albo o taki..
addCommandHandler ( "gp" ,function()
playerAcc = getPlayerAccount ( source )
if isObjectInACLGroup ( "user." .. getAccountName ( playerAcc ), aclGetGroup ( "Admin" )) then
local x , y , z = getElementPosition ( localPlayer )
local _ , _ , a = getElementRotation ( localPlayer )
p = string . format ( "%.2f, %.2f, %.2f" , x , y , z )
setClipboard ( p )
outputChatBox ( "GP: " .. p )
local veh = getPedOccupiedVehicle ( localPlayer )
if veh then
local x , y , z = getElementPosition ( veh )
local rx , ry , rz = getElementRotation ( veh )
p = string . format ( "%.2f, %.2f, %.2f, %.1f, %.1f, %.1f" , x , y , z , rx , ry , rz )
setClipboard ( p )
outputChatBox ( "GPV: " .. p )
end
end )
Wysłany: 2020-06-03, 11:23
Wilq
Wiek: 24 Na forum: 4429 dni Posty: 3410
Piwa : 739
Ka?dy warunek sprawdzaj?cy (if ...) musi by? zako?czony endem. Radz? czyta? b??dy spod /debugscript 3, poniewa? tam masz WSZYSTKO.
Wysłany: 2020-06-03, 17:30
adaskOO
Ten który patrzy
Wiek: 24 Na forum: 3732 dni Posty: 249
Nick w MP: adaskOO
Piwa : 3168
Musi by? end aczkolwiek je?eli nie wiesz jak to robi? po prostu wklejaj na pocz?tku funkcji:
playerAcc = getPlayerAccount ( source )
if isObjectInACLGroup ( "user." .. getAccountName ( playerAcc ), aclGetGroup ( "Admin" )) then else return end
Wysłany: 2020-06-04, 20:49
MrVip615
witam
Wiek: 22 Na forum: 4307 dni Posty: 167
Nick w MP: ramzes
Piwa : 207
"adaskOO" napisał/a :Musi by? end aczkolwiek je?eli nie wiesz jak to robi? po prostu wklejaj na pocz?tku funkcji:
playerAcc = getPlayerAccount ( source )
if isObjectInACLGroup ( "user." .. getAccountName ( playerAcc ), aclGetGroup ( "Admin" )) then else return end
Raczej to powinien wklejac
playerAcc = getPlayerAccount ( source )
if not isObjectInACLGroup ( "user." .. getAccountName ( playerAcc ), aclGetGroup ( "Admin" )) then return false end
Wysłany: 2020-06-05, 23:03
adaskOO
Ten który patrzy
Wiek: 24 Na forum: 3732 dni Posty: 249
Nick w MP: adaskOO
Piwa : 3168
MrVip615 , Od zawsze u?ywam mojej wersji i nie widz? r??nicy pomi?dzy zwr?ceniem false a od razu wpisywaniem end i warunek spe?nia? swoj? role. No chyba, ?e to co? zmienia ale naprawd? do teraz nie zauwa?y?em r??nicy..
albo po prostu te? spe?nia role..
playerAcc = getPlayerAccount ( source )
if not isObjectInACLGroup ( "user." .. getAccountName ( playerAcc ), aclGetGroup ( "Admin" )) then return end
Wysłany: 2020-06-06, 22:11
PatryKK.
Emeryt LUA
Wiek: 26 Na forum: 3061 dni Posty: 1060
Nick w MP: PatryKK.
Piwa : 2322
Obie wersje s? poprawne co do kodu
playerAcc = getPlayerAccount ( source )
if not isObjectInACLGroup ( "user." .. getAccountName ( playerAcc ), aclGetGroup ( "Admin" )) then return false end
po prostu definiujesz warto?? false
playerAcc = getPlayerAccount ( source )
if not isObjectInACLGroup ( "user." .. getAccountName ( playerAcc ), aclGetGroup ( "Admin" )) then return end
zwracasz na nowo zapytanie do klienta b?d? serwera
Tagi: wyjaśnienie :: którą :: część :: kodu
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: