Wysłany: 2017-01-14, 09:41
Hubio69
Mapper MTA
Wiek: 27 Na forum: 3586 dni Posty: 99
Nick w MP: Hubio69
Piwa : 17
O co chodzi?
attempt to call global 'restartResource' (a nil value)
Poni?ej funkcja odpowiadaj?ca za restart skryptu:
setTimer (function()
restartResource ( getThisResource ())
end , 1000 * 10 , 0 )
Wysłany: 2017-01-14, 10:49
dawanonim
Wiek: 27 Na forum: 3447 dni Posty: 10
Nick w MP: Anonimowy
Piwa : 1
Wysłany: 2017-01-14, 11:01
Hubio69
Mapper MTA
Wiek: 27 Na forum: 3586 dni Posty: 99
Nick w MP: Hubio69
Piwa : 17
Co tutaj mam zmieni? bo nadal nie dzia?a?
local allowShoot = 1
function doAllowPlayerShoot ( e )
allowShoot = e
end
function doPlayerVehicleShoot ()
if allowShoot == 1 then
if not isPedDead ( localPlayer ) then
doAllowPlayerShoot ( 0 )
local v = getPedOccupiedVehicle ( localPlayer )
if getElementModel ( v ) == 500 then
local x , y , z = getElementPosition ( v )
local rX , rY , rZ = getElementRotation ( v )
local x = x + 4 * math . cos ( math . rad ( rZ + 90 ))
local y = y + 4 * math . sin ( math . rad ( rZ + 90 ))
createProjectile ( v , 20 , x , y , z + 1.25 , 1.0 , nil )
setTimer ( doAllowPlayerShoot , 3000 , 1 , 1 )
end
end
end
end
bindKey ( "mouse1" , "down" , doPlayerVehicleShoot )
bindKey ( "lctrl" , "down" , doPlayerVehicleShoot )
bindKey ( "rctrl" , "down" , doPlayerVehicleShoot )
bindKey ( "lalt" , "down" , doPlayerVehicleShoot )
bindKey ( "ralt" , "down" , doPlayerVehicleShoot )
setTimer (
function()
-- restarting this resource every hour
restartResource ( getThisResource ())
end ,
10000 , 0 )
Wysłany: 2017-01-14, 11:43
KukiX
Wiek: 34 Na forum: 6718 dni Posty: 567
Piwa : 17560
Funkcja restartResource dzia?a tylko po stronie serwera i dodatkowo wymaga chyba praw admina, a ty da?e? to po stronie klienta.
Wysłany: 2017-01-14, 11:44
_Haze
Peace Yo!
Wiek: 24 Na forum: 4184 dni Posty: 1648
Nick w MP: Haze
Piwa : 2628
Hubio69 , to jest strona clienta a restartResource to strona serverside zr?b osobny plik do serwera i daj go tam
@edit KukiX by? szybszy o minute xD
Wysłany: 2017-01-14, 11:54
Hubio69
Mapper MTA
Wiek: 27 Na forum: 3586 dni Posty: 99
Nick w MP: Hubio69
Piwa : 17
Teraz wy?wietla mi:
Acces denied @ 'restartResource'
Wysłany: 2017-01-14, 11:57
_Haze
Peace Yo!
Wiek: 24 Na forum: 4184 dni Posty: 1648
Nick w MP: Haze
Piwa : 2628
Hubio69 , dodaj skrypt do acl admin o tak resource.nazwazasobu albo resource.* ?eby nada? ka?demu resource prawa admina ;d
Wysłany: 2017-01-14, 12:10
Hubio69
Mapper MTA
Wiek: 27 Na forum: 3586 dni Posty: 99
Nick w MP: Hubio69
Piwa : 17
Dobra, mo?e inaczej napisz?, bo nie dzia?a mi to.
Mam skrypt na strzelanie z pojazd?w, kt?rego kod jest umieszczony powy?ej.
Gdy np. stworz? infernusa to nie mog? z niego strzela? zanim nie zrestartuj? tego skryptu w?asnor?cznie.
Chcia?bym ustawi? tak, aby ju? po stworzeniu pojazdu m?g?bym strzela?, a nie za ka?dym razem restartowa? ten skrypt.
To samo np. gdy kupi? pojazd z salonu to chc? go od razu kupi? z mo?liwo?ci? strzelania, a nie po ka?dym kupieniu restartowa? skrypt.
I to ma dzia?a? na ka?dego gracza (nie tylko na admina).
My?l?, ?e nieco bardziej rozja?ni?em temat.
Wysłany: 2017-01-14, 13:25
Barcioo
Kiedyś to było ST
Wiek: 26 Na forum: 4048 dni Posty: 458
Nick w MP: Bartek.
Piwa : 1887
zobacz to
local allowShoot = 1
function doAllowPlayerShoot ( e )
allowShoot = e
end
function doPlayerVehicleShoot ()
if allowShoot == 1 then
if not isPedDead ( localPlayer ) then
doAllowPlayerShoot ( 0 )
local v = getPedOccupiedVehicle ( localPlayer )
local x , y , z = getElementPosition ( v )
local rX , rY , rZ = getElementRotation ( v )
local x = x + 4 * math . cos ( math . rad ( rZ + 90 ))
local y = y + 4 * math . sin ( math . rad ( rZ + 90 ))
createProjectile ( v , 20 , x , y , z + 1.25 , 1.0 , nil )
setTimer ( doAllowPlayerShoot , 3000 , 1 , 1 )
end
end
end
bindKey ( "mouse1" , "down" , doPlayerVehicleShoot )
bindKey ( "lctrl" , "down" , doPlayerVehicleShoot )
bindKey ( "rctrl" , "down" , doPlayerVehicleShoot )
bindKey ( "lalt" , "down" , doPlayerVehicleShoot )
bindKey ( "ralt" , "down" , doPlayerVehicleShoot )
setTimer (
function()
-- restarting this resource every hour
restartResource ( getThisResource ())
end ,
10000 , 0 )
Podpis
Kanał Youtube;
A tu zapraszam
[you]
, pomogłem Ci? Wynagrodź mnie
SUPPORT TEAM - 2016-09-03 do 2018-05-25
Test Mod - 2018-05-25
1k dni na Forum - 2018-01-28
GG: 62111935
Wysłany: 2017-01-14, 13:54
Hubio69
Mapper MTA
Wiek: 27 Na forum: 3586 dni Posty: 99
Nick w MP: Hubio69
Piwa : 17
Nie dzia?a
Wysłany: 2017-01-14, 13:55
Barcioo
Kiedyś to było ST
Wiek: 26 Na forum: 4048 dni Posty: 458
Nick w MP: Bartek.
Piwa : 1887
db
Podpis
Kanał Youtube;
A tu zapraszam
[you]
, pomogłem Ci? Wynagrodź mnie
SUPPORT TEAM - 2016-09-03 do 2018-05-25
Test Mod - 2018-05-25
1k dni na Forum - 2018-01-28
GG: 62111935
Wysłany: 2017-01-14, 14:26
Hubio69
Mapper MTA
Wiek: 27 Na forum: 3586 dni Posty: 99
Nick w MP: Hubio69
Piwa : 17
Wysłany: 2017-01-14, 14:33
Barcioo
Kiedyś to było ST
Wiek: 26 Na forum: 4048 dni Posty: 458
Nick w MP: Bartek.
Piwa : 1887
nadaj temu pliku admina w acl
Podpis
Kanał Youtube;
A tu zapraszam
[you]
, pomogłem Ci? Wynagrodź mnie
SUPPORT TEAM - 2016-09-03 do 2018-05-25
Test Mod - 2018-05-25
1k dni na Forum - 2018-01-28
GG: 62111935
Wysłany: 2017-01-14, 14:51
Hubio69
Mapper MTA
Wiek: 27 Na forum: 3586 dni Posty: 99
Nick w MP: Hubio69
Piwa : 17
Doda?em, zrobi?em /rc i nadal nic
Wysłany: 2017-01-14, 20:57
KukiX
Wiek: 34 Na forum: 6718 dni Posty: 567
Piwa : 17560
Hubio69 , Spr?buj tego kodu (ca?o?? po stronie klienta).
local allowShoot = 1
function doAllowPlayerShoot ( e )
allowShoot = e
end
function doPlayerVehicleShoot ()
if allowShoot == 1 then
if not isPedDead ( localPlayer ) then
doAllowPlayerShoot ( 0 )
local v = getPedOccupiedVehicle ( localPlayer )
local x , y , z = getElementPosition ( v )
local rX , rY , rZ = getElementRotation ( v )
local x = x + 4 * math . cos ( math . rad ( rZ + 90 ))
local y = y + 4 * math . sin ( math . rad ( rZ + 90 ))
createProjectile ( v , 20 , x , y , z + 1.25 , 1.0 , nil )
setTimer ( doAllowPlayerShoot , 3000 , 1 , 1 )
end
end
end
function bindKeys ()
bindKey ( "mouse1" , "down" , doPlayerVehicleShoot )
bindKey ( "lctrl" , "down" , doPlayerVehicleShoot )
bindKey ( "rctrl" , "down" , doPlayerVehicleShoot )
bindKey ( "lalt" , "down" , doPlayerVehicleShoot )
bindKey ( "ralt" , "down" , doPlayerVehicleShoot )
end
addEventHandler ( "onClientVehicleEnter" , root ,
function( thePlayer , seat )
bindKeys ()
end )
addEventHandler ( "onClientResourceStart" , resourceRoot ,
function()
bindKeys ()
end )
Ostatecznie jak powy?szy kod nie zadzia?a to ten poni?ej na 100% rozwi??e problem.
local allowShoot = 1
function doAllowPlayerShoot ( e )
allowShoot = e
end
function doPlayerVehicleShoot ()
if allowShoot == 1 then
if not isPedDead ( localPlayer ) then
doAllowPlayerShoot ( 0 )
local v = getPedOccupiedVehicle ( localPlayer )
local x , y , z = getElementPosition ( v )
local rX , rY , rZ = getElementRotation ( v )
local x = x + 4 * math . cos ( math . rad ( rZ + 90 ))
local y = y + 4 * math . sin ( math . rad ( rZ + 90 ))
createProjectile ( v , 20 , x , y , z + 1.25 , 1.0 , nil )
setTimer ( doAllowPlayerShoot , 3000 , 1 , 1 )
end
end
end
function bindKeys ()
bindKey ( "mouse1" , "down" , doPlayerVehicleShoot )
bindKey ( "lctrl" , "down" , doPlayerVehicleShoot )
bindKey ( "rctrl" , "down" , doPlayerVehicleShoot )
bindKey ( "lalt" , "down" , doPlayerVehicleShoot )
bindKey ( "ralt" , "down" , doPlayerVehicleShoot )
end
setTimer ( bindKeys , 1000 , 0 )
Zgaduje ?e jaki? kod z innego skryptu usuwa bindy, dlatego dopiero po restarcie skryptu mo?na strzela?.
Tagi: restart :: skryptu
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: