Jump to content

DrawText time jail


Estevam2d

Recommended Posts

  
seconds = 70 
setTimer(function () 
 seconds = seconds - 1  
if seconds = 0 then removeEventHandler("onClientRender",root, drawing) end 
end ,1 ,seconds) 
  
addEventHandler("onClientRender",root, drawing) 
  
function drawing() 
dxDrawText(seconds.." Seconds left", x,y,h,w,--[[put your own dimensions]] ,1) 
end 
  

Link to comment

I'm trying to call the server side of the draw but is not going

addEvent("horariodesaida",true)  
addEventHandler("horariodesaida",root,  
function() 
seconds = 70 
setTimer(function () 
 seconds = seconds - 1 
if seconds = 0 then removeEventHandler("onClientRender",root, drawing) end 
end 
end ,1 ,seconds) 
addEventHandler("onClientRender",root, drawing) 
) 
function drawing() 
dxDrawText(seconds.." Seconds left", 198, 158 ,1003, 90, 3,1) 
end 

Link to comment

move onClientRender event to the function above it.\

Also you didn't end the function

edit:

just make it like this:

  
addEvent("horariodesaida",true) 
addEventHandler("horariodesaida",root, 
function() 
seconds = 70 
setTimer(function () 
 seconds = seconds - 1 
if seconds = 0 then removeEventHandler("onClientRender",root, drawing) end 
end 
end ,1 ,seconds) 
addEventHandler("onClientRender",root, drawing) 
end 
) 
function drawing() 
dxDrawText(seconds.." Seconds left", 198, 158 ,1003, 90, 3,1) 
end 
  

Link to comment

:oops: I know not to use dxDrawText can someone help me put a count in jail?

I wanted to put a time on the screen when the source is stuck on the side of the server only for a player :cry:

function policeJob ( attacker, attackerweapon, bodypart, loss ) 
 if attacker and getElementType(attacker) == "player" then 
        theTeam = getPlayerTeam ( attacker ) 
        theWL = getPlayerWantedLevel ( source ) 
        theSkin = getElementModel ( attacker ) 
        if (attackerweapon == 3) and (loss > 2 ) and (theWL > 0) then  
            if  getTeamName( theTeam ) == "Policia Militar" or getTeamName( theTeam ) == "R.O.T.A" or getTeamName( theTeam ) == "FBI" or getTeamName( theTeam ) == "Exercito" then       
              if (getPlayerWantedLevel(source) == 1) then  
                if ( attacker ) and ( attacker ~= source ) then 
                local aScore = getElementData(attacker, 'Players Presos') or 0 
                setElementData(attacker, 'Players Presos', aScore +1) 
                givePlayerMoney(attacker, 1500) 
                setElementPosition (source, 197.73651123047,162.57513427734,1003.0299682617, true) 
                setElementInterior ( source, 3) 
                theName = getPlayerName ( source ) 
                theCop = getPlayerName ( attacker ) 
                triggerClientEvent("horariodesaida", source) 
                outputChatBox ( "Voce foi preso pelo policial "..theCop.. " por 1 minuto, nao tente escapar ou voce ficara bugado.", source ) 
                exports.killmessages:outputMessage("*"..theCop.. " Prendeu o Criminoso " ..theName.." (Com 1 Estrela)", root, 10, 118, 240, true) 
                exports.killmessages:outputMessage("*"..theName.." Voce ficara preso por 1 minuto aguarde sua saida.", source, 255, 15, 15, true) 
                local playeraccount = getPlayerAccount ( attacker ) 
                setPlayerWantedLevel (attacker, 0) 
                setPlayerWantedLevel (source, 0) 
                setTimer ( setElementPosition, 60000, 1, source, 198.60311889648,158.21235656738,1003.0234375)     
                setElementInterior ( source, 3) 
               end 
                end 
            end 
        end 
    end 
    addEventHandler ("onPlayerDamage", getRootElement(), policeJob) 

Link to comment

Worked? Where ? Not possible, setTimer with 1? This is not seconds foolishness!

  
  
addEvent("horariodesaida",true) 
addEventHandler("horariodesaida",root, 
function() 
seconds = 70 
setTimer(function () 
 seconds = seconds - 1 
if seconds == 0 then removeEventHandler("onClientRender",root, drawing) end 
end 
end ,1000 ,seconds) 
addEventHandler("onClientRender",root, drawing) 
end 
) 
function drawing() 
dxDrawText(seconds.." seconds left!", 198, 158 ,1003, 90, 3,1) 
end 
  

Link to comment

're not decreasing screen time :oops:

function createText ( ) 
local seconds = 60 
setTimer(function () 
seconds = seconds - 1 
end ,1000 , seconds) 
local sWidth,sHeight = guiGetScreenSize() 
local sw,sh = 1280,960 
dxDrawText("Saira em:", 500/sw*sWidth, 844/sh*sHeight, 1215/sw*sWidth, 905/sh*sHeight, tocolor(195, 195, 195, 255), 2.30, "pricedown", "left", "top", false, false, true, false, false) 
dxDrawText("."..seconds.." Segundos", 800/sw*sWidth, 844/sh*sHeight, 1215/sw*sWidth, 905/sh*sHeight, tocolor(195, 195, 195, 255), 2.30, "pricedown", "left", "top", false, false, true, false, false) 
end 
function HandleTheRendering ( ) 
    addEventHandler ( "onClientRender", root, createText ) 
end 
addEvent( "onGreeting", true ) 
addEventHandler( "onGreeting", localPlayer, HandleTheRendering )r", root, createText ) 
end 
addEvent( "onGreeting", true ) 
addEventHandler( "onGreeting", localPlayer, HandleTheRendering ) 
 

Link to comment
  
seconds = 60 
function createText ( ) 
  
setTimer(function () 
seconds = seconds - 1 
end, 1000, seconds) 
local sWidth,sHeight = guiGetScreenSize() 
local sw,sh = 1280,960 
  
function createText() 
dxDrawText("Saira em:", 500/sw*sWidth, 844/sh*sHeight, 1215/sw*sWidth, 905/sh*sHeight, tocolor(195, 195, 195, 255), 2.30, "pricedown", "left", "top", false, false, true, false, false) 
dxDrawText("."..seconds.." Segundos", 800/sw*sWidth, 844/sh*sHeight, 1215/sw*sWidth, 905/sh*sHeight, tocolor(195, 195, 195, 255), 2.30, "pricedown", "left", "top", false, false, true, false, false) 
end 
  
function HandleTheRendering ( ) 
    addEventHandler ( "onClientRender", root, createText ) 
end 
addEvent( "onGreeting", true ) 
addEventHandler( "onGreeting", localPlayer, HandleTheRendering ) 
  
  

Link to comment
  
  
seconds = 60 
function createText ( ) 
seconds = 60 
setTimer(function () 
seconds = seconds - 1 
end, 1000, seconds) 
local sWidth,sHeight = guiGetScreenSize() 
local sw,sh = 1280,960 
  
function createText() 
dxDrawText("Saira em:", 500/sw*sWidth, 844/sh*sHeight, 1215/sw*sWidth, 905/sh*sHeight, tocolor(195, 195, 195, 255), 2.30, "pricedown", "left", "top", false, false, true, false, false) 
dxDrawText("."..seconds.." Segundos", 800/sw*sWidth, 844/sh*sHeight, 1215/sw*sWidth, 905/sh*sHeight, tocolor(195, 195, 195, 255), 2.30, "pricedown", "left", "top", false, false, true, false, false) 
end 
  
function HandleTheRendering ( ) 
    addEventHandler ( "onClientRender", root, createText ) 
end 
addEvent( "onGreeting", true ) 
addEventHandler( "onGreeting", localPlayer, HandleTheRendering ) 
  
  
  

Link to comment
local Count = 0 
local Start = getTickCount( ) 
local sx, sy = guiGetScreenSize( ) 
  
function Render( ) 
    local Now = getTickCount( ) 
    if Now >= Start+1000 then 
        if Count == 10 then 
            -- Finish Time 
            removeEventHandler("onClientRender", root, Render) 
        else 
            Count = Count + 1 
            Start = getTickCount( ) 
        end 
    end 
    dxDrawText(Count, sx/2, sy/2, 0, 0) 
end 
addEventHandler("onClientRender", root, Render) 

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...