Every if then statement works except for this if banval2 == 1 then ULib.tsayError( calling_ply, "Can't fgoto. You are banned from fgoto", true ), this statment however is the only one that correlates with the database I made. So basicaly this if then statment is supposed to check to see if a player is banned from using this ulx command(ulx faction_tp) . and before you ask, yea banval2 does = 1, I put debug statements in at the bottom of this function and the right value was printed in console.
function ulx.faction_tp( calling_ply, target_ply )
banval2 = sql.QueryValue("SELECT banval FROM playerGotoBanDB WHERE unique_id = '".. calling_ply:SteamID() .."'")
if not calling_ply:IsValid() then
Msg( "You may not step down into the mortal world from console.\n" )
return
end
if target_ply:get_faction_id() != calling_ply:get_faction_id() then
ULib.tsayError( calling_ply, "Can't fgoto. You are not in the same faction.", true )
return
end
if banval2 == 1 then
ULib.tsayError( calling_ply, "Can't fgoto. You are banned from fgoto", true )
return
end
if fTPOption == 1 then
ULib.tsayError( calling_ply, "Can't fgoto. fgoto has been disabled", true )
return
end
if ulx.getExclusive( calling_ply, calling_ply ) then
ULib.tsayError( calling_ply, ulx.getExclusive( calling_ply, calling_ply ), true )
return
end
if not target_ply:Alive() then
ULib.tsayError( calling_ply, target_ply:Nick() .. " is dead!", true )
return
end
if not calling_ply:Alive() then
ULib.tsayError( calling_ply, "You are dead!", true )
return
end
if target_ply:InVehicle() and calling_ply:GetMoveType() ~= MOVETYPE_NOCLIP then
ULib.tsayError( calling_ply, "Target is in a vehicle! Noclip and use this command to force a goto.", true )
return
end
local newpos = playerSend( calling_ply, target_ply, calling_ply:GetMoveType() == MOVETYPE_NOCLIP )
if not newpos then
ULib.tsayError( calling_ply, "Can't find a place to put you! Noclip and use this command to force a goto.", true )
return
end
if calling_ply:InVehicle() then
calling_ply:ExitVehicle()
end
local newang = (target_ply:GetPos() - newpos):Angle()
calling_ply:SetPos( newpos )
calling_ply:SetEyeAngles( newang )
calling_ply:SetLocalVelocity( Vector( 0, 0, 0 ) ) -- Stop!
print(banval2)
print(calling_ply:SteamID())
ulx.fancyLogAdmin( calling_ply, "#A teleported to #T", target_ply, "In the faction of", target_ply:get_faction_id() )
end
print(1)--1 appears in console
print("1") --1 appears in console
i think banval2 is a string, not a number
try
if banval2 == "1" then
ULib.tsayError( calling_ply, "Can't fgoto. You are banned from fgoto", true )
return
end
Thank you, I did not think about that, do you think you could possible help me test it. I need someone and everyone is currently asleep.
https://discord.gg/BhEjBA
Sorry, you need to Log In to post a reply to this thread.