Author Topic: AWarn Doesent Work?  (Read 7906 times)

0 Members and 1 Guest are viewing this topic.

Offline Livaco

  • Full Member
  • ***
  • Posts: 133
  • Karma: -37
    • Livaco
AWarn Doesent Work?
« on: March 24, 2015, 02:35:03 PM »
Fixed NO Longer Needed
« Last Edit: April 02, 2015, 04:23:06 AM by Livaco »
Here To Help And Be Happy And Help :)

My Website
My Addons
PermaBanV1.0

Quote from:  Livaco on April 12 at 9:10:20 PM
I May Be Dum But Am Still Better Then The Rest

Livaco Products©

Offline Caustic Soda-Senpai

  • Sr. Member
  • ****
  • Posts: 469
  • Karma: 54
  • <Insert something clever here>
    • Steam Page
Re: AWarn Doesent Work?
« Reply #1 on: March 24, 2015, 05:15:31 PM »
I'm going to ask the obvious question: Did you restart your server?
Once you get to know me, you'll find you'll have never met me at all.

Offline Livaco

  • Full Member
  • ***
  • Posts: 133
  • Karma: -37
    • Livaco
Re: AWarn Doesent Work?
« Reply #2 on: March 24, 2015, 05:22:16 PM »
Yes I typed in the console restart
Here To Help And Be Happy And Help :)

My Website
My Addons
PermaBanV1.0

Quote from:  Livaco on April 12 at 9:10:20 PM
I May Be Dum But Am Still Better Then The Rest

Livaco Products©

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: AWarn Doesent Work?
« Reply #3 on: March 24, 2015, 05:46:14 PM »
It doesn't work in Single Player.
The error in your console indicates that you tested this in SinglePlayer.

You need to run this on a server for it to work.

Offline Livaco

  • Full Member
  • ***
  • Posts: 133
  • Karma: -37
    • Livaco
Re: AWarn Doesent Work?
« Reply #4 on: March 25, 2015, 12:55:36 AM »
I've got the minge bots addon and I'm spawning them in on a local
Here To Help And Be Happy And Help :)

My Website
My Addons
PermaBanV1.0

Quote from:  Livaco on April 12 at 9:10:20 PM
I May Be Dum But Am Still Better Then The Rest

Livaco Products©

Offline Caustic Soda-Senpai

  • Sr. Member
  • ****
  • Posts: 469
  • Karma: 54
  • <Insert something clever here>
    • Steam Page
Re: AWarn Doesent Work?
« Reply #5 on: March 25, 2015, 01:03:43 AM »
It doesn't work in Single Player.

You need to run this on a server for it to work.

Spawning bots in singleplayer doesn't cut it.
Once you get to know me, you'll find you'll have never met me at all.

Offline Livaco

  • Full Member
  • ***
  • Posts: 133
  • Karma: -37
    • Livaco
Re: AWarn Doesent Work?
« Reply #6 on: March 25, 2015, 01:12:54 AM »
no its a local server im trying it on -_-
Here To Help And Be Happy And Help :)

My Website
My Addons
PermaBanV1.0

Quote from:  Livaco on April 12 at 9:10:20 PM
I May Be Dum But Am Still Better Then The Rest

Livaco Products©

Offline Livaco

  • Full Member
  • ***
  • Posts: 133
  • Karma: -37
    • Livaco
Re: AWarn Doesent Work?
« Reply #7 on: March 25, 2015, 01:14:19 AM »
If U Need I Can Give U The Code
« Last Edit: March 25, 2015, 01:37:50 AM by Livaco »
Here To Help And Be Happy And Help :)

My Website
My Addons
PermaBanV1.0

Quote from:  Livaco on April 12 at 9:10:20 PM
I May Be Dum But Am Still Better Then The Rest

Livaco Products©

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: AWarn Doesent Work?
« Reply #8 on: March 25, 2015, 11:14:47 AM »
I'm more interested in any error messages you get. Paste here anything from your console after you try to issue a warning.

Offline Livaco

  • Full Member
  • ***
  • Posts: 133
  • Karma: -37
    • Livaco
Re: AWarn Doesent Work?
« Reply #9 on: March 26, 2015, 05:38:45 AM »
Heres The Consle Code

Code: [Select]
Initial walk and run speeds fetched.
Walk Speed: 250
Run Speed: 500
[Aid15 :)|2|STEAM_0:0:56797092] Lua Error:

[ERROR] addons/ulx/lua/ulx/modules/sh/chat.lua:306: unexpected symbol near '2.'
  1. unknown - addons/ulx/lua/ulx/modules/sh/chat.lua:0

Spawning textscreens...
DLL_MessageEnd:  Refusing to send user message TextMsg of 256 bytes to client, user message size limit is 255 bytes
Requesting texture value from var "$basetexture" which is not a texture value (material: trails/tube)
Requesting texture value from var "$basetexture" which is not a texture value (material: trails/tube)
] bot
Player Bot01 has joined the game
DLL_MessageEnd:  Refusing to send user message TextMsg of 256 bytes to client, user message size limit is 255 bytes
Client "Bot01" spawned in server (BOT)<BOT>.
Requesting texture value from var "$basetexture" which is not a texture value (material: pp/copy)
DLL_MessageEnd:  Refusing to send user message TextMsg of 256 bytes to client, user message size limit is 255 bytes
« Last Edit: March 26, 2015, 05:40:22 AM by Livaco »
Here To Help And Be Happy And Help :)

My Website
My Addons
PermaBanV1.0

Quote from:  Livaco on April 12 at 9:10:20 PM
I May Be Dum But Am Still Better Then The Rest

Livaco Products©

Offline Caustic Soda-Senpai

  • Sr. Member
  • ****
  • Posts: 469
  • Karma: 54
  • <Insert something clever here>
    • Steam Page
Re: AWarn Doesent Work?
« Reply #10 on: March 26, 2015, 01:16:30 PM »
Code: [Select]
[ERROR] addons/ulx/lua/ulx/modules/sh/chat.lua:306: unexpected symbol near '2.'
  1. unknown - addons/ulx/lua/ulx/modules/sh/chat.lua:0

That is an error that needs to be fixed...
Once you get to know me, you'll find you'll have never met me at all.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: AWarn Doesent Work?
« Reply #11 on: March 26, 2015, 03:04:53 PM »
Nothing in that is related to AWarn.

Offline Caustic Soda-Senpai

  • Sr. Member
  • ****
  • Posts: 469
  • Karma: 54
  • <Insert something clever here>
    • Steam Page
Re: AWarn Doesent Work?
« Reply #12 on: March 26, 2015, 05:06:44 PM »
I'm aware that it's not related to AWarn, I'm stating its an error that needs to be fixed. I should have specified that it was an error not related to AWarn.
Once you get to know me, you'll find you'll have never met me at all.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: AWarn Doesent Work?
« Reply #13 on: March 26, 2015, 10:12:36 PM »
and I was responding to Livaco's post, not yours. He created this thread to try and get me to help him 'fix' AWarn2 on his server, but has yet to produce any kind of information to allow me to do so.

Offline Livaco

  • Full Member
  • ***
  • Posts: 133
  • Karma: -37
    • Livaco
Re: AWarn Doesent Work?
« Reply #14 on: March 27, 2015, 01:35:51 AM »
Heres The Code Of awarn_sqlite.lua, If U Need More Just Tell Me

Code: [Select]
local PlayerMeta = FindMetaTable("Player")

function awarn_tbl_exist()
if sql.TableExists("awarn_warnings") then
ServerLog( "AWarn: Warning Table Exists\n" )
else
local query = "CREATE TABLE awarn_warnings ( pid INTEGER PRIMARY KEY AUTOINCREMENT, unique_id varchar(255), admin varchar(255), reason text, date varchar(255) )"
result = sql.Query(query)
ServerLog( "AWarn: Creating Warning Table...\n" )
if sql.TableExists("awarn_warnings") then
ServerLog( "AWarn: Warning Table created sucessfully.\n" )
else
ServerLog( "AWarn: Trouble creating the Warning Table\n" )
ServerLog( "AWarn: " .. sql.LastError( result ).."\n" )
end
end

if sql.TableExists("awarn_playerdata") then
ServerLog( "AWarn: Player Data Table Exists\n" )
else
local query = "CREATE TABLE awarn_playerdata ( unique_id varchar(255), warnings INTEGER, lastwarn varchar(255) )"
result = sql.Query(query)
ServerLog( "AWarn: Creating Player Data Table...\n" )
if sql.TableExists("awarn_playerdata") then
ServerLog( "AWarn: Player Data Table created sucessfully.\n" )
else
ServerLog( "AWarn: Trouble creating the Player Data Table\n" )
ServerLog( "AWarn: " .. sql.LastError( result ).. "\n" )
end
end

if sql.TableExists("awarn_serverdata") then
ServerLog( "AWarn: Server Data Table Exists\n" )
else
local query = "CREATE TABLE awarn_serverdata ( key TEXT, val INTEGER )"
result = sql.Query(query)
ServerLog( "AWarn: Creating Server Data Table...\n" )
if sql.TableExists("awarn_serverdata") then
ServerLog( "AWarn: Server Data Table created sucessfully.\n" )
else
ServerLog( "AWarn: Trouble creating the Server Data Table\n" )
ServerLog( "AWarn: " .. sql.LastError( result ).. "\n" )
end
end
end


function awarn_reloadtables()
if sql.TableExists("awarn_warnings") then
local query = "DROP TABLE awarn_warnings"
result = sql.Query(query)
end
if sql.TableExists("awarn_playerdata") then
local query = "DROP TABLE awarn_playerdata"
result = sql.Query(query)
end
awarn_tbl_exist()
end

function awarn_saveservervalue( key, val )
--print( key .. " " .. val )
local query = "SELECT * FROM awarn_serverdata WHERE key='" .. key .. "'"
result = sql.QueryRow(query)

--PrintTable(result)

if not result then
local query = "INSERT INTO awarn_serverdata VALUES ( '" ..key.. "', '" .. val .. "' )"
result = sql.Query(query)
SetGlobalInt( key, val )
net.Start("AWarnChatMessage") net.WriteTable({ Color(60,60,60), "[", Color(30,90,150), "AWarn", Color(60,60,60), "] ", Color(255,255,255), "Value ", Color(0,0,0), "(" .. key .. ") ", Color(255,255,255), "has been set to ", Color(0,0,0), "(" .. val .. ")" }) net.Broadcast()
if not result then
ServerLog( "AWarn: Server Setting (" .. key .. ") set to " .. val .. "\n")
else
ServerLog( "AWarn: Problem setting value for (" .. key .. ")\n")
ServerLog( "AWarn: " .. sql.LastError( result ).. "\n" )
end
else
local query = "UPDATE awarn_serverdata SET val='" .. val .. "' WHERE key='" ..key.. "'"
result = sql.Query(query)
SetGlobalInt( key, val )
net.Start("AWarnChatMessage") net.WriteTable({ Color(60,60,60), "[", Color(30,90,150), "AWarn", Color(60,60,60), "] ", Color(255,255,255), "Value ", Color(0,0,0), "(" .. key .. ") ", Color(255,255,255), "has been set to ", Color(0,0,0), "(" .. val .. ")" }) net.Broadcast()
if not result then
ServerLog( "AWarn: Server Setting (" .. key .. ") set to " .. val .. "\n")
else
ServerLog( "AWarn: Problem setting value for (" .. key .. ")\n")
ServerLog( "AWarn: " .. sql.LastError( result ).. "\n" )
end
end
end


function awarn_setserverdefaultvalues()

for k, v in pairs( AWarn.DefaultValues ) do
local query = "SELECT * FROM awarn_serverdata WHERE key='" .. k .. "'"
result = sql.QueryRow(query)

if result then
awarn_saveservervalue( k, result.val )
else
awarn_saveservervalue( k, v )
end
end

end
hook.Add( "InitPostEntity", "AWarn_SetServerDefaults", awarn_setserverdefaultvalues )

function awarn_addwarning( uid, reason, admin )
reason = sql.SQLStr( reason )
admin = sql.SQLStr( admin )
date = os.date()
local query = "INSERT INTO awarn_warnings VALUES (NULL, '" ..uid.. "', " ..admin.. ", " ..reason.. ", '" ..date.. "')"
--print(query)
result = sql.Query(query)
end

function awarn_incwarnings( ply )
local uid = ply:SteamID64()

local query = "SELECT warnings FROM awarn_playerdata WHERE unique_id='" .. uid .. "'"
result = sql.QueryRow(query)

local wnum = 0

if not result then
wnum = 1
local query = "INSERT INTO awarn_playerdata VALUES ( '" ..uid.. "', '" .. wnum .. "', '" .. os.time() .."' )"
result = sql.Query(query)
else
wnum = tonumber(result.warnings) + 1
local query = "UPDATE awarn_playerdata SET warnings='" .. wnum .. "', lastwarn='" .. os.time() .."' WHERE unique_id='" ..uid.. "'"
result = sql.Query(query)
end

awarn_checkkickban( ply )
awarn_decaywarns( ply )
end

function awarn_incwarningsid( uid )

local query = "SELECT warnings FROM awarn_playerdata WHERE unique_id='" .. uid .. "'"
result = sql.QueryRow(query)

local wnum = 0

if not result then
wnum = 1
local query = "INSERT INTO awarn_playerdata VALUES ( '" ..uid.. "', '" .. wnum .. "', '" .. os.time() .."' )"
result = sql.Query(query)
else
wnum = tonumber(result.warnings) + 1
local query = "UPDATE awarn_playerdata SET warnings='" .. wnum .. "', lastwarn='" .. os.time() .."' WHERE unique_id='" ..uid.. "'"
result = sql.Query(query)
end

end

function awarn_decwarnings( ply, admin )
local uid = ply:SteamID64()

local query = "SELECT warnings FROM awarn_playerdata WHERE unique_id='" .. uid .. "'"
result = sql.QueryRow(query)

local wnum = 0

if not result then
if admin then AWSendMessage(admin, "AWarn: This player has no warnings on record") end
else
if tonumber(result.warnings) > 0 then
wnum = tonumber(result.warnings) - 1
local query = "UPDATE awarn_playerdata SET warnings='" .. wnum .. "', lastwarn='" .. os.time() .."' WHERE unique_id='" ..uid.. "'"
result = sql.Query(query)
            AWSendMessage( admin, "AWarn: Reduced " .. ply:Nick() .. "'s active warnings by 1!")
else
if admin then AWSendMessage(admin, "AWarn: This player has 0 active warnings already") end
end
end
end

function awarn_decwarningsid( uid, admin )

local query = "SELECT warnings FROM awarn_playerdata WHERE unique_id='" .. uid .. "'"
result = sql.QueryRow(query)

local wnum = 0

if not result then
if admin then AWSendMessage(admin, "AWarn: This player has no warnings on record") end
else
if tonumber(result.warnings) > 0 then
wnum = tonumber(result.warnings) - 1
local query = "UPDATE awarn_playerdata SET warnings='" .. wnum .. "', lastwarn='" .. os.time() .."' WHERE unique_id='" ..uid.. "'"
result = sql.Query(query)
            AWSendMessage( admin, "AWarn: Reduced " .. tostring(uid) .. "'s active warnings by 1!")
else
if admin then AWSendMessage(admin, "AWarn: This player has 0 active warnings already") end
end
end
end

function awarn_setwarnings( ply, num )
local uid = ply:SteamID64()

local query = "SELECT warnings FROM awarn_playerdata WHERE unique_id='" .. uid .. "'"
result = sql.QueryRow(query)

local wnum = 0

if not result then
local query = "INSERT INTO awarn_playerdata VALUES ( '" ..uid.. "', '" .. num .. "', '" .. os.time() .."' )"
result = sql.Query(query)
else
local query = "UPDATE awarn_playerdata SET warnings='" .. num .. "' WHERE unique_id='" ..uid.. "'"
result = sql.Query(query)
end
end

function awarn_delwarnings( ply, admin )
local uid = ply:SteamID64()

local query = "SELECT warnings FROM awarn_playerdata WHERE unique_id='" .. uid .. "'"
result = sql.QueryRow(query)

if not result then
AWSendMessage(admin, "AWarn: This player has no warnings on record")
else
local query = "DELETE FROM awarn_playerdata WHERE unique_id='" ..uid.. "'"
result = sql.Query(query)

local query = "DELETE FROM awarn_warnings WHERE unique_id='" ..uid.. "'"
result = sql.Query(query)

AWSendMessage(admin, "AWarn: Cleared all warnings for player: " .. ply:Nick() )
end
end

function awarn_delwarnings( ply, admin )
local uid = ply:SteamID64()

local query = "SELECT warnings FROM awarn_playerdata WHERE unique_id='" .. uid .. "'"
result = sql.QueryRow(query)

if not result then
AWSendMessage(admin, "AWarn: This player has no warnings on record")
else
local query = "DELETE FROM awarn_playerdata WHERE unique_id='" ..uid.. "'"
result = sql.Query(query)

local query = "DELETE FROM awarn_warnings WHERE unique_id='" ..uid.. "'"
result = sql.Query(query)

AWSendMessage(admin, "AWarn: Cleared all warnings for player: " .. ply:Nick() )
end
end

function awarn_delwarningsid( uid, admin )

local query = "SELECT warnings FROM awarn_playerdata WHERE unique_id='" .. uid .. "'"
result = sql.QueryRow(query)

if not result then
AWSendMessage(admin, "AWarn: This player has no warnings on record")
else
local query = "DELETE FROM awarn_playerdata WHERE unique_id='" ..uid.. "'"
result = sql.Query(query)

local query = "DELETE FROM awarn_warnings WHERE unique_id='" ..uid.. "'"
result = sql.Query(query)

AWSendMessage(admin, "AWarn: Cleared all warnings for player: " .. tostring(uid) )
end
end

function awarn_delsinglewarning( admin, warningid )

local query = "SELECT * FROM awarn_warnings WHERE pid=" .. warningid
result = sql.QueryRow(query)

if not result then
AWSendMessage(admin, "AWarn: Record for this warning ID not found")
return
end

local query = "DELETE FROM awarn_warnings WHERE pid=" .. warningid
result = sql.Query( query )

end

function awarn_getwarnings( ply )
local uid = ply:SteamID64()

local query = "SELECT warnings FROM awarn_playerdata WHERE unique_id='" .. uid .. "'"
result = sql.QueryRow(query)

local wnum = 0

if not result then
wnum = 0
else
wnum = result.warnings
end


return tonumber(wnum)
end

function awarn_getlastwarn( ply )
local uid = ply:SteamID64()

local query = "SELECT lastwarn FROM awarn_playerdata WHERE unique_id='" .. uid .. "'"
result = sql.QueryRow(query)

local lastwarn = "NONE"

if not result then
lastwarn = "NONE"
else
lastwarn = result.lastwarn
end

return tostring(lastwarn)
end

function awarn_sendwarnings( ply, target_ply )
local uid = target_ply:SteamID64()
local warns = awarn_getwarnings( target_ply )

local query = "SELECT * FROM awarn_warnings WHERE unique_id='" .. uid .. "'"
result = sql.Query(query)

--print(warns)
if result then
net.Start("SendPlayerWarns")
net.WriteTable( result )
net.WriteInt( warns, 32 )
net.Send( ply )
else
result = {}
net.Start("SendPlayerWarns")
net.WriteTable( result )
net.WriteInt( warns, 32 )
net.Send( ply )
end
end

function awarn_gettotalwarnings( ply )
local uid = ply:SteamID64()
local query = "SELECT * FROM awarn_warnings WHERE unique_id='" .. uid .. "'"
result = sql.Query( query )

if result then
return #result
else
return 0
end
end

function awarn_sendownwarnings( ply, target_ply )
local uid = ply:SteamID64()
local warns = awarn_getwarnings( ply )

local query = "SELECT * FROM awarn_warnings WHERE unique_id='" .. uid .. "'"
result = sql.Query(query)

--print(warns)
if result then
net.Start("SendOwnWarns")
net.WriteTable( result )
net.WriteInt( warns, 32 )
net.Send( ply )
else
result = {}
net.Start("SendOwnWarns")
net.WriteTable( result )
net.WriteInt( warns, 32 )
net.Send( ply )
end
end
Here To Help And Be Happy And Help :)

My Website
My Addons
PermaBanV1.0

Quote from:  Livaco on April 12 at 9:10:20 PM
I May Be Dum But Am Still Better Then The Rest

Livaco Products©