Wysłany: 2014-09-13, 21:48
Dorex
Rick
Wiek: 28 Na forum: 4856 dni Posty: 108
Piwa : 2471
Spr?buj tak wymagaj? tego od nowych wersji MTA
[2014-09-13 20] WARNING: Script 'SAPD/test.lua' is not encoded in UTF-8. Loading as ANSI...
Aby unikn?? tego zmie? w swoim programie w kt?rym to piszesz kodowanie z UTF-8 na UTF-8 (Bez BOM) cz?sto nazywa to si? "Formatuj, Edycja, Ustawienia" tylko licz si? z tym ?e polskie znaki i inne ni? standardowe zamieni na [EQR] czyli kod maszynowy wystarczy je usun?? i wstawi? prawid?owe dla tego zr?b lepiej kopie
A co do kodu musisz go wpisa? po stronie serwera oraz zamie? ca?a funkcj? wejd? na t? u mnie sprawdza?em dzia?a.
function wejdz ( player , seat , jacket )
if seat == 0 then
if getElementData ( source , "SAPD" ) == "tak" then
if isPlayerInTeam ( player , "SAPD" ) then
-- //Jeste? Policja
else
if not ( wasEventCancelled ( )) then
cancelEvent ()
outputChatBox ( "Nie jestes pracownikiem SAPD" , player , 255 , 0 , 0 )
end
end
else
-- //Te Auto nie jest Policyjnym
end
else
-- //Nie chce jedz jako Kierowca
end
end
addEventHandler ( "onVehicleStartEnter" , getRootElement (), wejdz )
Wysłany: 2014-09-13, 22:37
Zbyklon
Wiek: 50 Na forum: 4290 dni Posty: 45
Nick w MP: Zbyklon
Piwa : 7
function infek1 ( model , x , y , z , rx , ry , rz , numberplate , direction , variant1 , variant2 )
if model and x and y and z and rx and ry and rz then
local infek = createVehicle ( model , x , y , z , rx , ry , rz , numberplate , direction , variant1 , variant2 )
removeVehicleSirens ( infek )
addVehicleSirens ( infek , 2 , 2 , true , false , true , false )
setVehicleSirens ( infek , 1 , - 0.700 , 2.600 , - 0.500 , 255 , 0 , 0 , 255 , 255 )
setVehicleSirens ( infek , 2 , 0.700 , 2.600 , - 0.500 , 0 , 0 , 255 , 255 , 255 )
setVehicleColor ( infek , 0 , 0 , 0 , 0 )
addVehicleUpgrade ( infek , 1096 )
setElementData ( infek , "SAPD" , "tak" )
end
end
function infek2 ()
infek1 ( 411 , 2264 , 2473.5427246094 , 2.7917623519897 , 0 , 0 , 0 , "SAPDW 01" , false , 0 , 0 )
infek1 ( 411 , 2268 , 2473.5427246094 , 2.7917623519897 , 0 , 0 , 0 , "SAPDW 02" , false , 0 , 0 )
infek1 ( 411 , 2272.5 , 2473.5427246094 , 2.7917623519897 , 0 , 0 , 0 , "SAPDW 03" , false , 0 , 0 )
infek1 ( 411 , 2277 , 2473.5427246094 , 2.7917623519897 , 0 , 0 , 0 , "SAPDW 04" , false , 0 , 0 )
infek1 ( 411 , 2281.25 , 2473.5427246094 , 2.7917623519897 , 0 , 0 , 0 , "SAPDW 05" , false , 0 , 0 )
infek1 ( 411 , 2285.75 , 2473.5427246094 , 2.7917623519897 , 0 , 0 , 0 , "SAPDW 06" , false , 0 , 0 )
-- infek1 ( 411 , 2268 , 2473.5427246094 , 2.7917623519897 , 0 , 0 , 0 , "SAPDW 00" , false , 0 , 0 )
end
addEventHandler ( 'onResourceStart' , getResourceRootElement ( getThisResource ()), infek2 )
function isPlayerInTeam ( player , team )
assert ( isElement ( player ) and getElementType ( player ) == "player" , "Bad argument 1 @ isPlayerInTeam [player expected, got " .. tostring ( player ) .. "]" )
assert (( not team ) or type ( team ) == "string" or ( isElement ( team ) and getElementType ( team ) == "team" ), "Bad argument 2 @ isPlayerInTeam [nil/string/team expected, got " .. tostring ( team ) .. "]" )
return getPlayerTeam ( player ) == ( type ( team ) == "string" and getTeamFromName ( team ) or ( type ( team ) == "userdata" and team or ( getPlayerTeam ( player ) or true )))
end
function wejdz ( player , seat , jacket )
if seat == 0 then
if getElementData ( source , "SAPD" ) == "tak" then
if isPlayerInTeam ( player , "SAPD" ) then
-- //Jeste? Policja
else
if not ( wasEventCancelled ( )) then
cancelEvent ()
outputChatBox ( "Nie jestes pracownikiem SAPD" , player , 255 , 0 , 0 )
end
end
else
-- //Te Auto nie jest Policyjnym
end
else
-- //Nie chce jedz jako Kierowca
end
end
addEventHandler ( "onVehicleStartEnter" , getRootElement (), wejdz )
zwa?aj?c na powy?sze uwagi m?j kod wygl?da tak jak powy?e j...
Powie mi kto? gdzie tu jest b??d, po zast?pieniu tamt? funkcj? "wejdz" na funkcje Dorex'a wgl nie spawni? si? te pojazdy natomiast wcze?niejsza opcja pozwala wej?? ka?demu ;-;
///EDIT !
Okej dzia?a :> piwka lec?
Tagi: pojazdy :: acl :: team
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: