EvilXmik
Wiek: 28 Na forum: 3620 dni Posty: 148
Nick w MP: EvilXmik
Piwa : 399
Witam mam problem z tym skryptem pr?buje go na sw?j serwer wstawi? ale wyskakuj? mi DB i nie wiem co mam zrobi? za pomoc stawiam
DB w 10/28/40 linijce
S_side
local skrzyniaogloszen = createObject ( 980 , 0 , 0 , - 100 )
function ogloszenie ( source , cmd , ... )
if not getElementData ( source , "duty" ) then outputChatBox ( "*Brak uprawnien" , source , 255 , 0 , 0 ) return end
if ... then
if not getElementData ( skrzyniaogloszen , "ogloszenie" ) then
local text = table . concat ({...}, " " )
setElementData ( skrzyniaogloszen , "ogloszenie" , true )
setElementData ( skrzyniaogloszen , "tekstogloszenia" , "(Admin) " .. getPlayerName ( source ): gsub ( "#%x%x%x%x%x%x" , "" ).. " ( " .. getElementData ( source , "id" ).. " ) : \n " .. text .. " " )
setTimer ( setElementData , 10000 , 1 , skrzyniaogloszen , "ogloszenie" , false )
else
outputChatBox ( "Og?oszenia mog? by? nadawane minimum 10 sekund." , source , 255 , 96 , 0 , true )
end
else
outputChatBox ( "Aby nada? og?oszenie /ogloszenie [tresc] ." , source , 255 , 96 , 0 , true )
end
end
addCommandHandler ( "ogloszenie" , ogloszenie )
c_side (tu s? b??dy)
local start = getTickCount ()
function isEventHandlerAdded ( sEventName , pElementAttachedTo , func )
if
type ( sEventName ) == 'string' and
isElement ( pElementAttachedTo ) and
type ( func ) == 'function'
then
local aAttachedFunctions = getEventHandlers ( sEventName , pElementAttachedTo )
if type ( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then
for i , v in ipairs ( aAttachedFunctions ) do
if v == func then
return true
end
end
end
end
return false
end
function hud ()
x , y = guiGetScreenSize ()
screenW , screenH = guiGetScreenSize ()
for k , v in ipairs ( getElementsByType ( "object" ) ) do
if getElementData ( v , "ogloszenie" ) then
local tekst = getElementData ( v , "tekstogloszenia" )
local width = dxGetTextWidth ( tekst , 1 , "Arial" )
local now = getTickCount ()
local endTime = start + 2000
local elapsedTime = now - start
local duration = endTime - start
local progress = elapsedTime / duration
if progress and progress > 4 then
if not s then
s = getTickCount ()
end
local x , y , z = interpolateBetween ( screenW * 0.0022 , screenH * 0.5226 , 0 , screenW * 1.2 , screenH * 0.5226 , 0 , ( s - getTickCount ())/(( s + 2000 ) - s ), "InOutBack" )
dxDrawRectangle ( x , y , screenW * 0.2500 , screenH * 0.0365 + ( width * 0.05 ), tocolor ( 0 , 0 , 0 , 151 ), false )
dxDrawText ( tekst , x , y , screenW * 0.2522 , screenH * 0.0391 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default" , "center" , "top" , false , true , false , false , false )
return end
local px , py , pz = getElementPosition ( localPlayer )
local x , y , z = interpolateBetween ( screenW * - 0.2 , screenH * 0.5226 , 0 , screenW * 0.0022 , screenH * 0.5226 , 0 , progress , "InOutBack" )
dxDrawRectangle ( x , y , screenW * 0.2500 , screenH * 0.0365 + ( width * 0.05 ), tocolor ( 0 , 0 , 0 , 151 ), false )
dxDrawText ( tekst , x , y , screenW * 0.2522 , screenH * 0.0391 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default" , "center" , "top" , false , true , false , false , false )
end
end
end
addEventHandler ( "onClientElementDataChange" , root , function( data , old )
if getElementType ( source ) == "object" and data == "ogloszenie" then
if getElementData ( source , "ogloszenie" ) then
if isEventHandlerAdded ( "onClientRender" , root , hud ) then
removeEventHandler ( "onClientRender" , root , hud )
end
start = getTickCount ()
s = nil
addEventHandler ( "onClientRender" , root , hud )
else
removeEventHandler ( "onClientRender" , root , hud )
start = getTickCount ()
s = nil
end
end
end )
addEventHandler ( "onClientRender" , root , hud )
Ostatnio zmieniony przez marcin778 2017-11-17, 13:39, w całości zmieniany 1 raz