Wysłany: 2018-02-11, 19:45
Qbik1337
Wiek: 30 Na forum: 3207 dni Posty: 18
Nick w MP: Danio
Piwa : 133
Witam, mam taki problem ze mam skrypt na raporty element data jest itp ale i tak nie pokazuje mi raportow ani napisu "Lista raportow" prosze o pomoc za pomoc daje piwo+rep
"report.lua" (Client)
local xtext = nil
local gameView ={ " " }
local reportView ={ "Lista raport?w:" }
local sx , sy = guiGetScreenSize ()
addEventHandler ( "onClientRender" , root , function()
if getElementData ( localPlayer , "adminduty" ) == 1 or getElementData ( localPlayer , "amodduty" ) == 2 or getElementData ( localPlayer , "samodduty" ) == 3 then
concat = table . concat ( gameView , "\n" )
dxDrawText ( concat , sx *( 10 + 1 )/ 1024 , sy *( 279 + 1 )/ 768 , sx *( 326 + 1 )/ 1024 , sy *( 497 + 1 )/ 768 , tocolor ( 0 , 0 , 0 , 255 ), 1.00 , "default" , "left" , "top" , false , true )
dxDrawText ( concat , sx *( 10 )/ 1024 , sy *( 279 )/ 768 , sx *( 326 )/ 1024 , sy *( 497 )/ 768 , white , 1.00 , "default" , "left" , "top" , false , true )
end
end )
function renderingInfo ()
-- dxDrawRectangle ( sx *( 258 )/ 1024 , sy *( 0 )/ 768 , sx *( 500 )/ 1024 , sy *( 23 )/ 768 , tocolor ( 0 , 0 , 0 , 155 ), false )
dxDrawRectangle ( sx *( 843 )/ 1280 , sy *( 536 )/ 600 , sx *( 427 )/ 1280 , sy *( 28 )/ 600 , tocolor ( 0 , 0 , 0 , 155 ), false )
-- dxDrawText ( xtext , sx *( 258 + 1 )/ 1024 , sy *( 0 + 1 )/ 768 , sx *( 758 + 1 )/ 1024 , sy *( 23 + 1 )/ 768 , tocolor ( 0 , 0 , 0 , 255 ), 1.00 , "default" , "center" , "center" , false , true )
-- dxDrawText ( xtext , sx *( 258 )/ 1024 , sy *( 0 )/ 768 , sx *( 758 )/ 1024 , sy *( 23 )/ 768 , tocolor ( 255 , 0 , 0 , 255 ), 1.00 , "default" , "center" , "center" , false , true )
dxDrawText ( xtext , sx *( 860 + 1 )/ 1280 , sy *( 542 + 1 )/ 600 , sx *( 1260 + 1 )/ 1280 , sy *( 560 + 1 )/ 600 , tocolor ( 0 , 0 , 0 , 255 ), 1.00 , "default" , "left" , "top" , false , false , false , false , false )
dxDrawText ( xtext , sx *( 860 )/ 1280 , sy *( 542 )/ 600 , sx *( 1260 )/ 1280 , sy *( 560 )/ 600 , tocolor ( 255 , 0 , 0 , 255 ), 1.00 , "default" , "left" , "top" , false , false , false , false , false )
end
addEventHandler ( "onClientRender" , root , function()
if getElementData ( localPlayer , "adminduty" ) == 1 or getElementData ( localPlayer , "amodduty" ) == 2 or getElementData ( localPlayer , "samodduty" ) == 3 then
local tt ={}
for i , v in ipairs ( reportView ) do
if v [ 1 ] then table . insert ( tt , v [ 1 ]) end
end
concat = table . concat ( tt , "\n" )
dxDrawText ( concat , sx *( 698 + 1 )/ 1024 , sy *( 278 + 1 )/ 768 , sx *( 1014 + 1 )/ 1024 , sy *( 496 + 1 )/ 768 , tocolor ( 0 , 0 , 0 , 255 ), 1.00 , "default" , "right" , "top" , false , true )
dxDrawText ( concat , sx *( 698 )/ 1024 , sy *( 278 )/ 768 , sx *( 1014 )/ 1024 , sy *( 496 )/ 768 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default" , "right" , "top" , false , true )
end
end )
addEvent ( "admin:addText" , true )
addEventHandler ( "admin:addText" , root , function( text )
table . insert ( gameView , text )
if #gameView > 20 then
table . remove ( gameView , 1 )
end
end )
addEvent ( "admin:addReport" , true )
addEventHandler ( "admin:addReport" , root , function( text , id )
table . insert ( reportView , { text , id })
if #reportView > 20 then
table . remove ( reportView , 1 )
end
end )
addEvent ( "admin:removeReport" , true )
addEventHandler ( "admin:removeReport" , root , function( id )
for i = #reportView, 1, -1 do
if reportView [ i ][ 2 ] == id then
table . remove ( reportView , i )
end
end
end )
addEvent ( "admin:rendering" , true )
addEventHandler ( "admin:rendering" , root , function( text )
xtext = text
addEventHandler ( "onClientRender" , root , renderingInfo )
setTimer (function()
removeEventHandler ( "onClientRender" , root , renderingInfo )
end , 5000 , 1 )
end )
"server.lua" (Server)
function adm ( source )
local accountName = getAccountName ( getPlayerAccount ( source ))
if isObjectInACLGroup ( "user." .. accountName , aclGetGroup ( "Admin" )) then
if getElementData ( source , "adminduty" , true ) then
setElementData ( source , "adminduty" , false )
takeAllWeapons ( source )
outputChatBox ( "Zwolni?e? si? z rangi administratora RCON" , source , 255 , 0 , 0 )
removeElementData ( source , "Praca" )
triggerClientEvent ( "okno:dutyoff" , source , source )
takeWeapon ( source , 22 )
else
outputChatBox ( "Zalogowa?e? si? jako Administrator RCON :)" , source , 255 , 0 , 0 )
local nazwa = "Administrator RCON"
local r , g , b = 220 , 0 , 0
setElementData ( source , "Praca" , nazwa )
setElementData ( source , "Praca:r" , r )
setElementData ( source , "Praca:g" , g )
setElementData ( source , "Praca:b" , b )
triggerClientEvent ( "okno:dutyon" , source , source )
setElementData ( source , "adminduty" , true )
setPlayerNametagColor ( source , 220 , 0 , 0 )
giveWeapon ( source , 22 , 10000000 )
end
end
end
addCommandHandler ( 'dutyadm' , adm )
function adm ( source )
local accountName = getAccountName ( getPlayerAccount ( source ))
if isObjectInACLGroup ( "user." .. accountName , aclGetGroup ( "SuperModerator" )) then
if getElementData ( source , "amodduty" , true ) then
setElementData ( source , "amodduty" , false )
outputChatBox ( "Zwolni?e? si? z rangi Administrator" , source , 255 , 0 , 0 )
removeElementData ( source , "Praca" )
triggerClientEvent ( "okno:dutyoff" , source , source )
takeWeapon ( source , 22 )
else
outputChatBox ( "Zalogowa?e? si? jako Administrator :)" , source , 255 , 0 , 0 )
local nazwa = "Administrator"
local r , g , b = 255 , 0 , 0
setElementData ( source , "Praca" , nazwa )
setElementData ( source , "Praca:r" , r )
setElementData ( source , "Praca:g" , g )
setElementData ( source , "Praca:b" , b )
triggerClientEvent ( "okno:dutyon" , source , source )
setPlayerNametagColor ( source , 255 , 0 , 0 )
setElementData ( source , "amodduty" , true )
giveWeapon ( source , 22 , 10000000 )
end
end
end
addCommandHandler ( 'duty' , adm )
function adm ( source )
local accountName = getAccountName ( getPlayerAccount ( source ))
if isObjectInACLGroup ( "user." .. accountName , aclGetGroup ( "Moderator" )) then
if getElementData ( source , "samodduty" , true ) then
setElementData ( source , "samodduty" , false )
outputChatBox ( "Zwolni?e? si? z rangi Supporter" , source , 255 , 0 , 0 )
takeWeapon ( source , 22 )
triggerClientEvent ( "okno:dutyoff" , source , source )
removeElementData ( source , "Praca" )
else
outputChatBox ( "Zalogowa?e? si? jako Supporter :)" , source , 255 , 0 , 0 )
triggerClientEvent ( "okno:dutyon" , source , source )
local nazwa = "Support"
local r , g , b = 0 , 71 , 255
setElementData ( source , "Praca" , nazwa )
setElementData ( source , "Praca:r" , r )
setElementData ( source , "Praca:g" , g )
setElementData ( source , "Praca:b" , b )
setElementData ( source , "samodduty" , true )
setPlayerNametagColor ( source , 0 , 71 , 255 )
giveWeapon ( source , 22 , 10000000 )
end
end
end
addCommandHandler ( 'duty' , adm )
function report ( gracz , cmd , toGracz , ...)
if ... and toGracz then
toGracz = findPlayer ( gracz , toGracz )
if not toGracz then
exports [ "aw-noti" ]: noti ( "Nie znaleziono podanego gracza." , gracz )
return
end
local tekst = table . concat ({...}, " " )
exports [ "aw-noti" ]: noti ( "Pomy?lnie wys?ano zg?oszenie na gracza " .. getPlayerName ( toGracz ).. " o tre?ci " .. tekst , gracz )
tekst = getPlayerName ( gracz ).. "(" .. getElementData ( gracz , "id" ).. ") > " .. getPlayerName ( toGracz ).. "(" .. getElementData ( toGracz , "id" ).. "): " .. tekst
triggerClientEvent ( root , "dRaps" , root , tekst , getPlayerName ( toGracz ))
setElementData ( toGracz , "report" , true )
else
exports [ "aw-noti" ]: noti ( "Poprawne u?ycie: /" .. cmd .. " <id/nick> <pow?d>" , gracz )
end
end
addCommandHandler ( "report" , report )
addCommandHandler ( "raport" , report )
addCommandHandler ( "cl" , function( player , cmd , target )
if not getElementData ( player , "adminduty" ) then return end
if target then
target = findPlayer ( player , target )
if not target then return end
triggerClientEvent ( root , "uRaps" , player , getPlayerName ( target ))
else
exports [ "aw-noti" ]: noti ( "Poprawne u?ycie: /" .. cmd .. " <id/nick> <pow?d>" , player )
end
end )
function findPlayer ( p , ph )
for i , v in ipairs ( getElementsByType ( "player" )) do
if tonumber ( ph ) then
if getElementData ( v , "id" ) == tonumber ( ph ) then
return getPlayerFromName ( getPlayerName ( v ))
end
else
if string . find ( string . gsub ( getPlayerName ( v ): lower (), "#%x%x%x%x%x%x" , "" ), ph : lower (), 1 , true ) then
return getPlayerFromName ( getPlayerName ( v ))
end
end
end
end
Ostatnio zmieniony przez Qbik1337 2018-02-11, 20:28, w całości zmieniany 2 razy
Wysłany: 2018-02-11, 19:49
Ciastuuś
Truck soon...
Wiek: 26 Na forum: 3071 dni Posty: 799
Nick w MP: Ciastuuś
Piwa : 4297
Jaki? b??d w debugscript3?
Wysłany: 2018-02-11, 19:49
Qbik1337
Wiek: 30 Na forum: 3207 dni Posty: 18
Nick w MP: Danio
Piwa : 133
Wysłany: 2018-02-11, 20:13
marcin778
Krytyk serwerów MTA
Wiek: 24 Na forum: 4149 dni Posty: 2268
Nick w MP: Marcineg
Piwa : 4662
Nie dziw si?, if getElementData ( localPlayer , "adminduty" ) == false then Skoro masz warunek, ?e je?li elmentdata adminduty == false czyli sprawdza czy gracz nie ma tej elementdaty.
Wysłany: 2018-02-11, 20:25
Qbik1337
Wiek: 30 Na forum: 3207 dni Posty: 18
Nick w MP: Danio
Piwa : 133
local xtext = nil
local gameView ={ " " }
local reportView ={ "Lista raport?w:" }
local sx , sy = guiGetScreenSize ()
addEventHandler ( "onClientRender" , root , function()
if getElementData ( localPlayer , "adminduty" ) == 1 or getElementData ( localPlayer , "samodduty" ) == 2 or getElementData ( localPlayer , "amodduty" ) == 3 then
concat = table . concat ( gameView , "\n" )
dxDrawText ( concat , sx *( 10 + 1 )/ 1024 , sy *( 279 + 1 )/ 768 , sx *( 326 + 1 )/ 1024 , sy *( 497 + 1 )/ 768 , tocolor ( 0 , 0 , 0 , 255 ), 1.00 , "default" , "left" , "top" , false , true )
dxDrawText ( concat , sx *( 10 )/ 1024 , sy *( 279 )/ 768 , sx *( 326 )/ 1024 , sy *( 497 )/ 768 , white , 1.00 , "default" , "left" , "top" , false , true )
end
end )
function renderingInfo ()
-- dxDrawRectangle ( sx *( 258 )/ 1024 , sy *( 0 )/ 768 , sx *( 500 )/ 1024 , sy *( 23 )/ 768 , tocolor ( 0 , 0 , 0 , 155 ), false )
dxDrawRectangle ( sx *( 843 )/ 1280 , sy *( 536 )/ 600 , sx *( 427 )/ 1280 , sy *( 28 )/ 600 , tocolor ( 0 , 0 , 0 , 155 ), false )
-- dxDrawText ( xtext , sx *( 258 + 1 )/ 1024 , sy *( 0 + 1 )/ 768 , sx *( 758 + 1 )/ 1024 , sy *( 23 + 1 )/ 768 , tocolor ( 0 , 0 , 0 , 255 ), 1.00 , "default" , "center" , "center" , false , true )
-- dxDrawText ( xtext , sx *( 258 )/ 1024 , sy *( 0 )/ 768 , sx *( 758 )/ 1024 , sy *( 23 )/ 768 , tocolor ( 255 , 0 , 0 , 255 ), 1.00 , "default" , "center" , "center" , false , true )
dxDrawText ( xtext , sx *( 860 + 1 )/ 1280 , sy *( 542 + 1 )/ 600 , sx *( 1260 + 1 )/ 1280 , sy *( 560 + 1 )/ 600 , tocolor ( 0 , 0 , 0 , 255 ), 1.00 , "default" , "left" , "top" , false , false , false , false , false )
dxDrawText ( xtext , sx *( 860 )/ 1280 , sy *( 542 )/ 600 , sx *( 1260 )/ 1280 , sy *( 560 )/ 600 , tocolor ( 255 , 0 , 0 , 255 ), 1.00 , "default" , "left" , "top" , false , false , false , false , false )
end
addEventHandler ( "onClientRender" , root , function()
if getElementData ( localPlayer , "adminduty" ) == 1 or getElementData ( localPlayer , "amodduty" ) == 2 or getElementData ( localPlayer , "samodduty" ) == 3 then
local tt ={}
for i , v in ipairs ( reportView ) do
if v [ 1 ] then table . insert ( tt , v [ 1 ]) end
end
concat = table . concat ( tt , "\n" )
dxDrawText ( concat , sx *( 698 + 1 )/ 1024 , sy *( 278 + 1 )/ 768 , sx *( 1014 + 1 )/ 1024 , sy *( 496 + 1 )/ 768 , tocolor ( 0 , 0 , 0 , 255 ), 1.00 , "default" , "right" , "top" , false , true )
dxDrawText ( concat , sx *( 698 )/ 1024 , sy *( 278 )/ 768 , sx *( 1014 )/ 1024 , sy *( 496 )/ 768 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default" , "right" , "top" , false , true )
end
end )
addEvent ( "admin:addText" , true )
addEventHandler ( "admin:addText" , root , function( text )
table . insert ( gameView , text )
if #gameView > 20 then
table . remove ( gameView , 1 )
end
end )
addEvent ( "admin:addReport" , true )
addEventHandler ( "admin:addReport" , root , function( text , id )
table . insert ( reportView , { text , id })
if #reportView > 20 then
table . remove ( reportView , 1 )
end
end )
addEvent ( "admin:removeReport" , true )
addEventHandler ( "admin:removeReport" , root , function( id )
for i = #reportView, 1, -1 do
if reportView [ i ][ 2 ] == id then
table . remove ( reportView , i )
end
end
end )
addEvent ( "admin:rendering" , true )
addEventHandler ( "admin:rendering" , root , function( text )
xtext = text
addEventHandler ( "onClientRender" , root , renderingInfo )
setTimer (function()
removeEventHandler ( "onClientRender" , root , renderingInfo )
end , 5000 , 1 )
end )
Zmieni?em na tak ale dalej nie dzia?a
Ostatnio zmieniony przez Qbik1337 2018-02-11, 20:29, w całości zmieniany 2 razy
Wysłany: 2018-02-11, 20:27
marcin778
Krytyk serwerów MTA
Wiek: 24 Na forum: 4149 dni Posty: 2268
Nick w MP: Marcineg
Piwa : 4662
Qbik1337 , Zdecyduj si? jaka to elementdata. dutyadmin czy duty
Wysłany: 2018-02-11, 20:30
Qbik1337
Wiek: 30 Na forum: 3207 dni Posty: 18
Nick w MP: Danio
Piwa : 133
marcin778 , przeciesz dobrze jest.
Dalej nie dziala.
Prosze o pomoc
Wysłany: 2018-02-11, 20:57
Kalizman
Wiek: 23 Na forum: 3651 dni Posty: 1394
Piwa : 4619
W logowaniu ustawiasz trzeci parametr na true, a w onClientRender wczytujesz warto?? liczbow?, kt?rej jej nie nada?e?. Usu? wczytywanie warto?ci liczb.
Więcej szczegółów
Wystawiono 1 piw(a):Qbik1337
Wysłany: 2018-02-11, 21:11
Qbik1337
Wiek: 30 Na forum: 3207 dni Posty: 18
Nick w MP: Danio
Piwa : 133
Nie zabardzo chyba zrozumia?em mozesz mi to jakos inaczej obja?nic
Wysłany: 2018-02-11, 21:26
ARS*
Wiek: 25 Na forum: 3109 dni Posty: 8
Nick w MP: ARS*
Piwa : 282
Zamie?:
Kod: if getElementData(localPlayer, "adminduty") == 1 or getElementData(localPlayer, "amodduty") == 2 or getElementData(localPlayer, "samodduty") == 3 then
Na:
Kod: if getElementData(localPlayer, "adminduty") == true then
Poniewa? w serwerze po zalogowaniu nie nadajesz rangi w adminDuty tylko warto?? true lub false a nie liczby
Więcej szczegółów
Wystawiono 1 piw(a):Qbik1337
Wysłany: 2018-02-11, 21:31
Qbik1337
Wiek: 30 Na forum: 3207 dni Posty: 18
Nick w MP: Danio
Piwa : 133
Dalej nic..
[ Dodano : 2018-02-11, 21:34 ]
Ooo dzia?a tylko nie ma napisu Lista Raportow nw czm
A i jeszcze /cl mi nie dzia?a nw czm
Wysłany: 2018-02-11, 21:42
ARS*
Wiek: 25 Na forum: 3109 dni Posty: 8
Nick w MP: ARS*
Piwa : 282
Mo?esz sobie dorobi? jeszcze jeden dxDrawText aby by?o wida? dany napis. Bo szczerze to troch? si? gubi? w twoim kodzie.
Wysłany: 2018-02-11, 22:01
marcin778
Krytyk serwerów MTA
Wiek: 24 Na forum: 4149 dni Posty: 2268
Nick w MP: Marcineg
Piwa : 4662
ARS* , Po co ? ;-;
Qbik1337 ,
Zamie? to
concat = table . concat ( reportView , "\n" )
Wysłany: 2018-02-11, 22:15
Qbik1337
Wiek: 30 Na forum: 3207 dni Posty: 18
Nick w MP: Danio
Piwa : 133
Usuwanie reportow mi jeszcze nie dzia?a pod komenda /cl
Wysłany: 2018-02-11, 22:20
marcin778
Krytyk serwerów MTA
Wiek: 24 Na forum: 4149 dni Posty: 2268
Nick w MP: Marcineg
Piwa : 4662
Qbik1337 , Mo?e by? tak ruszy? g?ow? i spr?bowa? co? sam zrobi? a nie oczekujesz perfidnie gotowca, i tak ju? du?o pomocy otrzyma?e? a nawet g?upiego dzi?kuj? nie potrafisz napisa?, chamstwo normalne.
triggerClientEvent ( root , "admin:removeReport" , player , target )
zamie? to
Więcej szczegółów
Wystawiono 2 piw(a):Qbik1337 , ARS*
Tagi: reporty
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: