Forum

> > CS2D > Scripts > [solved] Spawn ct-bot with id 15
Forums overviewCS2D overview Scripts overviewLog in to reply

English [solved] Spawn ct-bot with id 15

7 replies
To the start Previous 1 Next To the start

old Re: [solved] Spawn ct-bot with id 15

Apache uwu
User Off Offline

Quote
No. However, you can rewrite the player function so that it does return a different IP address.

1
2
3
4
5
6
7
8
9
_player=player

function player(id,value)
	if value:lower()=="ip" and player(id,"bot") then
		return "4.4.4.4"
	else
		return _player(id,value)
	end
end

A call on `player(2,"ip")` where a bot is taking up slot 2 would return an IP address of `4.4.4.4`.

Viewing the scoreboard (default: tab) would still indicate that the bot is a bot, there is no way around that.

old Re: [solved] Spawn ct-bot with id 15

DC
Admin Off Offline

Quote
Why would you want to give a bot a special IP? The IP of bots doesn't matter anyway. They don't really have one because they are controlled locally by the server itself.

Is it possible that you are actually talking about the player ID? You can't assign player IDs manually. The game allocates them automatically. Just keep your scripts flexible and use variables for the IDs.

You could make the game allocate ID 15 by adding/kicking players so the next free ID is 15. It doesn't make much sense to do something like this though.

old Re: [solved] Spawn ct-bot with id 15

iii
User Off Offline

Quote
yes i mixed it. i wanted to say id

the spacial id is just because i need a ct-bot, so that the players all can be tt and the script uses the id for tabels. i don't want that the bot get a place in such a table...
But maybe i change it.

old Re: [solved] Spawn ct-bot with id 15

Yates
Reviewer Off Offline

Quote
You don't want to include a bot in a list.

Well that's just easy, check out of all the players who is not a bot.

Believe in the force, Luke.

old Re: [solved] Spawn ct-bot with id 15

iii
User Off Offline

Quote
A tremor in the Force. The last time I felt it was in the presence of my old master.
i think you understand me wrong, and your magic is made from the dark side. i won't use it i decided.

here is my solution:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
addhook("startround_prespawn","_startround_prespawn")
function _startround_prespawn(mode)
add_id_ct_bot(15)
end

function add_id_ct_bot(pos)
	if player(pos,"exists") then
		if player(pos,"bot") and player(pos,"team")==2 then
			for _,id in pairs(player(0,"table")) do
				if player(id,"bot") and id~=pos then
					parse("kick "..id)
				end
			end
		else
			parse("kick "..pos.." this server needs the id you took. you can reconnect if you want")
			add_id_ct_bot(pos)
		end
	else
		local ipos=0
		for i,id in pairs(player(0,"table")) do
			if id>pos then
				ipos=i-1
			end
		end
		for c=1,pos-ipos do
			parse("bot_add_ct")
		end
		add_id_ct_bot(pos)
	end
end
edited 1×, last 30.06.13 07:08:31 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview