Jump to content

Time for use


rogerioexper

Recommended Posts

 

I want to put a time to use the command someone can help me

 

I'm not getting a time between 10 Mintos to use the command

addEventHandler("onPlayerJoin", root, whenJoin)
duty1 = function(l_2_0, l_2_1)
  if isElementWithinMarker(l_2_0, robmarker1) then
    setPlayerWantedLevel(l_2_0, 6)
    triggerClientEvent(root, "playTheSound", root, l_2_0)
    outputChatBox("*Você vai Começar a Traficar No Morro Fique atento...", l_2_0, 0, 255, 0)
    outputChatBox("#FFFF00[Aviso]: #FFFFFFO Jogador " .. getPlayerName(l_2_0) .. "#FFFF00 Esta Traficando na favela de los Santos#FFFF00", root, 255, 255, 255, true)
    setElementPosition(robmarker1, 2607.2707519531, -968.03039550781, 81.985939025879)
    setMarkerSize(Exitdoorrob1, 0)
    local blip1 = createBlipAttachedTo(Doorentryrob1, 23, 2, 0, 255, 0, 0, 0, 7000)
    setTimer(triggerClientEvent, 21000, 1, root, "playTheSound", root, l_2_0)
    setTimer(triggerClientEvent, 42000, 1, root, "playTheSound", root, l_2_0)
    setTimer(triggerClientEvent, 63000, 1, root, "playTheSound", root, l_2_0)
    setTimer(setElementPosition, 200000, 1, robmarker1, 2607.2707519531, -968.03039550781, 81.985939025879)
    setTimer(setMarkerSize, 40000, 1, Exitdoorrob1, 1.5)
    setTimer(givePlayerMoney, 40000, 1, l_2_0, 600)
    setTimer(destroyElement, 200000, 1, blip1)
  else
    outputChatBox("Você nao esta no local de trafico", source, 255, 0, 0)
  end
end

addCommandHandler("traficar", duty1)
Exitdrob1 = function(l_3_0)
  if source == Exitdoorrob1 and getElementType(l_3_0) == "player" then
    fadeCamera(l_3_0, false, 1, 0, 0, 0)
    setTimer(fadeCamera, 1000, 1, l_3_0, true, 1)
    setTimer(setElementPosition, 1000, 1, l_3_0, 2607.2707519531, -968.03039550781, 81.985939025879)
    setTimer(setElementInterior, 1000, 1, l_3_0, 2607.2707519531, -968.03039550781, 81.985939025879)
    setTimer(setElementDimension, 1000, 1, l_3_0, 0)
  end
end

 

Link to comment

Hello, please use the Scripting sub-forum for this.

 

You could either use removeCommandHandler or use tables, so if the user is out of the table, then this user will be able to use the command, but if the user is inside the table, then this same user won't be able to use the command (use setTimer for 10 minutes to remove the user from the table).

 

Example:

notAllowedUsers = { }
notAllowedUsers[player] = true --use this when the user executes the command.
if not notAllowedUsers[player] then --use this to check if the player is NOT in the table (so he can use the command)

 

And then just use a timer for 600000 seconds (10 mins), when the time passes, do this:

notAllowedUsers[player] = nil

 

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