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

[L4D2] Jump Avoiding for Survivors 4.10 (unapproved)


Post New Thread Reply   
 
Thread Tools Display Modes
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 #11

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
little_froy
Senior Member
Join Date: May 2021
Old 06-21-2021 , 09:56   Re: [L4D2] Jump Avoiding and Break Chi Escape for Survivors (NO sm_cvar)
Reply With Quote #12

Quote:
Originally Posted by Silvers View Post
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" 


And for sure, you remind me that the global varbile initialization type is wrong but the the problem is covered up by the event_round ReSet, i'll fix up soon.

Maybe other developer makes sure every userid have own data, but i promise improtant data of clientid won't refresh of reset by different userid. The POINT is each survivor, not each player. every new players should inherit all the old data of survivor created by prev players without any reset of course in my design.

Last edited by little_froy; 06-22-2021 at 08:13.
little_froy is online now
little_froy
Senior Member
Join Date: May 2021
Old 08-05-2021 , 09:08   Re: [L4D2] Jump Avoiding for Survivors 4.9
Reply With Quote #13

finally, the 4 plugins is almost ok.
little_froy is online now
Deadpool69
Junior Member
Join Date: Jul 2015
Old 08-24-2021 , 00:49   Re: [L4D2] Jump Avoiding for Survivors 4.9
Reply With Quote #14

Quote:
Originally Posted by little_froy View Post
finally, the 4 plugins is almost ok.
Hi, this plugin is totally great, but can you make it so we can dodge in diagonal directions too?
Deadpool69 is offline
little_froy
Senior Member
Join Date: May 2021
Old 09-02-2021 , 21:44   Re: [L4D2] Jump Avoiding for Survivors 4.9
Reply With Quote #15

Quote:
Originally Posted by Deadpool69 View Post
Hi, this plugin is totally great, but can you make it so we can dodge in diagonal directions too?
diagonal directions require double accelerations compute, it can't be simply add. i'm bad at this, so no planning now.
little_froy is online now
AK978
Senior Member
Join Date: Jun 2018
Old 09-26-2021 , 11:36   Re: [L4D2] Jump Avoiding for Survivors 4.10
Reply With Quote #16

add:
OnClientDisconnect.
GetClientUserId.
GetClientOfUserId.

test.
Attached Files
File Type: sp Get Plugin or Get Source (jump_avoid_4.10_test.sp - 131 views - 6.3 KB)

Last edited by AK978; 09-26-2021 at 11:42.
AK978 is offline
Reply


Thread Tools
Display Modes

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


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