Wysłany: 2015-07-30, 06:48
pomaza
Wiek: 39 Na forum: 3982 dni Posty: 79
Piwa : 2
Witam mam kod :
Kod: function dajPaliwo(prl,cmd,id)
if id then
id=tonumber(id)
local veh=getVehicle(id)
if veh then
local accName = getAccountName ( getPlayerAccount ( thePlayer ) )
local pojazd = getPedOccupiedVehicle( thePlayer )
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then
if pojazd then
setElementData(pojazd, "pojazd_paliwo", 100)
end
end
end
end
end
addCommandHandler("dajpaliwo", dajPaliwo)
Chcia?em zeby jak sie wpisze /dajpaliwo 2 to daje paliwo autu o danym id ale wyskakuje w debugu:
attempt to call global 'getVehicle' (a nil value)
Mo?e kto? by wiedzia? jak to poprawi? ?
daje !
Wysłany: 2015-07-30, 10:45
piotr172
Wiek: 26 Na forum: 4417 dni Posty: 130
Piwa : 2329
Dodaj to do tego skryptu co masz t? komend?, uzupe?nij tylko ElemntDate id pojazdu(tutaj jest"car_id")
local function getVehicle ( id )
if id then
id = tonumber ( id )
for _ , v in ipairs ( getElementsByType ( "vehicle" ))do
if getElementData ( v , "car_id" ) then
if getElementData ( v , "car_id" )== id then
return v
end
end
end
end
return false
end
I jeszcze w kodzie na t? komend? zamiast thePlayer wpisz plr.
function dajPaliwo ( plr , cmd , id )
if id then
id = tonumber ( id )
local veh = getVehicle ( id )
if veh then
local accName = getAccountName ( getPlayerAccount ( plr ) )
local pojazd = getPedOccupiedVehicle ( plr )
if isObjectInACLGroup ( "user." .. accName , aclGetGroup ( "Admin" ) ) then
if pojazd then
setElementData ( pojazd , "pojazd_paliwo" , 100 )
end
end
end
Wysłany: 2015-07-30, 11:09
pomaza
Wiek: 39 Na forum: 3982 dni Posty: 79
Piwa : 2
end expeced (to close 'if' at line 70) near <eof>
[ Dodano : 2015-07-30, 11:11 ]
70 to jest to : if id then
Wysłany: 2015-07-30, 11:31
Tostuch
Wiek: 27 Na forum: 4931 dni Posty: 483
Nick w MP: Tost
Piwa : 137
dodaj jeszcze jeden end na ko?cu
Wysłany: 2015-07-30, 12:07
pomaza
Wiek: 39 Na forum: 3982 dni Posty: 79
Piwa : 2
nie dziala
nie ma errora tylko warning bad argument setEelementData [expecend element at argument 1, go boolean
Wysłany: 2015-07-30, 12:13
piotr172
Wiek: 26 Na forum: 4417 dni Posty: 130
Piwa : 2329
To jest komenda ze daje paliwo po id to po co sprawdzasz pojazd w kt?rym siedzi osoba wpisuj?ca komend??
function dajPaliwo ( plr , cmd , id )
if id then
id = tonumber ( id )
local veh = getVehicle ( id )
if veh then
local accName = getAccountName ( getPlayerAccount ( plr ) )
if isObjectInACLGroup ( "user." .. accName , aclGetGroup ( "Admin" ) ) then
setElementData ( veh , "pojazd_paliwo" , 100 )
end
end
end
end
addCommandHandler ( "dajpaliwo" , dajPaliwo )
Wysłany: 2015-07-30, 12:22
pomaza
Wiek: 39 Na forum: 3982 dni Posty: 79
Piwa : 2
o pomy?ka moja to byla
[ Dodano : 2015-07-30, 12:24 ]
dobra dzia?a piwko leci
[ Dodano : 2015-07-30, 12:29 ]
temat mo?na zamyka?
Tagi: komeda :: daj :: paliwo
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: