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

[ZP] Jetpack + Bazooka 3.2 (Low CPU Usage)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 06-19-2011 , 05:59   [ZP] Jetpack + Bazooka 3.2 (Low CPU Usage)
Reply With Quote #1

Hello, I edited Zombie Plague Jetpack plugin because I wanted to have many FPS in my server and a better performance with many than 25 players.

There exists two modules: Engine and FakeMeta
Engine has: server_frame( ) forward.
FakeMeta has: FM_StartFrame( ) forward.

These forwards are executed approximately 550 times per second in a Windows server and approximately 950 times in a Linux server.
This will increase CPU much enough and will decrease the server performance and the FPS also...

The original code is:
PHP Code:
public fm_startFrame(){
        
    
gltime get_gametime()
    static 
id
    
for (id 1id <= 32id++)
    {
        
jp_forward(id)
    }

And the new one:
PHP Code:
public fm_startFrame( )
{
    
gltime get_gametime( );
    
    static 
iPlayers32 ], iNumiPlayeri;
    
get_playersiPlayersiNum"ae""CT" );
    
    for( 
0iNumi++ )
    {
        
iPlayer iPlayers];
        
        if( 
hasjetiPlayer ] )
            
jp_forwardiPlayer );
    }

Hopefully you understand what I done... Also, I hooked is_user_alive check for increase performance.

My code is doing this:
Takes all alive players situated in COUNTER-TERRORIST team.
Checks if they have Jetpack.
If they have Jetpack, execute jp_forward on them.

Instead of check each player from 1 to 32, if he is connected, if he is alive, if he has Jetpack, if he is not zombie...
Attached Files
File Type: sma Get Plugin or Get Source (zp_jb_new.sma - 2688 views - 22.5 KB)
File Type: sma Get Plugin or Get Source (zp_jb_old.sma - 1295 views - 24.6 KB)
__________________

Last edited by claudiuhks; 04-17-2012 at 21:21.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
tei1995
Senior Member
Join Date: Feb 2011
Location: VietNam
Old 06-19-2011 , 06:29   Re: [ZP] Jetpack 3.2 (Low CPU Usage)
Reply With Quote #2

nobody care about fps when play zombie mod
__________________

Hatsune Miku~
tei1995 is offline
Dolph_Ziggler
BANNED
Join Date: Jun 2011
Old 06-19-2011 , 07:49   Re: [ZP] Jetpack 3.2 (Low CPU Usage)
Reply With Quote #3

Quote:
Originally Posted by tei1995 View Post
nobody care about fps when play zombie mod
yeah
Dolph_Ziggler is offline
Send a message via MSN to Dolph_Ziggler
rodrigo286
Veteran Member
Join Date: Sep 2010
Location: Brazil, São Paulo
Old 06-19-2011 , 08:27   Re: [ZP] Jetpack 3.2 (Low CPU Usage)
Reply With Quote #4

Thanks claudiuhks. My server is linux.

Can you fix the error when it drops the jetpack and take again to get the fuel back to 100%?

Last edited by rodrigo286; 06-19-2011 at 08:46.
rodrigo286 is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 06-19-2011 , 08:58   Re: [ZP] Jetpack 3.2 (Low CPU Usage)
Reply With Quote #5

This feature already exists. Look at the "public pfn_touch(ptr, ptd)". You'll see g_flyEnergy[id] = get_pcvar_num... This means MAXIMUM energy gained to player when he pick up the jetpack from ground...

===============

Right @tei1995, you would like to play while your crosshair is shaked and low-moving, while your crosshair is moved at his default place again in frames... Instead of a good playing...
__________________

Last edited by claudiuhks; 06-19-2011 at 09:04.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
rodrigo286
Veteran Member
Join Date: Sep 2010
Location: Brazil, São Paulo
Old 06-19-2011 , 09:05   Re: [ZP] Jetpack 3.2 (Low CPU Usage)
Reply With Quote #6

Yes, but I'm a beginner, you could help me with this?

Or they do and put your credits.

Thank you!
rodrigo286 is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 06-19-2011 , 09:08   Re: [ZP] Jetpack 3.2 (Low CPU Usage)
Reply With Quote #7

nice job
thank you
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 06-19-2011 , 09:10   Re: [ZP] Jetpack 3.2 (Low CPU Usage)
Reply With Quote #8

Hmm, I think we are speaking two foreign languages. You want when a player pick up a jetpack, he should have maximum fuel (100%). The code do this:

PHP Code:
public pfn_touch(ptrptd) {
    if(
is_valid_ent(ptr)) {
        new 
classname[32]
        
entity_get_string(ptr,EV_SZ_classname,classname,31)
        
        if(
equal(classname"zp_jp_jetpack")) {
            if(
is_valid_ent(ptd)) {
                new 
id ptd
                
if(id && id 34) {
                    if(!
hasjet[id] && !zp_get_user_zombie(id) && alive[id]) {
                        
                        
hasjet[id] = 1
                        g_flyEnergy
[id] = get_pcvar_num(cvar_fly_max_engery)
                        
rocket[id] = true
                        client_cmd
(id,"spk items/gunpickup2.wav")
                        
engclient_cmd(id,"weapon_knife")
                        
switchmodel(id)
                        
remove_entity(ptr)
                    }
                }
            } 
When a player pick up a jetpack, you can see here what will happening:

PHP Code:
g_flyEnergy[id] = get_pcvar_num(cvar_fly_max_engery
His energy will be recharged at maximum. You are wrong because you say the player when he pick up the jetpack will get the fuel minimum.

Hopefully you understand
__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
NickuGeorge
Senior Member
Join Date: Mar 2011
Location: Romania
Old 06-19-2011 , 09:14   Re: [ZP] Jetpack 3.2 (Low CPU Usage)
Reply With Quote #9

good job
__________________

NickuGeorge is offline
Send a message via Yahoo to NickuGeorge
rodrigo286
Veteran Member
Join Date: Sep 2010
Location: Brazil, São Paulo
Old 06-19-2011 , 09:27   Re: [ZP] Jetpack 3.2 (Low CPU Usage)
Reply With Quote #10

When a player pick up the jetpack from the floor she is not filled with fuel.

As this happens, and players take the advantage to stay dropping it and taking it again to recharge the fuel faster.
rodrigo286 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 21:37.


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