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

Wysłany: 2012-07-11, 21:36


Bogdan121







Wiek: 39
Na forum: 5184 dni
Posty: 41



Respekt: 19,1

Witam , utworzy?em skrypt kt?ry nazwa?em afk ,gdy gracz zminimalizuje gre , nad jego nickiem pojawia sie napis ?e jest afk , jednak niestety dzia?a to tak ?e gdy kto? zminimalizuje gre to u wszystkich sie takie co? pojawia , prosi?bym o pomoc ewentualnie poprawienie mojego zasobu :


client:

screenX,screenY=guiGetScreenSize()
addEventHandler("onClientRender",getRootElement(),function()
local cx,cy,cz,ctx,cty,ctz=getCameraMatrix()
for k,v in ipairs(getElementsByType("player")) do
    if getElementData(v,"player:AFK") == true and ~= getLocalPlayer() then
        local target_x,target_y,target_z=getElementPosition(v)
        local X,Y=getScreenFromWorldPosition(target_x,target_y,target_z+1)
        local scale=(1)-(getDistanceBetweenPoints3D(cx,cy,cz,target_x,target_y,target_z+1)/25)
        if scale 0 then
        scale=0
        end
        local width=dxGetTextWidth(tostring(getPlayerName(v) .. " is afk."),scale,"pricedown")/2
        X=tonumber(or 0)-width
        if and screenX  and and screenY and isLineOfSightClear(cx,cy,cz,target_x,target_y,target_z,true,true,false,true,true,false,false,(getPedOccupiedVehicle(v) or v)) then
            dxDrawText(tostring(getPlayerName(v) .. " is afk."),X,Y,50,50,tocolor(255,255,0,255),scale,"pricedown")
        end
    end
end
end)

function handleMinimize()
    callServerFunction("setElementData",source,"player:AFK"true )
end
addEventHandler"onClientMinimize"getRootElement(), handleMinimize )

function handleRestoredidClearRenderTargets )
    callServerFunction("setElementData",source,"player:AFK"false )
end
addEventHandler("onClientRestore"getRootElement(), handleRestore )

function callServerFunction(funcname, ...)
    local arg = { ... }
    if (arg[1]) then
        for keyvalue in nextarg do
            if (type(value) == "number"then arg[key] = tostring(valueend
        end
    end
    -- If the serverside event handler is not in the same resourcereplace 'resourceRoot' with the appropriate element
    triggerServerEvent("onClientCallsServerFunction"resourceRoot funcnameunpack(arg))
end



Server:


function callServerFunction(funcname, ...)
    local arg = { ... }
    if (arg[1]) then
        for keyvalue in nextarg do arg[key] = tonumber(value) or value end
    end
    loadstring("return "..funcname)()(unpack(arg))
end
addEvent("onClientCallsServerFunction"true)
addEventHandler("onClientCallsServerFunction"resourceRoot callServerFunction)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-07-11, 21:50


tymczasowy

Numb






Wiek: 38
Na forum: 5125 dni
Posty: 41
Nick w MP: Rosso



Respekt: 50

Sprawd? to (po stronie clienta)


screenX,screenY=guiGetScreenSize()
addEventHandler("onClientRender",getRootElement(),function()
local cx,cy,cz,ctx,cty,ctz=getCameraMatrix()
for k,v in ipairs(getElementsByType("player")) do
    if getElementData(v,"player:AFK") == true and ~= getLocalPlayer() then
        local target_x,target_y,target_z=getElementPosition(v)
        local X,Y=getScreenFromWorldPosition(target_x,target_y,target_z+1)
        local scale=(1)-(getDistanceBetweenPoints3D(cx,cy,cz,target_x,target_y,target_z+1)/25)
        if scale 0 then
        scale=0
        end
        local width=dxGetTextWidth(tostring(getPlayerName(v) .. " is afk."playerSource),scale,"pricedown")/2
        X=tonumber(or 0)-width
        if and screenX  and and screenY and isLineOfSightClear(cx,cy,cz,target_x,target_y,target_z,true,true,false,true,true,false,false,(getPedOccupiedVehicle(v) or v)) then
            dxDrawText(tostring(getPlayerName(v) .. " is afk.",playerSource),X,Y,50,50,tocolor(255,255,0,255),scale,"pricedown")
        end
    end
end
end)

function handleMinimize()
    callServerFunction("setElementData",source,"player:AFK"true )
end
addEventHandler"onClientMinimize"getRootElement(), handleMinimize )

function handleRestoredidClearRenderTargets )
    callServerFunction("setElementData",source,"player:AFK"false )
end
addEventHandler("onClientRestore"getRootElement(), handleRestore )

function callServerFunction(funcname, ...)
    local arg = { ... }
    if (arg[1]) then
        for keyvalue in nextarg do
            if (type(value) == "number"then arg[key] = tostring(valueend
        end
    end
    -- If the serverside event handler is not in the same resourcereplace 'resourceRoot' with the appropriate element
    triggerServerEvent("onClientCallsServerFunction"resourceRoot funcnameunpack(arg))
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-07-11, 22:17


Piorun







Wiek: 32
Na forum: 6712 dni
Posty: 1837
Nick w MP: Piorun

Piwa: 516

Respekt: 480,7
Respekt: 480,7

Wybacz, ale to nie tw?j kod. Je?eli uwa?asz, ?e skopiujesz czyj? kod i si? pod nim "podpiszesz" to mo?esz go nazywa? swoim?

Podpis
Możesz mnie znaleźć na: Facebook
Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-07-11, 22:18


Bogdan121







Wiek: 39
Na forum: 5184 dni
Posty: 41



Respekt: 19,1

Nadal to samo po zminimalizowaniu gry ka?dy ma afk nad g?ow?, kod jest m?j + wiki, nie wiem z sk?d my?l ?e nie jest m?j.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-07-11, 23:13


Piorun







Wiek: 32
Na forum: 6712 dni
Posty: 1837
Nick w MP: Piorun

Piwa: 516

Respekt: 480,7
Respekt: 480,7

Hm mo?e dlatego, ?e osoba, kt?ra poprawnie potrafi zrobi? taki skrypt nie wie jak on dzia?a ?? Troch? to dla mnie dziwne (zw?aszcza, ?e wiem ile to trudu i wysi?ku zmajstrowa? takie co?).

Dobra to teraz tak - linijk?:
local width=dxGetTextWidth(tostring(getPlayerName(v) .. " is afk."playerSource),scale,"pricedown")/2

zmie? na:
local width=dxGetTextWidth(getPlayerName(v) .. " is afk.",scale,"pricedown")/2

i linijk?:
dxDrawText(tostring(getPlayerName(v) .. " is afk.",playerSource),X,Y,50,50,tocolor(255,255,0,255),scale,"pricedown")

na:
dxDrawText(getPlayerName(v) .. " is afk.",X,Y,50,50,tocolor(255,255,0,255),scale,"pricedown")


Podpis
Możesz mnie znaleźć na: Facebook
Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-07-11, 23:33


Bogdan121







Wiek: 39
Na forum: 5184 dni
Posty: 41



Respekt: 19,1

Nadal to samo , wszystkim graczom pokazuje informacj? o zminimalizowanej grze.



screenX,screenY=guiGetScreenSize()
addEventHandler("onClientRender",getRootElement(),function()
local cx,cy,cz,ctx,cty,ctz=getCameraMatrix()
for k,v in ipairs(getElementsByType("player")) do
    if getElementData(v,"player:AFK") == true and ~= getLocalPlayer() then
        local target_x,target_y,target_z=getElementPosition(v)
        local X,Y=getScreenFromWorldPosition(target_x,target_y,target_z+1)
        local scale=(1)-(getDistanceBetweenPoints3D(cx,cy,cz,target_x,target_y,target_z+1)/25)
        if scale 0 then
        scale=0
        end
        local width=dxGetTextWidth(getPlayerName(v) .. " zminimalizowa? gr?.",scale,"pricedown")/2
        X=tonumber(or 0)-width
        if and screenX  and and screenY and isLineOfSightClear(cx,cy,cz,target_x,target_y,target_z,true,true,false,true,true,false,false,(getPedOccupiedVehicle(v) or v)) then
            dxDrawText(getPlayerName(v) .. " zminimalizowa? gr?.",X,Y,50,50,tocolor(255,255,0,255),scale,"pricedown")
        end
    end
end
end)

function handleMinimize()
    callServerFunction("setElementData",source,"player:AFK"true )
end
addEventHandler"onClientMinimize"getRootElement(), handleMinimize )

function handleRestoredidClearRenderTargets )
    callServerFunction("setElementData",source,"player:AFK"false )
end
addEventHandler("onClientRestore"getRootElement(), handleRestore )

function callServerFunction(funcname, ...)
    local arg = { ... }
    if (arg[1]) then
        for keyvalue in nextarg do
            if (type(value) == "number"then arg[key] = tostring(valueend
        end
    end
    -- If the serverside event handler is not in the same resourcereplace 'resourceRoot' with the appropriate element
    triggerServerEvent("onClientCallsServerFunction"resourceRoot funcnameunpack(arg))
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-07-11, 23:52


Piorun







Wiek: 32
Na forum: 6712 dni
Posty: 1837
Nick w MP: Piorun

Piwa: 516

Respekt: 480,7
Respekt: 480,7

Nie pami?tam czy b?dzie dzia?a?o ale spr?buj

Wywal funkcj?

function callServerFunction(funcname, ...)
    local arg = { ... }
    if (arg[1]) then
        for keyvalue in nextarg do
            if (type(value) == "number"then arg[key] = tostring(valueend
        end
    end
    -- If the serverside event handler is not in the same resourcereplace 'resourceRoot' with the appropriate element
    triggerServerEvent("onClientCallsServerFunction"resourceRoot funcnameunpack(arg))
end

i zamie?
function handleMinimize()
    callServerFunction("setElementData",source,"player:AFK"true )
end
addEventHandler"onClientMinimize"getRootElement(), handleMinimize )

function handleRestoredidClearRenderTargets )
    callServerFunction("setElementData",source,"player:AFK"false )
end
addEventHandler("onClientRestore"getRootElement(), handleRestore )

na
function handleMinimize()
    setElementData(localPlayer,"player:AFK"true )
end
addEventHandler"onClientMinimize"getRootElement(), handleMinimize )

function handleRestoredidClearRenderTargets )
    setElementData(localPlayer,"player:AFK"false )
end
addEventHandler("onClientRestore"getRootElement(), handleRestore )

Pr?bowa? zawsze mo?na ;) .

Podpis
Możesz mnie znaleźć na: Facebook
Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-07-11, 23:56


Bogdan121







Wiek: 39
Na forum: 5184 dni
Posty: 41



Respekt: 19,1

Super , dzia?a , bardzo ci dzi?kuj? !

Postaw piwo autorowi tego posta
 

 
Tagi: skrypt :: afk
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Skrypt afk 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