Jump to content

simple redirectPlayer problem


Recommended Posts

i've tried editing it now just for a bit and it gives me a non sense error!

function forceRedirectPlayer(who,commandName,thePlayer) 
        if hasObjectPermissionTo ( player, "function.banPlayer", true ) then 
        redirectPlayer( who, "192.168.1.64", 22003 ) 
        else 
        cancelEvent() and outputChatBox("You cannot use that command.",thePlayer,255,0,0) 
    end 
end 
addCommandHandler("freconnect",forceRedirectPlayer) 

[18:21:32] SCRIPT ERROR: test\freconnect_s.lua:5: unexpected symbol near

'and'

[18:21:32] ERROR: Loading script failed: test\freconnect_s.lua:5: unexpe

cted symbol near 'and'

please help

Link to comment

You don't need that "and" on line 5

try this:

function forceRedirectPlayer(player,_, who) 
    if not who then return end 
    if hasObjectPermissionTo ( player, "function.banPlayer", true ) then 
        who = getPlayerFromName(who) 
        if who then 
            redirectPlayer( who, "192.168.1.64", 22003 ) 
        end 
    else 
        cancelEvent() 
        outputChatBox("You cannot use that command.",player,255,0,0) 
    end 
end 
addCommandHandler("freconnect",forceRedirectPlayer) 

Edited by Guest
Link to comment
You don't need that "and" on line 5

try this:

function forceRedirectPlayer(who,commandName) 
    if hasObjectPermissionTo ( player, "function.banPlayer", true ) then 
        redirectPlayer( who, "192.168.1.64", 22003 ) 
    else 
        cancelEvent() 
        outputChatBox("You cannot use that command.",player,255,0,0) 
    end 
end 
addCommandHandler("freconnect",forceRedirectPlayer) 

lol, it doesn't let me force reconnect myself while loggined in as admin

[18:37:13] WARNING: test\freconnect_s.lua:2: Bad argument @ 'hasObjectPermissionTo'
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...