Wysłany: 2016-01-09, 21:05
Shorn
Wariat lua
Wiek: 28 Na forum: 3884 dni Posty: 41
Nick w MP: Szorn
Piwa : 537
Siemanko, gtaonline.pl pisa?em ostatnio skrypt na prywatne pojazdy, ale niestety wyskakuj? bug i nie wiem jak go naprawi?. Mianowicie chodzi o to, ?e gdy zarejestruj pojazd wy?wietla si? napis ka?demu graczowi "ZAREJESTROWANE", licze na wasz? pomoc !
Kod: function wsiadanie ( player, seat, jacked )
if seat == 0 then
kierowca = getVehicleOccupant ( source, 0 )
if getPlayerName (kierowca) ~= getPlayerName ( player ) then
cancelEvent() return end
local name = getPlayerName ( source )
if getElementData(source, "prywatne") then
local accName = getAccountName ( getPlayerAccount ( player ) )
if getElementData(source, "wlasciciel") == getAccountName(getPlayerAccount(player)) or isObjectInACLGroup ("user."..accName, aclGetGroup ( "Urzad" ) ) then
else
cancelEvent()
co = getPedOccupiedVehicle ( player )
nazwa = getVehicleName ( co )
owner2 = getElementData ( co, "wlasciciel" )
outputChatBox ("Nie posiadasz kluczy do tego pajazu.", player)
end
end
end
end
addEventHandler ( "onVehicleStartEnter", getRootElement(), wsiadanie )
function wlasciciel ( player, cmd, owner )
local accName = getAccountName ( getPlayerAccount ( player ) )
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Urzad" ) ) then
local auto = getPedOccupiedVehicle ( player )
wlasciciel = partName ( plr, owner )
if wlasciciel then
name = getPlayerName ( wlasciciel )
setElementData(auto, "prywatne", true)
setElementData(auto, "wlasciciel", name)
outputChatBox ( "ZAREJESTROWANE", plr )
else
end
end
end
addCommandHandler("zarejestruj", wlasciciel )
function partName(plr,cel)
local target=nil
if (tonumber(cel) ~= nil) then
target=getPlayerID(cel)
else
for _,v in ipairs(getElementsByType("player")) do
if string.find(string.gsub(getPlayerName(v):lower(),"#%x%x%x%x%x%x", ""), cel:lower(), 1, true) then
if (target) then
outputChatBox ("Znaleziono wi?cej ni? jednego gracza o pasuj?cym nicku.\nPodaj wi?cej liter.", player)
return nil
end
target=v
end
end
end
return target
end
Wysłany: 2016-01-09, 22:24
Jurandovsky
Kurdebele
Wiek: 17 Na forum: 4838 dni Posty: 915
Piwa : 2697
function wsiadanie ( player , seat , jacked )
if seat == 0 then
kierowca = getVehicleOccupant ( source , 0 )
if getPlayerName ( kierowca ) ~= getPlayerName ( player ) then
cancelEvent () return end
local name = getPlayerName ( source )
if getElementData ( source , "prywatne" ) then
local accName = getAccountName ( getPlayerAccount ( player ) )
if getElementData ( source , "wlasciciel" ) == getAccountName ( getPlayerAccount ( player )) or isObjectInACLGroup ( "user." .. accName , aclGetGroup ( "Urzad" ) ) then
else
cancelEvent ()
co = getPedOccupiedVehicle ( player )
nazwa = getVehicleName ( co )
owner2 = getElementData ( co , "wlasciciel" )
outputChatBox ( "Nie posiadasz kluczy do tego pajazu." , player )
end
end
end
end
addEventHandler ( "onVehicleStartEnter" , getRootElement (), wsiadanie )
function wlasciciel ( player , cmd , owner )
local accName = getAccountName ( getPlayerAccount ( player ) )
if isObjectInACLGroup ( "user." .. accName , aclGetGroup ( "Urzad" ) ) then
local auto = getPedOccupiedVehicle ( player )
wlasciciel = partName ( plr , owner )
if wlasciciel then
name = getPlayerName ( wlasciciel )
setElementData ( auto , "prywatne" , true )
setElementData ( auto , "wlasciciel" , name )
outputChatBox ( "ZAREJESTROWANE" , player )
else
end
end
end
addCommandHandler ( "zarejestruj" , wlasciciel )
function partName ( plr , cel )
local target = nil
if ( tonumber ( cel ) ~= nil ) then
target = getPlayerID ( cel )
else
for _ , v in ipairs ( getElementsByType ( "player" )) do
if string . find ( string . gsub ( getPlayerName ( v ): lower (), "#%x%x%x%x%x%x" , "" ), cel : lower (), 1 , true ) then
if ( target ) then
outputChatBox ( "Znaleziono wi?cej ni? jednego gracza o pasuj?cym nicku.\nPodaj wi?cej liter." , player )
return nil
end
target = v
end
end
end
testuj
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
Wysłany: 2016-01-09, 23:10
Shorn
Wariat lua
Wiek: 28 Na forum: 3884 dni Posty: 41
Nick w MP: Szorn
Piwa : 537
Jurandovsky , SCRIPT ERROR: [RPG]/zaparkuj/rejestracja.lua:54: 'end' expected (to close 'function' at line 38) near '<eof>'
ERROR: Loading script failed: [RPG]/zaparkuj/rejestracja.lua:54: 'end' expected (to close 'function' at line 38) near '<eof>
Wysłany: 2016-01-10, 14:23
#404
Wiek: 26 Na forum: 4771 dni Posty: 1438
Piwa : 2512
Podmie? na t? funkcj? i powinno lata?:
function partName ( plr , cel )
local target = nil
if ( tonumber ( cel ) ~= nil ) then
target = getPlayerID ( cel )
else
for _ , v in ipairs ( getElementsByType ( "player" )) do
if string . find ( string . gsub ( getPlayerName ( v ): lower (), "#%x%x%x%x%x%x" , "" ), cel : lower (), 1 , true ) then
if ( target ) then
outputChatBox ( "Znaleziono wi?cej ni? jednego gracza o pasuj?cym nicku.\nPodaj wi?cej liter." , player )
return nil
end
target = v
end
end
end
end
Wysłany: 2016-01-10, 15:56
Shorn
Wariat lua
Wiek: 28 Na forum: 3884 dni Posty: 41
Nick w MP: Szorn
Piwa : 537
DestroY , Pokazuje, ?e skrypt dzia?a itp. Ale nie rejestruje.
Tagi: rejestracja :: pojazdu
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: