Set permanent spawnpoints that override map spawnpoints.

It has recently come to me that I need a script that contains a console command for each of these things:

  1. Set a spawnpoint where I’m looking.
  2. Toggle the ability to see a green X where all the spawnpoints are.
  3. Clear all spawnpoints.

The spawnpoints should override map spawnpoints, as the title says. Thank you in advance!

Done it for ya, worked and fully tested

Commands;
spawnpoint_create - Create a spawnpoint where you are aiming
spawnpoint_remove - Remove all ‘real’ spawnpoints
spawnpoint_reset - Re-create all ‘real’ spawnpoints
spawnpoint_remove_custom - Remove the custom spawnpoint you’re on top of ( right after you spawn on it - don’t move )
spawnpoint_remove_customs - Remove all custom spawnpoints

[lua]function CreateSpawn( ply )
if ply:IsAdmin() then else return end

local trace = ply:GetEyeTrace()
local spawnpoint = ents.Create( "info_player_start" )
spawnpoint:SetPos( trace.HitPos )
spawnpoint:Spawn()
spawnpoint.Custom = true

ply:PrintMessage( HUD_PRINTCONSOLE, "Created a new Spawnpoint." )

end
concommand.Add( “spawnpoint_create”, CreateSpawn )

function RemoveRealSpawns( ply )
if ply:IsAdmin() then else return end

if not RealSpawnPoints then
    RealSpawnPoints = {}
    RealSpawnPointsA = {}
else
    return
end

for k, v in pairs( ents.GetAll() ) do
    if v:GetClass() == "info_player_start" then
        if not v.Custom then
            RealSpawnPoints[ #RealSpawnPoints+1 ] = v:GetPos()
            RealSpawnPointsA[ #RealSpawnPointsA+1 ] = v:GetAngles()
            v:Remove()
        end
    end
end

ply:PrintMessage( HUD_PRINTCONSOLE, "Removed "..#RealSpawnPoints.." real Spawnpoints." )

end
concommand.Add( “spawnpoint_remove”, RemoveRealSpawns )

function RemoveCustomSpawns( ply )
if ply:IsAdmin() then else return end

for k, v in pairs( ents.GetAll() ) do
    if v:GetClass() == "info_player_start" then
        if v.Custom then
            v:Remove()
        end
    end
end

ply:PrintMessage( HUD_PRINTCONSOLE, "Removed custom Spawnpoints." )

end
concommand.Add( “spawnpoint_remove_customs”, RemoveCustomSpawns )

function RemoveCustomSpawn( ply )
if ply:IsAdmin() then else return end

for k, v in pairs( ents.FindInSphere( ply:GetPos(), 10 ) ) do
    if v:GetClass() == "info_player_start" then
        if v.Custom then
            v:Remove()
            ply:PrintMessage( HUD_PRINTCONSOLE, "Removed custom Spawnpoint." )
        end
    end
end

end
concommand.Add( “spawnpoint_remove_custom”, RemoveCustomSpawn )

function CreateResetReal( ply )
if ply:IsAdmin() then else return end

if not RealSpawnPoints then
    return
end

for i = 1, #RealSpawnPoints do
    local spawnpoint = ents.Create( "info_player_start" )
    spawnpoint:SetPos( RealSpawnPoints[ i ] )
    spawnpoint:SetAngles( RealSpawnPointsA[ i ] )
    spawnpoint:Spawn()
end

RealSpawnPoints = nil
RealSpawnPointsA = nil
ply:PrintMessage( HUD_PRINTCONSOLE, "Reset real Spawnpoints." )

end
concommand.Add( “spawnpoint_reset”, CreateResetReal )

function EmergencySpawnPoint()
for k, v in pairs( player.GetAll() ) do
Spawns = 0
for k, v in pairs( ents.GetAll() ) do
if v:GetClass() == “info_player_start” then
Spawns = Spawns + 1
end
end

    if Spawns <= 0 then
        local spawnpoint = ents.Create( "info_player_start" )
        spawnpoint:SetPos( v:GetPos() )
        spawnpoint:Spawn()
        spawnpoint.Custom = true
        for _, ply in pairs( player.GetAll() ) do
            ply:PrintMessage( HUD_PRINTCONSOLE, "Created emergency Spawn." )
        end
    end
    Spawns = nil
end

end
hook.Add( “Think”, “EmergencySpawnPoint”, EmergencySpawnPoint )[/lua]

Oh, yeah, I forgot about the green X thing - Sorry.

Whoa, that was fast. Thank you. Don’t worry about the green X thing, don’t need it that much anyway.

[editline]2nd February 2011[/editline]

Oh, these will save after the server restarts, right?

Oh, no, sorry - I could probably do that though… If you want?

I really do want it; it’s very necessary for my server. Thank you so much in advance, you’ve been very helpful and even if you decide not to do this I still feel indebted to you. It’s people like you that do these random lua script requests that keep me coming back to this game, and I thank you for that.

Nah sorry mate, couldn’t do it, I’m not so good with the database stuff. I’ll have another wee go at it tomorrow, see if I can’t get it working for you.
And I agree with the lua scripts making the game more ‘playable’, I’m glad of all these requests 'cause they keep me interested in the game - and I must say you have some pretty good wee ones.

EDIT; Got it working, I think - Test it out. ( I have tested most of it )

[lua]Tablesize = 10000
RemoveRealSpawns = true

function CreateSpawn( ply )
if ply:IsAdmin() then else return end

local trace = ply:GetEyeTrace()
local spawnpoint = ents.Create( "info_player_start" )
spawnpoint:SetPos( trace.HitPos )
spawnpoint:Spawn()
spawnpoint.Custom = true
SaveSpawns( ply, spawnpoint )

ply:PrintMessage( HUD_PRINTCONSOLE, "Created a new Spawnpoint." )

end
concommand.Add( “spawnpoint_create”, CreateSpawn )

function RemoveRealSpawns( ply )
if ply:IsAdmin() then else return end

if not RealSpawnPoints then
    RealSpawnPoints = {}
    RealSpawnPointsA = {}
else
    return
end

for k, v in pairs( ents.GetAll() ) do
    if v:GetClass() == "info_player_start" then
        if not v.Custom then
            RealSpawnPoints[ #RealSpawnPoints+1 ] = v:GetPos()
            RealSpawnPointsA[ #RealSpawnPointsA+1 ] = v:GetAngles()
            v:Remove()
        end
    end
end

ply:PrintMessage( HUD_PRINTCONSOLE, "Removed "..#RealSpawnPoints.." real Spawnpoints." )

end
concommand.Add( “spawnpoint_remove”, RemoveRealSpawns )

function RemoveCustomSpawns( ply )
if ply:IsAdmin() then else return end

for k, v in pairs( ents.GetAll() ) do
    if v:GetClass() == "info_player_start" then
        if v.Custom then
            v:Remove()
        end
    end
end

ply:PrintMessage( HUD_PRINTCONSOLE, "Removed custom Spawnpoints." )

end
concommand.Add( “spawnpoint_remove_customs”, RemoveCustomSpawns )

function RemoveCustomSpawn( ply )
if ply:IsAdmin() then else return end

for k, v in pairs( ents.FindInSphere( ply:GetPos(), 10 ) ) do
    if v:GetClass() == "info_player_start" then
        if v.Custom then
            v:Remove()
            ply:PrintMessage( HUD_PRINTCONSOLE, "Removed custom Spawnpoint." )
        end
    end
end

end
concommand.Add( “spawnpoint_remove_custom”, RemoveCustomSpawn )

function CreateResetReal( ply )
if ply:IsAdmin() then else return end

if not RealSpawnPoints then
    return
end

for i = 1, #RealSpawnPoints do
    local spawnpoint = ents.Create( "info_player_start" )
    spawnpoint:SetPos( RealSpawnPoints[ i ] )
    spawnpoint:SetAngles( RealSpawnPointsA[ i ] )
    spawnpoint:Spawn()
end

RealSpawnPoints = nil
RealSpawnPointsA = nil
ply:PrintMessage( HUD_PRINTCONSOLE, "Reset real Spawnpoints." )

end
concommand.Add( “spawnpoint_reset”, CreateResetReal )

function EmergencySpawnPoint()
for k, v in pairs( player.GetAll() ) do
Spawns = 0
for k, v in pairs( ents.GetAll() ) do
if v:GetClass() == “info_player_start” then
Spawns = Spawns + 1
end
end

    if Spawns <= 0 then
        local spawnpoint = ents.Create( "info_player_start" )
        spawnpoint:SetPos( v:GetPos() )
        spawnpoint:Spawn()
        spawnpoint.Custom = true
        for _, ply in pairs( player.GetAll() ) do
            ply:PrintMessage( HUD_PRINTCONSOLE, "Created emergency Spawn." )
        end
    end
    Spawns = nil
end

end
hook.Add( “Think”, “EmergencySpawnPoint”, EmergencySpawnPoint )

– Database stuff

function GetSpawns( ply )
result = sql.Query( “SELECT number FROM spawnpointss_savess WHERE toggle = ‘1’” )
if (result) then – Any spawnpoints?
result = sql.Query( “SELECT number FROM spawnpointss_savess WHERE map = '”…game.GetMap()…"’" )
if (result) then – Spawnpoints for this map
if RemoveRealSpawns then-- Remove real ones
RealSpawnPoints = {}
RealSpawnPointsA = {}

            for k, v in pairs( ents.GetAll() ) do
                if v:GetClass() == "info_player_start" then
                    if not v.Custom then
                        RealSpawnPoints[ #RealSpawnPoints+1 ] = v:GetPos()
                        RealSpawnPointsA[ #RealSpawnPointsA+1 ] = v:GetAngles()
                        v:Remove()
                    end
                end
            end
        end

        for i = 1, Tablesize do
            result = sql.Query( "SELECT x FROM spawnpointss_savess WHERE number = '"..i.."'" )
            local x = sql.QueryValue( "SELECT x FROM spawnpointss_savess WHERE number = '"..i.."'" )
            local y = sql.QueryValue( "SELECT y FROM spawnpointss_savess WHERE number = '"..i.."'" )
            local z = sql.QueryValue( "SELECT z FROM spawnpointss_savess WHERE number = '"..i.."'" )
            local map = sql.QueryValue( "SELECT map FROM spawnpointss_savess WHERE number = '"..i.."'" )
            local on = sql.QueryValue( "SELECT toggle FROM spawnpointss_savess WHERE number = '"..i.."'" )
            if (result) and game.GetMap() == map then
                if tonumber( on ) == 1 then
                    local spawnpoint = ents.Create( "info_player_start" )
                    spawnpoint:SetPos( Vector( x, y, z ) )
                    spawnpoint:Spawn()
                    spawnpoint.Custom = true
                end
            end
        end
    end
end

end
hook.Add( “PostInitEntities”, “GetSpawns”, GetSpawns )

function SaveSpawns( ply, spawn )
result = sql.Query( “SELECT number FROM spawnpointss_savess WHERE toggle = ‘1’” )

if (result) then else
    query = "CREATE TABLE spawnpointss_savess ( number varchar(255), x varchar(255), y varchar(255), z varchar(255), map varchar(255), toggle varchar(255) )"
    result = sql.Query( query )
end

saved = false
for i = 1, Tablesize do
    if not saved then
        local result = sql.Query( "SELECT x FROM spawnpointss_savess WHERE number = '"..i.."'" )
        if not result then
            sql.Query( "INSERT INTO spawnpointss_savess (`number`, `x`, `y`, `z`, `map`, `toggle`)VALUES ('"..i.."', '"..spawn:GetPos().x.."', '"..spawn:GetPos().y.."', '"..spawn:GetPos().z.."', '"..game.GetMap().."', '1')" )
            saved = true
        end
    end
end

end

function DatabaseRemoveSpawn( ply )
if ply:IsAdmin() then else return end

for k, v in pairs( ents.FindInSphere( ply:GetPos(), 10 ) ) do
    if v:GetClass() == "info_player_start" then
        if v.Custom then
            result = sql.Query( "SELECT x FROM spawnpointss_savess WHERE x = '"..v:GetPos().x.."'" )
            if (result) then
                for i = 1, Tablesize do
                    local x = sql.QueryValue( "SELECT x FROM spawnpointss_savess WHERE number = '"..i.."'" )
                    local y = sql.QueryValue( "SELECT y FROM spawnpointss_savess WHERE number = '"..i.."'" )
                    local z = sql.QueryValue( "SELECT z FROM spawnpointss_savess WHERE number = '"..i.."'" )
                    local map = sql.QueryValue( "SELECT map FROM spawnpointss_savess WHERE number = '"..i.."'" )
                    if ( x and y and z and v:GetPos().x and v:GetPos().y and v:GetPos().z and map ) and math.floor( x ) == math.floor( v:GetPos().x ) and math.floor( y ) == math.floor( v:GetPos().y ) and math.floor( z ) == math.floor( v:GetPos().z ) and game.GetMap() == map then
                        sql.Query( "UPDATE spawnpointss_savess SET toggle = 0 WHERE number = '"..i.."'" )
                        v:Remove()
                        ply:PrintMessage( HUD_PRINTCONSOLE, "Removed custom Spawnpoint "..i.." from Database." )
                    end
                end
            end
        end
    end
end

end
concommand.Add( “spawnpoint_database_remove”, DatabaseRemoveSpawn )[/lua]
I probably went about it wrong, I’m not so good at storing things, but it seems to work alright.

EDIT; Again, discovered a bug - forgot to save the map the spawnpoints were on - should work fine now, code updated.

PostInitEntities

Did it this way so I could use lua_run SpawnpointsInit = nil while testing, rather than reloading to test every time.

hmm, Alright. But your not testing anymore though :stuck_out_tongue:

'Tis true, perhaps I am lazy - I will change it now, then.

It works like it should, however they don’t seem to save after restarts :frowning:

That is some of the most resourceful code I have seen.

Also, if ply:Nick() == “Matthew” LOL?!

I don’t have any admin mods :confused:
Changed them :stuck_out_tongue:

EDIT: Really Fu? They save for me… :confused:

They don’t save, no :frowning: Neither through soft- or hard-restarts. Also, when I reset the map (my server’s version of a clean-up, as it’s more effective), they’re removed, too.

Gonna go test it on multiplayer, see if it still works for me.

EDIT; Sorry for any inconvenience caused, I’ve got it back up and running, and - because I feel bad for wasting your time - I even added the 'Green X’s for you.

It now goes into lua/autorun/

[lua]if CLIENT then
function Spawnpoints_X()
if Spawnpoint_Table then
for i = 1, #Spawnpoint_Table do
if LocalPlayer():IsAdmin() and Spawnpoint_Table[ i ] and not Spawnpoint_Xs then
local pos = Spawnpoint_Table[ i ]:ToScreen()
draw.DrawText( “X”, “TargetID”, pos.x, pos.y, Color( 0, 0, 0, 255 ), 1 )
draw.DrawText( “X”, “TargetID”, pos.x-1, pos.y-1, Color( 0, 80, 15, 200 ), 1 )
end
end
end
end
hook.Add( “HUDPaint”, “Spawnpoints_X”, Spawnpoints_X )

function Spawnpoint_TableUpdate( msg )
    local x = msg:ReadLong()
    local y = msg:ReadLong()
    local z = msg:ReadLong()
    if not Spawnpoint_Table then
        Spawnpoint_Table = {}
    end
    Spawnpoint_Table[ #Spawnpoint_Table+1 ] = Vector( x, y, z )
end
usermessage.Hook( "Spawnpoint_Table", Spawnpoint_TableUpdate )

function Spawnpoint_TableUpdate2( msg )
    local x = msg:ReadLong()
    local y = msg:ReadLong()
    local z = msg:ReadLong()
    if Spawnpoint_Table then
        for i = 1, #Spawnpoint_Table do
            if Spawnpoint_Table[ i ] == Vector( x, y, z ) then
                Spawnpoint_Table[ i ] = nil
            end
        end
    end
end
usermessage.Hook( "Spawnpoint_Table_Remove", Spawnpoint_TableUpdate2 )

function GreenXs( ply )
    if ply:IsAdmin() then else return end

    if Spawnpoint_Xs then
        Spawnpoint_Xs = false
        ply:PrintMessage( HUD_PRINTCONSOLE, "Xs Enabled." )
    else
        Spawnpoint_Xs = true
        ply:PrintMessage( HUD_PRINTCONSOLE, "Xs Disabled." )
    end
end
concommand.Add( "spawnpoint_greenxs", GreenXs )

end

if SERVER then
Tablesize = 10000
RemoveRealSpawns = true

function CreateSpawn( ply )
    if ply:IsAdmin() then else return end

    local trace = ply:GetEyeTrace()
    local spawnpoint = ents.Create( "info_player_start" )
    spawnpoint:SetPos( trace.HitPos )
    spawnpoint:Spawn()
    spawnpoint.Custom = true
    SaveSpawns( spawnpoint )

    ply:PrintMessage( HUD_PRINTCONSOLE, "Created a new Spawnpoint." )
end
concommand.Add( "spawnpoint_create", CreateSpawn )

function RemoveRealSpawns( ply )
    if ply:IsAdmin() then else return end

    if not RealSpawnPoints then
        RealSpawnPoints = {}
        RealSpawnPointsA = {}
    else
        return
    end

    for k, v in pairs( ents.GetAll() ) do
        if v:GetClass() == "info_player_start" then
            if not v.Custom then
                RealSpawnPoints[ #RealSpawnPoints+1 ] = v:GetPos()
                RealSpawnPointsA[ #RealSpawnPointsA+1 ] = v:GetAngles()
                v:Remove()
            end
        end
    end

    ply:PrintMessage( HUD_PRINTCONSOLE, "Removed "..#RealSpawnPoints.." real Spawnpoints." )
end
concommand.Add( "spawnpoint_remove", RemoveRealSpawns )

function RemoveCustomSpawns( ply )
    if ply:IsAdmin() then else return end

    for k, v in pairs( ents.GetAll() ) do
        if v:GetClass() == "info_player_start" then
            if v.Custom then
                v:Remove()
                umsg.Start( "Spawnpoint_Table_Remove", ply )
                    umsg.Long( v:GetPos().x )
                    umsg.Long( v:GetPos().y )
                    umsg.Long( v:GetPos().z )
                umsg.End()
            end
        end
    end

    ply:PrintMessage( HUD_PRINTCONSOLE, "Removed custom Spawnpoints." )
end
concommand.Add( "spawnpoint_remove_customs", RemoveCustomSpawns )

function RemoveCustomSpawn( ply )
    if ply:IsAdmin() then else return end

    for k, v in pairs( ents.FindInSphere( ply:GetPos(), 10 ) ) do
        if v:GetClass() == "info_player_start" then
            if v.Custom then
                v:Remove()
                ply:PrintMessage( HUD_PRINTCONSOLE, "Removed custom Spawnpoint." )
                umsg.Start( "Spawnpoint_Table_Remove", ply )
                    umsg.Long( v:GetPos().x )
                    umsg.Long( v:GetPos().y )
                    umsg.Long( v:GetPos().z )
                umsg.End()
            end
        end
    end
end
concommand.Add( "spawnpoint_remove_custom", RemoveCustomSpawn )

function CreateResetReal( ply )
    if ply:IsAdmin() then else return end

    if not RealSpawnPoints then
        return
    end

    for i = 1, #RealSpawnPoints do
        local spawnpoint = ents.Create( "info_player_start" )
        spawnpoint:SetPos( RealSpawnPoints[ i ] )
        spawnpoint:SetAngles( RealSpawnPointsA[ i ] )
        spawnpoint:Spawn()
    end

    RealSpawnPoints = nil
    RealSpawnPointsA = nil
    ply:PrintMessage( HUD_PRINTCONSOLE, "Reset real Spawnpoints." )
end
concommand.Add( "spawnpoint_reset", CreateResetReal )

function EmergencySpawnPoint()
    for k, v in pairs( player.GetAll() ) do
        Spawns = 0
        for k, v in pairs( ents.GetAll() ) do
            if v:GetClass() == "info_player_start" then
                Spawns = Spawns + 1
            end
        end

        if Spawns <= 0 then
            local spawnpoint = ents.Create( "info_player_start" )
            spawnpoint:SetPos( v:GetPos() )
            spawnpoint:Spawn()
            spawnpoint.Custom = true
            for _, ply in pairs( player.GetAll() ) do
                ply:PrintMessage( HUD_PRINTCONSOLE, "Created emergency Spawn." )
            end
        end
        Spawns = nil
    end

    for k, v in pairs( ents.GetAll() ) do
        if v:GetClass() == "info_player_start" then
            if v.Custom then
                for _, ply in pairs( player.GetAll() ) do
                    if not v.SClient then
                        umsg.Start( "Spawnpoint_Table", ply )
                            umsg.Long( v:GetPos().x )
                            umsg.Long( v:GetPos().y )
                            umsg.Long( v:GetPos().z )
                        umsg.End()
                        v.SClient = true
                    end
                end
            end
        end
    end
end
hook.Add( "Think", "EmergencySpawnPoint", EmergencySpawnPoint )

-- Database stuff

function GetSpawns()
    if not InitSpawnpoints then
        result = sql.Query( "SELECT number FROM spawnpointss_savess WHERE toggle = '1'" )
        if (result) then -- Any spawnpoints?
            result = sql.Query( "SELECT number FROM spawnpointss_savess WHERE map = '"..game.GetMap().."'" )
            if (result) then -- Spawnpoints for this map
                if RemoveRealSpawns then-- Remove real ones
                    RealSpawnPoints = {}
                    RealSpawnPointsA = {}

                    for k, v in pairs( ents.GetAll() ) do
                        if v:GetClass() == "info_player_start" then
                            if not v.Custom then
                                RealSpawnPoints[ #RealSpawnPoints+1 ] = v:GetPos()
                                RealSpawnPointsA[ #RealSpawnPointsA+1 ] = v:GetAngles()
                            end
                            v:Remove()
                        end
                    end
                end

                for i = 1, Tablesize do
                    result = sql.Query( "SELECT x FROM spawnpointss_savess WHERE number = '"..i.."'" )
                    local x = sql.QueryValue( "SELECT x FROM spawnpointss_savess WHERE number = '"..i.."'" )
                    local y = sql.QueryValue( "SELECT y FROM spawnpointss_savess WHERE number = '"..i.."'" )
                    local z = sql.QueryValue( "SELECT z FROM spawnpointss_savess WHERE number = '"..i.."'" )
                    local map = sql.QueryValue( "SELECT map FROM spawnpointss_savess WHERE number = '"..i.."'" )
                    local on = sql.QueryValue( "SELECT toggle FROM spawnpointss_savess WHERE number = '"..i.."'" )
                    if (result) and game.GetMap() == map then
                        if tonumber( on ) == 1 then
                            local spawnpoint = ents.Create( "info_player_start" )
                            spawnpoint:SetPos( Vector( x, y, z ) )
                            spawnpoint:Spawn()
                            spawnpoint.Custom = true
                        end
                    elseif not result then
                        Tablesize = i
                        InitSpawnpoints = true
                        return
                    end
                end
            end
        end
        InitSpawnpoints = true
    end
end
hook.Add( "Think", "GetSpawns", GetSpawns )

function SaveSpawns( spawn )
    result = sql.Query( "SELECT number FROM spawnpointss_savess WHERE toggle = '1'" )

    if (result) then else
        query = "CREATE TABLE spawnpointss_savess ( number varchar(255), x varchar(255), y varchar(255), z varchar(255), map varchar(255), toggle varchar(255) )"
        result = sql.Query( query )
    end

    saved = false
    Tablesize = Tablesize + 1
    for i = 1, Tablesize do
        if not saved then
            local result = sql.Query( "SELECT x FROM spawnpointss_savess WHERE number = '"..i.."'" )
            if not result then
                sql.Query( "INSERT INTO spawnpointss_savess (`number`, `x`, `y`, `z`, `map`, `toggle`)VALUES ('"..i.."', '"..spawn:GetPos().x.."', '"..spawn:GetPos().y.."', '"..spawn:GetPos().z.."', '"..game.GetMap().."', '1')" )
                saved = true
            end
        end
    end
end

function DatabaseRemoveSpawn( ply )
    if ply:IsAdmin() then else return end

    for k, v in pairs( ents.FindInSphere( ply:GetPos(), 10 ) ) do
        if v:GetClass() == "info_player_start" then
            if v.Custom then
                result = sql.Query( "SELECT x FROM spawnpointss_savess WHERE x = '"..v:GetPos().x.."'" )
                if (result) then
                    for i = 1, Tablesize do
                        local x = sql.QueryValue( "SELECT x FROM spawnpointss_savess WHERE number = '"..i.."'" )
                        local y = sql.QueryValue( "SELECT y FROM spawnpointss_savess WHERE number = '"..i.."'" )
                        local z = sql.QueryValue( "SELECT z FROM spawnpointss_savess WHERE number = '"..i.."'" )
                        local map = sql.QueryValue( "SELECT map FROM spawnpointss_savess WHERE number = '"..i.."'" )
                        if ( x and y and z and v:GetPos().x and v:GetPos().y and v:GetPos().z and map ) and math.floor( x ) == math.floor( v:GetPos().x ) and math.floor( y ) == math.floor( v:GetPos().y ) and math.floor( z ) == math.floor( v:GetPos().z ) and game.GetMap() == map then
                            sql.Query( "UPDATE spawnpointss_savess SET toggle = 0 WHERE number = '"..i.."'" )
                            v:Remove()
                            ply:PrintMessage( HUD_PRINTCONSOLE, "Removed custom Spawnpoint "..i.." from Database." )
                            umsg.Start( "Spawnpoint_Table_Remove", ply )
                                umsg.Long( x )
                                umsg.Long( y )
                                umsg.Long( z )
                            umsg.End()
                        end
                    end
                end
            end
        end
    end
end
concommand.Add( "spawnpoint_database_remove", DatabaseRemoveSpawn )

end[/lua]
Oh, and if you could send me a link to the reset thing or whatever, I can edit my script to work with it.

EDIT; Changed the code again, fixed a wee bug.

EDIT; Remember to take this new code ^

Awesome, man - and don’t worry about wasting my time, you’re the coder here, not I, if it were me doing this I’d be doing it backwards and upside down and taking a month.

Here’s the code for the reset thingy.


/*---------------------------------------------------------
------mmmm---mmmm-aaaaaaaa----ddddddddd---------------------------------------->
     mmmmmmmmmmmm aaaaaaaaa   dddddddddd      Name: Mad Cows Weapons
     mmm mmmm mmm aaa    aaa  ddd     ddd      Author: Worshipper
    mmm  mmm  mmm aaaaaaaaaaa ddd     ddd      Project Start: October 23th, 2009
    mmm       mmm aaa     aaa dddddddddd      File: mad_cleanup.lua
---mmm--------mmm-aaa-----aaa-ddddddddd---------------------------------------->
---------------------------------------------------------*/

// Shhhh! It's a secret script to clean up the map!

function MAD.CleanUp(ply, command, args)

    if ply:IsAdmin() then
        game.CleanUpMap()
    end
end
concommand.Add("mad_cleanup", MAD.CleanUp)

[lua]/---------------------------------------------------------
------mmmm—mmmm-aaaaaaaa----ddddddddd---------------------------------------->
mmmmmmmmmmmm aaaaaaaaa dddddddddd Name: Mad Cows Weapons
mmm mmmm mmm aaa aaa ddd ddd Author: Worshipper
mmm mmm mmm aaaaaaaaaaa ddd ddd Project Start: October 23th, 2009
mmm mmm aaa aaa dddddddddd File: mad_cleanup.lua
—mmm--------mmm-aaa-----aaa-ddddddddd---------------------------------------->
---------------------------------------------------------
/

// Shhhh! It’s a secret script to clean up the map!

function MAD.CleanUp(ply, command, args)

if ply:IsAdmin() then
    game.CleanUpMap()
    InitSpawnpoints = nil
end

end
concommand.Add(“mad_cleanup”, MAD.CleanUp)[/lua]
That should do it
I also editted the script above, remember to copy that over too ( in place of the old one )

Works perfectly. I’m so happy I don’t have to set spawns anymore, they just stay forever :slight_smile: You’re the best, mcormack!