AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to make bullets to stop in the enemy? (https://forums.alliedmods.net/showthread.php?t=174038)

zhulo 12-14-2011 11:20

How to make bullets to stop in the enemy?
 
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 


zhulo 12-16-2011 11:42

Re: How to make bullets to stop in the enemy?
 
Come on, guys. 81 views and not one person can help me? EIGHTY-ONE?

Devil259 12-16-2011 12:45

Re: How to make bullets to stop in the enemy?
 
If you don't have replies, this is because anybody can't help you/have time to help you.

Don't bump after 2 days, and be patient.


All times are GMT -4. The time now is 12:09.

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