Raised This Month: $ Target: $400
 0% 

How to make bullets to stop in the enemy?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
zhulo
Senior Member
Join Date: Jun 2010
Location: Slovakia
Old 12-14-2011 , 11:20   How to make bullets to stop in the enemy?
Reply With Quote #1

Hello, I have a Zombie Plague server and I have problems with lags. Often happens that one human is shooting to 10-20 zombies at once, so it causes the server to lag and sometimes it crash with this error message.

Code:
FATAL ERROR (shutting down): SZ_GetSpace: overflow without FSB_ALLOWOVERFLOW set on Server Spectator Buffer
So I think that the only sollution is to make human can shoot to only one zombie at a time.

So i need code that make bullets to stop in the first enemy who is hit. I think that there should be used the fwTraceLine but don't know how.

EDIT:

Maybee this is the right way but I dont know in which function and how can I use it

PHP Code:
                       new Float:vecStart[3// This should be the original start position
new Float:vecEnd[3// And this should be the end position

new iTraceHit // hitted entity
new iEntToIgnore MyFirstEntityToIgnore // this would change at every trace
new iTraceHandle create_tr2()// trace handle

while(engfunc(EngFunc_TraceLinevecStartvecEndDONT_IGNORE_MONSTERSiEntToIgnoreiTraceHandle)) // will always return 1, see engfunc.cpp
{
    
iTraceHit get_tr2(iTraceHandleTR_pHit// getting hitted entity
    
    
if(get_global_float(GL_trace_fraction) >= 1.0// the traceline finished at the original end position, so we will stop here
        
break;
    
    if(
is_user_alive(iTraceHit) && cs_get_user_team(id) != cs_get_user_team(iTraceHit)) // if you want to stop the traceline when it hits a player, use this
        
break;
        
    
// your functions here
    
    // the next traceline will start at the end of the last one
    
iEntToIgnore iTraceHit
    get_tr2
(iTraceHandleTR_vecEndPosvecStart)
}

get_tr2(iTraceHandleTR_vecEndPosvecEnd// out of the loop, this will get the last position of the last traceline. you can use a beam effect or something if you want 

Last edited by zhulo; 12-14-2011 at 13:11.
zhulo is offline
Send a message via ICQ to zhulo Send a message via Skype™ to zhulo
 



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 12:09.


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