Jump to content

How to mutliply (math.)


Recommended Posts

For Example I Mean Like 3600 Is 1 Hour In Seconds But How Can I Set It So If I Typed In /ban Joe 2 it would ban the player for 2 hours

function ban(player, command, target, hours, reason) 
    local targetPlayer = getPlayerFromNamePart( target ) 
    local banreason = table.concat({reason}, " ") 
    -- 1 Hour = 3600 Seconds 
    local bantheplayer = banPlayer ( targetPlayer, true, false, true, player,  ) 
    if ( hasObjectPermissionTo ( player, "function.aexec" ) ) then 
  

Link to comment
Guest Guest4401

3600 * hours = seconds.

addCommandHandler("ban", 
    function(player,command,target,hours,...) 
        local target = getPlayerFromNamePart(target) 
        local banreason = table.concat({...}, " ") 
        if target then 
            banPlayer(target,true,false,true,player,banreason,(tonumber(hours) or 0)*3600) 
        else 
            outputChatBox('Player not found.',player,255,0,0,false) 
        end 
    end 
) 

Edited by Guest4401
Link to comment
Guest Guest4401
3600 * seconds = hours.

so

local banhours = 3600 * hours  

Did a typing error in hurry.

3600 * hours = seconds

Anyway, added the code in my previous post.

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