Raised This Month: $ Target: $400
 0% 

(Solved) [L4D] Where is logical mistake?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Flynn
Senior Member
Join Date: Sep 2009
Old 10-01-2009 , 03:14   Re: [L4D] Where is logical mistake?
Reply With Quote #1

As for the solution, you should not try to use hacky hacky cody buggy idea, but instead find the maximum number of entities and do a single pass (incrementing upwards) until your entity number is either equal to or exceeds the maximum.

Heading in the other direction won't work. Not with FindEntityByClassname anyway.

Remember Kids; lazy coding costs time!

Edit: Also, I don't recommend Copy Pasta.

Quote:
exvelSeptember 2, 2009, 5:55 amI've just replaced this function with my own that automatically checks if start entity is valid and if not just shifts to the nearest valid one:
1: stock FindEntityByClassname2(startEnt, const String:classname[])
2: {
3:
/* If startEnt isn't valid shifting it back to the nearest valid one */
4:
while (startEnt > -1 && !IsValidEntity(startEnt)) startEnt--;
5:

6:
return FindEntityByClassname(startEnt, classname);
7: }




Last edited by Flynn; 10-01-2009 at 03:20.
Flynn is offline
Send a message via MSN to Flynn Send a message via Skype™ to Flynn
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 18:21.


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