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

[L4D2] Jump Avoiding for Survivors 4.10 (unapproved)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 06-21-2021 , 09:34   Re: [L4D2] Jump Avoiding and Break Chi Escape for Survivors (NO sm_cvar)
Reply With Quote #9

Quote:
Originally Posted by little_froy View Post
That doesn't make sense. i've test with two players(i only have 2 accounts) again just now in the normal 8 players versus server. with 2 survivors case of 1 vs 1 case, everything is just fine and no runtime error thrown after using with death/ change team/ disconnect, and functions sill work after reconnect(server and round have not end, reconnect for a few times to travel all survivors who used). Look at the code under, i already add some HookEvent to ReSet in some case but not OnClientConnected() that's better of couse. after i noticed use OnGameFrame still makes the problem and fix up them.i am glad to fix and improve the code if errors throw again.
You don't actually kill the timer if the client disconnects in this plugin. It's not just this plugin which has these issue. As I mentioned before, you should be parsing the clients userid into timers and entity references into timers. This is the only way to make sure you're affecting the intended user or entity. Right now you're likely to affect someone else - the wrong person - if they connect straight after someone disconnects, or with entities the wrong one if you don't validate the reference. Please read the [TUT] thread it clearly explains what you should be doing and Dragokas provided lots of examples for using timers correctly with entity references and userids.

Edit: Also the way you set global variables, assigning a value is pointless, they initialize as 0 or null already. Unless you initialize with a different value don't bother.
PHP Code:
// Pointless, already is null
Handle Handle_timer_avoid_regen[MAXPLAYERS+1] = {null};

// Initialize like this
Handle Handle_timer_avoid_regen[MAXPLAYERS+1]; 
This is also incorrect. You're setting the first index [0] to null but not the rest. The correct way would be assigning such as: {null, ...};

PHP Code:
// Wrong
    
int tester[3] = {2};
    
PrintToServer("tester[0] = %d"tester[0]);    // Prints "tester[0] = 2"
    
PrintToServer("tester[1] = %d"tester[1]);    // Prints "tester[0] = 0"
    
PrintToServer("tester[2] = %d"tester[2]);    // Prints "tester[0] = 0"

// Correct
    
int tester[3] = {2, ...};
    
PrintToServer("tester[0] = %d"tester[0]);    // Prints "tester[0] = 2"
    
PrintToServer("tester[1] = %d"tester[1]);    // Prints "tester[0] = 2"
    
PrintToServer("tester[2] = %d"tester[2]);    // Prints "tester[0] = 2" 
__________________

Last edited by Silvers; 06-21-2021 at 09:40.
Silvers 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 17:50.


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