Wysłany: 2017-09-12, 20:01
marcin778
Krytyk serwerów MTA
Wiek: 24 Na forum: 4149 dni Posty: 2268
Nick w MP: Marcineg
Piwa : 4662
addCommandHandler ( "tech" ,function( plr , cmd , nick , value )
local accName = getAccountName ( getPlayerAccount ( plr ) )
if isObjectInACLGroup ( "user." .. accName , aclGetGroup ( "Admin" ) ) then
local gracz = getPlayerFromName ( nick )
if not gracz then outputChatBox ( "Nie ma takiego gracza." , plr ) return end
local veh = getPedOccupiedVehicle ( gracz )
if not veh then
outputChatBox ( "gracz nie ma pojazdu." , plr ) return end
local paliwo = getElementData ( veh , "paliwo" ) or 0
setElementData ( veh , "paliwo" , paliwo + tonumber ( value ))
outputChatBox ( "dodano paliwo." , plr )
end
end ) Zmie? sobie grupe acl na jaka tam chcesz i elementdate "paliwo" na swoja jaka tam masz. Komenda /tech nick ilosc
Więcej szczegółów
Wystawiono 1 piw(a):3ehud
Wysłany: 2017-09-13, 14:34
3ehud
Wiek: 31 Na forum: 3400 dni Posty: 9
Nick w MP: 3ehud
Dawid2632, dalej aktualne.
Dodano: 2017-09-13, 14:36
Marcin778, troche nie tak jak bym chcia?, chce ustawi? dowoln? ilo?? od 0 do 100, nie dodawa? paliwa.
Wysłany: 2017-09-13, 17:10
Eitho
Wiek: 24 Na forum: 3489 dni Posty: 330
Nick w MP: Eitho
Piwa : 746
"3ehud" napisał/a :Dawid2632, dalej aktualne.
Dodano: 2017-09-13, 14:36
Marcin778, troche nie tak jak bym chcia?, chce ustawi? dowoln? ilo?? od 0 do 100, nie dodawa? paliwa.
-- Autor : Eitho
-- findPlayer pochodzi z ogrpg
function findPlayer ( plr , cel )
local target = nil
if ( tonumber ( cel ) ~= nil ) then
target = getElementByID ( "p" .. cel )
else
for _ , thePlayer in ipairs ( getElementsByType ( "player" )) do
if string . find ( string . gsub ( getPlayerName ( thePlayer ): lower (), "#%x%x%x%x%x%x" , "" ), cel : lower (), 0 , true ) then
if ( target ) then
outputChatBox ( "Znaleziono wi?cej ni? jednego gracza o pasujacym nicku, podaj wi?cej liter." , plr )
return nil
end
target = thePlayer
end
end
end
if target and getElementData ( target , "p:inv" ) then return nil end
return target
end
function ustawpaliwo ( plr , cmd , cel , ilosc )
local name = getAccountName ( getPlayerAccount ( plr ))
if not isObjectInACLGroup ( "user." .. name , aclGetGroup ( "W?a?ciciel" ) ) then
outputChatBox ( "* Brak uprawnie?." , plr , 255 , 0 , 0 )
return end
if not cel or not ilosc then
outputChatBox ( "U?ycie: /" .. cmd .. " [NICK] [ILO?? PALIWA]" , plr )
return end
if tonumber ( ilosc ) < 0 then
outputChatBox ( "U?ycie: /" .. cmd .. " [NICK] [ILO?? PALIWA]" , plr )
return end
local target = findPlayer ( plr , cel )
local pojazd = getPedOccupiedVehicle ( target )
if not isPedInVehicle ( plr ) then
outputChatBox ( getPlayerName ( target ).. " #ff2222nie jest w poje?dzie!" , plr , 255 , 255 , 255 , true )
return end
setElementData ( pojazd , 'fuel' , tonumber ( ilosc ))
if tonumber ( ilosc ) == 1 then
outputChatBox ( "✔ #c4c4c4Ustawiono " .. ilosc .. " litr paliwa dla pojazdu gracza " .. getPlayerName ( target ), plr , 0 , 185 , 18 , true )
else
outputChatBox ( "✔ #c4c4c4Ustawiono " .. ilosc .. " litr?w paliwa dla pojazdu gracza " .. getPlayerName ( target ), plr , 0 , 185 , 18 , true )
end
end
addCommandHandler ( "tech" , ustawpaliwo )
Prosz?.
Tutaj masz link do Pastebina, bo GTAO nie czyta niekt?rych znak?w.
https://pastebin.com/QQqp2pnZ
Więcej szczegółów
Wystawiono 1 piw(a):3ehud
Wysłany: 2017-09-13, 17:22
marcin778
Krytyk serwerów MTA
Wiek: 24 Na forum: 4149 dni Posty: 2268
Nick w MP: Marcineg
Piwa : 4662
No to skoro dzia?a to wystarczy zmieni?
addCommandHandler ( "tech" ,function( plr , cmd , nick , value )
local accName = getAccountName ( getPlayerAccount ( plr ) )
if isObjectInACLGroup ( "user." .. accName , aclGetGroup ( "Admin" ) ) then
local gracz = getPlayerFromName ( nick )
if not gracz then outputChatBox ( "Nie ma takiego gracza." , plr ) return end
local veh = getPedOccupiedVehicle ( gracz )
if not veh then
outputChatBox ( "gracz nie ma pojazdu." , plr ) return end
if tonumber ( value ) > 0 and tonumber ( value ) < 101 then
setElementData ( veh , "paliwo" , tonumber ( value ))
outputChatBox ( "dodano paliwo." , plr )
else
outputChatBox ( "wartosc musi byc wieksza od 0 ale mniejsza od 101 0-100" , 255 , 255 , 255 , plr )
end
end
end )
Więcej szczegółów
Wystawiono 1 piw(a):3ehud
Wysłany: 2017-09-13, 18:10
3ehud
Wiek: 31 Na forum: 3400 dni Posty: 9
Nick w MP: 3ehud
Dzieki wszystkim za pomoc, nie my?la?em ?e tyle os?b po?wi?ci na to czas. Jeszcze raz dzi?ki, zachwile postawie respekt.
Dodano: 2017-09-13, 18:24
Niestety jeszcze nie mog? tego respektu postawi? bo nie mam dziesi?ciu post?w.
Tagi: skrypt :: ustawianie :: ilości :: paliwa.
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: