Jump to content

I need help with my script


Sasu

Recommended Posts

Hello! I need help with my script.

Server-side:

function suicidar() 
    setTimer( 
    function(sourcePlayer) 
        killPed(sourcePlayer) 
    end 
    , 10000, 1 
    ) 
end 
addEvent( "onPlayerSuicidio", true ) 
addEventHandler( "onPlayerSuicidio", getRootElement(), suicidar ) 

Client-side:

  
addEventHandler("onClientResourceStart", resourceRoot, 
    function()     
    end 
) 
  
addCommandHandler( "kill", 
    function() 
    addEventHandler("onClientRender", getLocalPlayer(),  
    function() 
        dxDrawRectangle(413, 571, 517, 30, tocolor(0, 0, 0, 145), true) 
        dxDrawText("Espera 10 segundos y moriras.", 416, 571, 859, 593, tocolor(255, 0, 0, 255), 1, "bankgothic", "left", "top", false, false, true, false, false) 
    triggerServerEvent ( "onPlayerSuicidio", getLocalPlayer() )  
    end 
    ) 
    end 
 ) 
  

I have any error on debugscript 3. I need that when a player type /kill command, appear dxDrawText and dissapear in 10 seconds.

Thank you very much.

Link to comment

Try this

Client

function text ( ) 
    dxDrawRectangle(413, 571, 517, 30, tocolor(0, 0, 0, 145), true) 
    dxDrawText("Espera 10 segundos y moriras.", 416, 571, 859, 593, tocolor(255, 0, 0, 255), 1, "bankgothic", "left", "top", false, false, true, false, false) 
end 
  
addCommandHandler( "kill", 
    function ( ) 
        addEventHandler ( "onClientRender", root, text ) 
        triggerServerEvent ( "onPlayerSuicidio", localPlayer ) 
        setTimer ( 
            function ( ) 
                removeEventHandler ( "onClientRender", root, text ) 
            end, 10000, 1 
        ) 
    end 
) 

Server

function suicidar ( ) 
    setTimer ( killPed, 10000, 1, source ) 
end 
addEvent( "onPlayerSuicidio", true ) 
addEventHandler( "onPlayerSuicidio", root, suicidar ) 

Link to comment
Try this

Client

function text ( ) 
    dxDrawRectangle(413, 571, 517, 30, tocolor(0, 0, 0, 145), true) 
    dxDrawText("Espera 10 segundos y moriras.", 416, 571, 859, 593, tocolor(255, 0, 0, 255), 1, "bankgothic", "left", "top", false, false, true, false, false) 
end 
  
addCommandHandler( "kill", 
    function ( ) 
        addEventHandler ( "onClientRender", root, text ) 
        triggerServerEvent ( "onPlayerSuicidio", localPlayer ) 
        setTimer ( 
            function ( ) 
                removeEventHandler ( "onClientRender", root, text ) 
            end, 10000, 1 
        ) 
    end 
) 

Server

function suicidar ( ) 
    setTimer ( killPed, 10000, 1, source ) 
end 
addEvent( "onPlayerSuicidio", true ) 
addEventHandler( "onPlayerSuicidio", root, suicidar ) 

Thank you very very much Castro. :D:D

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