Raised This Month: $ Target: $400
 0% 

More tanks than players, "for" loop wrong ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Skorpion1976
Veteran Member
Join Date: Jun 2009
Location: Austria
Old 02-06-2010 , 12:52   More tanks than players, "for" loop wrong ?
Reply With Quote #1

Hi, i run a 16vs server and before the update from Feb. 5th this code killed every SI PZ and then granted all of them (max. 8 players) a tank. (Well, in l4d1 it worked like a charm, but in L4D2 it only spawns 6 tanks at most, dunno why this difference happens). However, point is that since the update the code generates TONS of ADDITIONAL bot tanks now:

Code:
for (new i = 1; i <= MaxClients; i++)
                        {
                            if (!IsClientInGame(i))
                            {
                                continue;
                            }   
                            if (GetClientTeam(i) == 3)  //check if player is infected
                            {
                                FakeClientCommand(i, "kill"); //if yes, kill player
                                FakeClientCommand(i, "z_spawn tank auto"); // make player a tank
                            }
                        }
AFTER the update: additional tanks get spawned, all bot tanks. They do not attack, just stand on same spot. Instead of 8 player tanks I now have these + additional 15 bot tanks
I havenīt changed any code or installed a new plugin, itīs just since the l4d2 update. What can I do to only give ingame players a tank, without spawning additional bot tanks ? Some extra check before actually spawning the tanks ?

Last edited by Skorpion1976; 02-06-2010 at 13:09.
Skorpion1976 is offline
noodleboy347
AlliedModders Donor
Join Date: Mar 2009
Old 02-07-2010 , 01:50   Re: More tanks than players, "for" loop wrong ?
Reply With Quote #2

8 tanks? D:

Well anyways, Valve updated L4D2 the other day with some adjustments to PZ bots, I'm sure that has something to do with it, I'm guessing they changed something with z_spawn tank auto which does this. I would recommend finding a different method of calling a tank.
noodleboy347 is offline
Skorpion1976
Veteran Member
Join Date: Jun 2009
Location: Austria
Old 02-08-2010 , 19:38   Re: More tanks than players, "for" loop wrong ?
Reply With Quote #3

It should work now. I forgot an if statement to check whether itīs a bot or not.
Skorpion1976 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:55.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode