Raised This Month: $51 Target: $400
 12% 

de_airstrip hates my function??


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GHW_Chronic
SourceMod Donor
Join Date: Sep 2004
Location: Texas
Old 10-09-2007 , 14:23   de_airstrip hates my function??
Reply With Quote #1

Code:
public force_spin() {     log_amx("Start")     if(get_pcvar_num(toggle_pcvar))     {         static classname[16], Float:angles[3]         new ent = engfunc(EngFunc_FindEntityInSphere,maxplayers,Float:{0.0,0.0,0.0},4800.0)         while(ent)         {             log_amx("%d",ent)             if(pev_valid(ent))             {                 pev(ent,pev_classname,classname,15)                 if(containi(classname,"armoury")!=-1 || containi(classname,"weaponbox")!=-1)                 {                     pev(ent,pev_angles,angles)                     angles[1] += get_pcvar_float(speed_pcvar) / 10.0                     if(angles[1]>=180.0)                     {                         angles[1] -= 360.0                     }                     set_pev(ent,pev_angles,angles)                 }             }             ent = engfunc(EngFunc_FindEntityInSphere,ent,Float:{0.0,0.0,0.0},4800.0)         }     }     log_amx("End") }

This function is from my UT style weapon floating plugin. It works fine on every map I have except airstip. I have it set to execute the above statement ONCE from plugin_init in a test plugin. that's all that happens. It executes once and no other 3rd party plugin is running. Here is the log i get out:

Code:
L 10/09/2007 - 13:18:06: [GHW_Floating_Weapons.amxx] Start
L 10/09/2007 - 13:18:06: [GHW_Floating_Weapons.amxx] 34
L 10/09/2007 - 13:18:06: [GHW_Floating_Weapons.amxx] (Lots of ent numbers)
L 10/09/2007 - 13:18:06: [GHW_Floating_Weapons.amxx] 407
L 10/09/2007 - 13:18:06: [GHW_Floating_Weapons.amxx] 34
L 10/09/2007 - 13:18:06: [GHW_Floating_Weapons.amxx] (Lots of ent numbers)
L 10/09/2007 - 13:18:06: [GHW_Floating_Weapons.amxx] 407
The end is never printed into the log file. It appears that this:
Code:
engfunc(EngFunc_FindEntityInSphere,407,Float:{0.0,0.0,0.0},4800.0)
is returning 34... I had like 2 hours of sleep a couple days ago so I think it could be a typo of some sort but I really don't know... and I don't know why it only happens on airstrip...
GHW_Chronic is offline
Send a message via AIM to GHW_Chronic
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 10-09-2007 , 16:53   Re: de_airstrip hates my function??
Reply With Quote #2

There is some weird infinite loop going on for that map
__________________
M249-M4A1 is offline
alien
Senior Member
Join Date: Aug 2005
Location: London || Slovakia
Old 10-09-2007 , 17:12   Re: de_airstrip hates my function??
Reply With Quote #3

I had very funny problems with sphere functions. Honestly, I set it up to search entities in radius of 128 units from player's origin. Then I calculated distance from found entity. In most cases, it was below 128 but in some, it found entities even further (much further).

Have you tried cs_siege?
__________________
alien is offline
Send a message via ICQ to alien
creeperdank
Senior Member
Join Date: Dec 2004
Location: IL
Old 06-15-2008 , 18:20   Re: de_airstrip hates my function??
Reply With Quote #4

de_torn crashes my server as well.
__________________
creeperdank is offline
Send a message via MSN to creeperdank
Vet
Veteran Member
Join Date: Jul 2006
Location: I|O wa
Old 06-16-2008 , 01:08   Re: de_airstrip hates my function??
Reply With Quote #5

I ran your snippet on several maps, including airstrip and torn, and didn't have any problems.
I did add a client command
Code:
register_clcmd("say /spin", "force_spin", 0, "Spins ents")
so I could control the spin manually. Also, I moved the
Code:
log_amx("%d",ent)
statement to after the compare as to not print out all the unecessary entities.
__________________
=====================================
- My Plugins -
=====================================
Vet is offline
Send a message via MSN to Vet
GHW_Chronic
SourceMod Donor
Join Date: Sep 2004
Location: Texas
Old 06-16-2008 , 16:43   Re: de_airstrip hates my function??
Reply With Quote #6

well then it is clear that there is some variable different between the two of us that stops this line of code from working properly.

me:
listenserver
windows
AMXX 1.8
no 3rd party plugins
GHW_Chronic is offline
Send a message via AIM to GHW_Chronic
Vet
Veteran Member
Join Date: Jul 2006
Location: I|O wa
Old 06-17-2008 , 08:04   Re: de_airstrip hates my function??
Reply With Quote #7

I ran it on:
Dedicated server on LAN
Windows XP
Amxx 1.8
Lots of other plugins

Weird.
__________________
=====================================
- My Plugins -
=====================================
Vet is offline
Send a message via MSN to Vet
Vet
Veteran Member
Join Date: Jul 2006
Location: I|O wa
Old 06-17-2008 , 16:32   Re: de_airstrip hates my function??
Reply With Quote #8

Here's the sma of the routine I used. Just "say /spin" and the weapons rotate and the log looks OK.
Attached Files
File Type: sma Get Plugin or Get Source (spin_v0.sma - 743 views - 1.3 KB)
__________________
=====================================
- My Plugins -
=====================================
Vet is offline
Send a message via MSN to Vet
travo
Senior Member
Join Date: Aug 2006
Old 06-19-2008 , 16:21   Re: de_airstrip hates my function??
Reply With Quote #9

I always get mixed results with findentinsphere, i prefer to loop through all the ents and check the classname as its give me better results and is probably a lot more economical and less cpu than findentinsphere.
I also hate using static variables because I never get any consistance (i probably use them wrong half the time lol) so I stick with new style variables.

PHP Code:
public plugin_init()
    
set_task(0.1"force_spin"___"b");

public 
force_spin()
    if (
get_timeleft())
    {
        new 
classname[11], Float:angles[3], ent = -1ent_total engfunc(EngFunc_NumberOfEntities) + 30;
        while (
ent++ < ent_total)
            if (
pev_valid(ent))
            {
                
pev(entpev_classnameclassname10);
                if (
containi(classname"armoury") != -|| containi(classname"weaponbox") != -1)
                {
                    
pev(entpev_anglesangles);
                    
//angles[1] += get_pcvar_float(speed_pcvar) / 10.0;
                    
angles[1] += 27.0;
                    if(
angles[1] >= 180.0)
                        
angles[1] -= 360.0;
                    
set_pev(entpev_anglesangles);
                }
            }
    } 

Last edited by travo; 06-19-2008 at 16:26.
travo 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 01:50.


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