Raised This Month: $ Target: $400
 0% 

Removing Weapons by Entity


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-11-2005 , 22:49  
Reply With Quote #2

Let's take a look at your code here:

Code:
        tEnt = find_ent_by_class(-1, "weaponbox")         while(tEnt > 0) {

Let's say it finds a weaponbox with an id of 37. tEnt is now 37. Now you're telling the plugin that as long as tEnt (37 in this case) is larger than 0 (which it is), then do what you tell it to. However, tEnt remains 37 forever and ever and ever so it keeps looping and causes an infinite loop, thus crashing it. The correct way for looping through all entities would be:

Code:
while((tEnt = find_ent_by_class(tEnt,"weaponbox")) != 0) {

This infinite loop error occurs twice in your code.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
 



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 19:20.


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