Jump to content

Problem z Skryptem


Recommended Posts

Witam Chciał bym dodac Obrazek do 2 skryptów w pierwszym skrypcie ma on byc gdzieś w okolicach samochodu

Client

function AFKShow() 
    dxDrawText(text,329.0,296.0,473.0,418.0,tocolor(255,0,0,255),5.0,"default-bold","center","center",false,false,false) 
    dxDrawText("You Are #ff0000AFK",251.0,154.0,558.0,283.0,tocolor(0,150,255,255),8.0,"default-bold","center","center",false,false,false,true) 
end 
  
function startCount() 
    if ( getElementData(localPlayer,"AFK") == false ) then 
        addEventHandler("onClientRender",root,AFKShow) 
        theTime = setTimer(makeCount,1000,0) 
        setElementData(localPlayer,"AFK",true) 
        text = 25 
    end 
end 
  
function EndCount() 
    if ( getElementData(localPlayer,"AFK") == true ) then 
        removeEventHandler("onClientRender",root,AFKShow) 
        killTimer(theTime) 
        setElementData(localPlayer,"AFK",false) 
    end 
end 
  
function makeCount() 
    if ( text ~= 0 ) then 
        text = text - 1 
    else 
        triggerServerEvent("onPlayerAFK",localPlayer) 
        EndCount() 
    end 
end 
  
addEvent("StartCount",true) 
addEventHandler("StartCount",root, 
    function () 
        if ( source == localPlayer ) then 
            startCount() 
        end 
    end 
) 
  
addEvent("EndCount",true) 
addEventHandler("EndCount",root, 
    function () 
        if ( source == localPlayer ) then 
            EndCount() 
        end 
    end 
) 

Server

IdleTime = 1 -- Max Idle Time in Minutes 
AFKTime = {} 
  
addEvent("onPlayerAFK",true) 
addEventHandler("onPlayerAFK",root, 
    function () 
        outputChatBox("* [ #ff0000" .. getPlayerName(source) .. " #ffffff] #0069c7Has Been Killed By #ff0000Anti AFK",root,255,255,255,true) 
        killPed(source) 
    end 
) 
  
function ChackAFK(player) 
    local time = getPlayerIdleTime(player) 
    if not isPedInVehicle(player) then return end 
    if ( time > IdleTime * 60 * 1000 ) then 
        triggerClientEvent(player,"StartCount",player) 
    else 
        triggerClientEvent(player,"EndCount",player) 
    end 
end 
  
addEventHandler("onPlayerJoin",root, 
    function () 
        AFKTime[source] = setTimer(ChackAFK,1000,0,source) 
        setElementData(source,"AFK",false) 
    end 
) 
  
addEventHandler("onPlayerQuit",root, 
    function () 
        killTimer(AFKTime[source]) 
    end 
) 
  
addEventHandler("onResourceStart",resourceRoot, 
    function () 
        for i,player in ipairs(getElementsByType("player")) do 
            AFKTime[player] = setTimer(ChackAFK,1000,0,player) 
            setElementData(player,"AFK",false) 
        end 
    end 
) 
  
  

a w Drugim po lewej stronie napisu "PRESS G TO VOTE FOR GHOSTMODE"

Client

local sx, sy = guiGetScreenSize() 
  
function GMStart() 
addEventHandler("onClientRender",getRootElement(),GmDefaultText) 
end 
addEvent("onGMStart",true) 
addEventHandler("onGMStart",getRootElement(),GMStart) 
  
function GMStop() 
removeEventHandler("onClientRender",getRootElement(),GmDefaultText) 
end 
addEvent("onGMStop",true) 
addEventHandler("onGMStop",getRootElement(),GMStop) 
  
function GmDefaultText() 
dxDrawText("PRESS G TO VOTE FOR GHOSTMODE",0,(567/900)*sy,(1436/1440)*sx,(669/900)*sy,tocolor(0,0,0,255),1,"bankgothic","center","center",false,false,false) 
dxDrawText("PRESS G TO VOTE FOR GHOSTMODE",(3/1440)*sx,(570/900)*sy,(1439/1440)*sx,(672/900)*sy,tocolor(255,255,255,255),1,"bankgothic","center","center",false,false,false) 
dxDrawText(votecount.."/"..reqPlayers.." VOTES RECIEVED",(2/1440)*sx,(633/900)*sy,(1430/1440)*sx,(707/900)*sy,tocolor(0,0,0,255),0.8,"bankgothic","center","center",false,false,false) 
dxDrawText(votecount.."/"..reqPlayers.." VOTES RECIEVED",0,(645/900)*sy,(1439/1440)*sx,(701/900)*sy,tocolor(255,255,255,255),0.8,"bankgothic","center","center",false,false,false) 
end 
  
function UpdateCount(VoteCount,PlayerCount) 
reqPlayers = PlayerCount  
votecount = VoteCount 
end 
addEvent("UpdateCount",true) 
addEventHandler("UpdateCount",getRootElement(),UpdateCount) 
  
  
  

nie mam pojecia jak to zrobic:) jak by mi ktos podał komende albo przerobił te skrypty był bym wdzieczny :)

Link to comment

Podbijanie tematu, bo jest drugi na liście zamiast pierwszy jest bezcelowe.

Nikt Ci nie odpisuje, ponieważ oczekujesz zrobienia czegoś za Ciebie, kiedy sam nie masz o tym pojęcia, skrypty masz gotowce skądś, takie podejście zniechęca do odpisywania - czas nie jest nieskończony, można go poświęcić na inne rzeczy.

Jeżeli bawisz się w administracje serwerem - zasiądź do nauki, jak każdy z nas, poducz się i przyjdź z konkretym problemem (typu: skrypt wywala się w 33 linijce, w konsoli pisze błąd: "treść błędu", zamiast "chcę to i to, nie mam pojęcia jak to zrobić").

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...