Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2016-06-25, 14:22


TrevorZBiedry







Wiek: 29
Na forum: 3841 dni
Posty: 14
Nick w MP: Lamar

Piwa: 1777

Respekt: 60

Witam. Napisa?em sobie skrypt na frakcje Policji. Prosi? bym o sprawdzenie poprawno?ci. Ewentualnie prosze o naniesienie poprawek.


Kod:

Policja = createTeam ( "Policja", 38, 12, 235)
Cywile = createTeam ( "Cywile", 0, 0, 0 )
markerSluzba = createMarker ( 256.79998779297, 64.6999969482422, 1002.5999755859, "cylinder", 1.5, 0, 0, 255 )
markerEndSluzba = createMarker ( 256.79998779297, 66.099998474121, 1002.5999755859, "cylinder", 1.5, 0, 0, 255 )
przebieranie = createMarker ( 255, 77.099998474121, 1002.5, "cylinder", 1.5, 230, 244, 10 )

function poliStartSluzba( thePlayer )
setElementInterior ( markerSluzba, 6 )
setElementInterior ( markerEndSluzba, 6 )
setElementInterior ( przebieranie, 6 )
setElementInterior ( blipSzafka, 6 )
local markerSluzba = createMarker ( 256.79998779297, 64.6999969482422, 1002.5999755859, "cylinder", 1.5, 0, 0, 255 )
local blipSzafka = createBlip( 255, 77.099998474121, 1002.5, 0, 0, 0, 0, 255 )
local loginGracza = getAccountName ( getPlayerAccount ( thePlayer ) )
if isObjectInACLGroup ( "user." ..loginGracza.. aclGetGroup ( "Policja") ) then
setPlayerTeam ( thePlayer, Policja)
outputChatBox("#00ff00Rozpocz??e? s?u?b?. Id? do szafki, aby przebra? si? w umundurowanie i zabra? ekwipunek.", thePlayer )
else

outputChatBox( "Nie jeste? zatrudniony w Policji!", thePlayer )
end
end
addEventHandler( "onMarkerHit", markerSluzba, poliStartSluzba )

function przebieralnia( thePlayer )
local loginGracza = getAccountName ( getPlayerAccount ( thePlayer ) )
if isObjectInACLGroup ( "user." ..loginGracza.. aclGetGroup ( "Policja") ) then
setElementModel ( thePlayer, 281 )
giveWeapon( thePlayer, 22, 10000000, true )
setPlayerArmor ( thePlayer, 100 )
setPlayerHealth ( thePlayer, 100 )
destroyElement(blipSzafka)
else
outputChatBox( "Nie jeste? zatrudniony w Policji!", thePlayer )
end
end
addEventHandler( "onMarkerHit", przebieranie, przebieralnia )

function endSluzba( thePlayer )
local loginGracza = getAccountName ( getPlayerAccount ( thePlayer ) )
if isObjectInACLGroup ( "user." ..loginGracza.. aclGetGroup ( "Policja") ) then
setElementModel ( thePlayer, 0 )
takeWeapon( thePlayer, 22 )
outputChatBox( "Zako?czy?e? s?u?b? we frakcji: Policja.", thePlayer )
setPlayerTeam ( thePlayer, Cywile)
setPlayerArmor ( thePlayer, 0)
else
outputChatBox( "Nie jeste? zatrudniony w Policji!", thePlayer )
end
end
addEventHandler( "onMarkerHit", markerEndSluzba, endSluzba )
[/code]

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-25, 15:57


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

TrevorZBiedry, nie ten dzia?, przetestuj go i jak co? jakie? b??dy w debugscript napisz A my Ci wyja?nimy co jest nie tak.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-25, 16:03


TrevorZBiedry







Wiek: 29
Na forum: 3841 dni
Posty: 14
Nick w MP: Lamar

Piwa: 1777

Respekt: 60

"luki123luki123" napisał/a:

TrevorZBiedry, nie ten dzia?, przetestuj go i jak co? jakie? b??dy w debugscript napisz A my Ci wyja?nimy co jest nie tak.




Na debugu wyskakuje tylko b??d z innego skryptu.



W konsoli po debugu wyskakuje na temat tego skryptu:

[16:12] WARNING: frakcja_police\server.lua:20: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil]
[16:12] frakcja_police restarted successfully
restart: Resource restarting...
[16:12] WARNING: frakcja_police\server.lua:34: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil]
[16:12] WARNING: frakcja_police\server.lua:48: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil]

Podpis
Postaw piwo autorowi tego posta
 

 
Tagi: prośba :: sprawdzenie :: poprawności :: kodu
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » [DM] Prośba o sprawdzenie poprawności kodu Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku