Jump to content

Question


Dimos7

Recommended Posts

  • 9 months later...

I create a script that jailed a player is offline and put a timer and i want to know if the the timer iwll killed if player is off?

function oflinejailPlayer(thePlayer, name, minutes, , reason , ..., _) 
   local query = dbQuery(connection, "SELECT * FROM accounts WHERE name=?", name) 
   local result, num_affected_rows = dbPoll(query, -1) 
   local adminlevel = getElementData(thePlayer, "adminlevel") 
   local minutes = tonumber(minutes) 
   local reason = table.concat({...}, "") 
   if num_affected_rows == 1 then 
      if adminlevel >= 1 then 
         if minutes >= 1 and minutes <= 60 then 
            if reason ~= "" then 
               target = getPlayerFromName(name) 
               dbExec(connection, "UPATE punishments SET type=? and name=? and serial=? and by=? and reason=? and starttime=? and finishtime=?", "jail", name, getPlayerSerial(target), getPlayerName(thePlayer), reason, getRealTime().timestamp, getRealTime().timestamp + minutes * 60) 
              jailPlayer(thePlayer, target, minutes, reason ) 
            else 
               outputChatBox("Use /ojail [name] [minutes] [reason]", thePlayer, 255, 0, 0) 
               return false 
            end 
        else 
           outputChatBox("Jail time is min 1 minute and max 60 minutes", thePlayer, 255, 0, 0) 
           return false 
        end 
    else 
       outputChatBox("You aren't a admin.", thePlayer, 255, 0, 0) 
       return false 
    end 
    else 
       outputChatBox("Name not found!", thePlayer, 255, 0, 0) 
       return false 
    end 
end 
addCommandHandler("ojail", oflinejailPlayer) 

Edited by Guest
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...