Forum

> > CS2D > Scripts > Gatefield turns neutral
Forums overviewCS2D overview Scripts overviewLog in to reply

English Gatefield turns neutral

1 reply
To the start Previous 1 Next To the start

old Gatefield turns neutral

Promaster
User Off Offline

Quote
I am currently working on a project thats creates a gatefield whereever a player moves, and i need something that makes players gatefields turns to neutral gatefield whenever the player leaves or change team to spectator.

I don't know if there is any command that can solve this issue easily, but i can't find it in cs2d.com/help/

A player with over 300 gatefields will flood the server and kicks other players in the server when they leaves and the gatefields get automatically removed. That's why I am asking if there is any command or script that turns the players gatefield to neutral when they leaves without flooding the server.

old Re: Gatefield turns neutral

Masea
Super User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
addhook("leave","_leave")
function _leave(id)
    for k, v in pairs(object(0,"table")) do
        if object(v,"player") == id and object(v,"type") == 6 then
            local x, y = object(v,"tilex"), object(y,"tilex")

            parse("killobject "..v)

            parse("spawnobject 6 "..x.." "..y.." 0 0 0 0")
        end
    end
end
I didn't test it. And I must say, if there's a player who made over 300 gatefields, the code would cause lag indeed.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview