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

[CSS-TF2] Auto Sprint Source [v2.1b]


Post New Thread Reply   
 
Thread Tools Display Modes
alencore
Senior Member
Join Date: Oct 2011
Old 02-08-2015 , 23:31   Re: Auto Sprint Source
Reply With Quote #31

Ok it's working now except on cp maps...it still stuck to the grown but after respawn or change class it's working. Anyway tnx for the update much appreciate it! atleast there's a working sprint for tf2 now.

btw how to change cl_forwardspeed without using sv_Cheats 1? seems the sprint speed is capped to whatever the default max speeds are.

Last edited by alencore; 02-08-2015 at 23:45.
alencore is offline
St00ne
Veteran Member
Join Date: Jan 2011
Location: Annecy - France
Old 02-09-2015 , 09:08   Re: Auto Sprint Source
Reply With Quote #32

Quote:
Originally Posted by alencore View Post
Ok it's working now except on cp maps...it still stuck to the grown but after respawn or change class it's working. Anyway tnx for the update much appreciate it! atleast there's a working sprint for tf2 now.

btw how to change cl_forwardspeed without using sv_Cheats 1? seems the sprint speed is capped to whatever the default max speeds are.
You're welcome.

I don't see why you got this bug on cp maps, this plugin doesn't do anything bad at spawn. Maybe it depends on your SM version. Or it is because of another plugin.
I tested it on a Linux MVM server with SM 1.63 stable without any problem.
Anyway it sounds to work well apart from that.

To change the speed, change sm_ass_speed value in your sourcemod.cfg.
You have to use a ratio.
For example, sm_ass_speed 1.8 makes a player run 1.8 times faster than the default speed for this player's class.

++
__________________

*** *** ***
-My plugins-

Last edited by St00ne; 02-09-2015 at 09:19.
St00ne is offline
bdmj
Member
Join Date: Jan 2010
Old 02-10-2015 , 20:50   Re: Auto Sprint Source
Reply With Quote #33

Hi, I'm just curious if this plugin will work with L4D 1 ???
__________________
bdmj is offline
RedSword
SourceMod Plugin Approver
Join Date: Mar 2006
Location: Quebec, Canada
Old 02-22-2015 , 23:22   Re: Auto Sprint Source
Reply With Quote #34

Quote:
Originally Posted by St00ne View Post
Hi,

Quote:
Originally Posted by RedSword View Post
Also, please note that you should pass UserId/SerialId instead of ClientId. Using UserId/SerialId you could even totally drop timers' handles management. You'd just need a bool array. ==> better readability IMO. Note that your usage of client timers is correct however.
Well I tried, but I quickly had an issue preventing me from finishing the modification. If you take into account that I have to stop the timers in certain circumstances, I think there will be no other way than using handles, like said below:
Hey St00ne,

That timer/race-condition issue is still present. You said "If you take into account that I have to stop the timers in certain circumstances"; but you don't have to if you're working with UserId/SerialId. The timer function would be executed on a player that isn't present, and your checks ensure that the user is present... (note that 0, which is the value you'd get if a player is disconnected, is not always handed in your code though)

In case you don't get it, if a player connect, starts sprinting, then disconnect, then someone else connects and take his ClientId (which is different from the UserId), that new player will get the old player's message. This is wrong and should not happen.

But if you really want to stop the timer you could do so when a user disconnect.

Red
__________________
My plugins :
Red Maze
Afk Bomb
RAWR (per player/rounds Awp Restrict.)
Kill Assist
Be Medic

You can also Donate if you appreciate my work

Last edited by RedSword; 02-22-2015 at 23:25.
RedSword is offline
St00ne
Veteran Member
Join Date: Jan 2011
Location: Annecy - France
Old 02-25-2015 , 06:26   Re: Auto Sprint Source
Reply With Quote #35

Thanks for your review Red.

Well to be honest, even if I often say I'm not a pro in scripting, I still fully understand this user ID / client index issue.

So, in my case, I need to stop any timer at player spawn, not on only at OnPlayerDisconnect.
As it seems mandatory, in your opinion, for this plugin to use client serials instead of userids (in order to avoid timer handles), I decided to play the game and make another version (see attached file).
In this version I use booleans to check if a player is being sprinting or not.

But now, you may understand the issue:

- If a server sets sm_ass_time (sprint duration) to a pretty high value like 10 seconds for example

- if a player on this server starts to sprint shortly before a team scores, or before he/she dies

- when the round restarts or when the player respawns, this timer might not be reset. Thus (i made the test), if the player starts a new sprint at respawn, this sprint is stopped after 1 or 2 seconds (instead of 10) because the former timer (supposed to stop former sprint) was not killed.
Because, there is no way to kill a one time timer if not using handles (and when I say this, I'm just repeating Sourcemod Wiki.)
And, because a respawned player at roundstart keeps the same identifier.

I really hope you'll understand the issue and see why I have to use handles, like so many other approved plugins do, btw.
You can compare both codes (the one in first post and the one below) if you want for a better comprehension.

Thanks for taking time to review the code anyway.

Cheers,

St00ne
Attached Files
File Type: sp Get Plugin or Get Source (auto_sprint_source_rev2.sp - 287 views - 7.7 KB)
__________________

*** *** ***
-My plugins-

Last edited by St00ne; 02-27-2015 at 11:50.
St00ne is offline
RedSword
SourceMod Plugin Approver
Join Date: Mar 2006
Location: Quebec, Canada
Old 02-25-2015 , 20:04   Re: Auto Sprint Source
Reply With Quote #36

Quote:
As it seems mandatory, in your opinion, for this plugin to use client serials instead of userids (in order to avoid timer handles)
I never said that. You're confusing User id and Client Id. UserId, ClientId and SerialId are 3 distinct identifiers for a client.

With that said, I think that what I did have in mind at that time was a different way to do what you did. You could use for instance manual timers (with floats) or UserId while binary ORing a round ~"id". I think the binary array might be related to that; thought I'm not sure if that would come with a "better readability" as I said :/.


You achieved to remove the message that's good. I think I did mistake myself as I didn't see that you commented out the message @ L103 (your changelog doesn't mention it directly, nor do your posts; I think that it was shadowed by your cvar implementation), so I thought it was another line.

However you are only killing the timer on L94. What if the user is a spectator ? Not in a team ? Also spawn isn't triggered when a player join spectator FYI; but it is triggered when a player join the server (team == 0).

That problem can allow someone, as a spectator, to get that bonus of speed (... activate --> go spectator) ; if sprint if let's say x5 you see the difference and you have to rejoin/join a team to lose that speed.

Also you now have dead code on L98-103.

And you should change L120 as your plugin is for "any" source game, but you're hardcoding T/CT. You may want to take a look at this. I've personally used
Spoiler
(though it changes your base scenario).

Using UserId/SerialId is the recommended SM way (I did QQ myself on that to get some of mine approved AFAICR). I'll keep advocating using non-clientId in timer; but I'll approve your plugin if the timer logic is proof.

Red
__________________
My plugins :
Red Maze
Afk Bomb
RAWR (per player/rounds Awp Restrict.)
Kill Assist
Be Medic

You can also Donate if you appreciate my work

Last edited by RedSword; 02-25-2015 at 20:05.
RedSword is offline
St00ne
Veteran Member
Join Date: Jan 2011
Location: Annecy - France
Old 02-27-2015 , 10:59   Re: Auto Sprint Source
Reply With Quote #37

Alright, I'm glad you saw I commented a few lines and fixed some things you asked.

Well I'm pretty sure I get the difference between the 3 identifiers, clearly defined in the SM API, and you can see that I properly used client serial to make a change in the beta version above.

But I admit that I don't get what you mean when you talk about manual timers

So I'll improve the code as much as I can, thx for the spec issue btw, I just made a test and I clearly have to fix this.

Thanks for all the info.

++
__________________

*** *** ***
-My plugins-

Last edited by St00ne; 02-27-2015 at 11:23.
St00ne is offline
St00ne
Veteran Member
Join Date: Jan 2011
Location: Annecy - France
Old 02-27-2015 , 11:51   Re: Auto Sprint Source
Reply With Quote #38

Quote:
Originally Posted by bdmj View Post
Hi, I'm just curious if this plugin will work with L4D 1 ???
I just don't know. For now it works on CS:S and has a TF2 version. But you can make a test!

++
__________________

*** *** ***
-My plugins-
St00ne is offline
RedSword
SourceMod Plugin Approver
Join Date: Mar 2006
Location: Quebec, Canada
Old 02-27-2015 , 17:34   Re: Auto Sprint Source
Reply With Quote #39

Quote:
Originally Posted by St00ne View Post
Alright, I'm glad you saw I commented a few lines and fixed some things you asked.

Well I'm pretty sure I get the difference between the 3 identifiers, clearly defined in the SM API, and you can see that I properly used client serial to make a change in the beta version above.

But I admit that I don't get what you mean when you talk about manual timers

So I'll improve the code as much as I can, thx for the spec issue btw, I just made a test and I clearly have to fix this.

Thanks for all the info.

++
Note that my post referred mainly to your first post's attachment, and not your "beta" version (which I talk about only in the introduction of my post).

What I meant by "manual" timer is to have 1 or 2 floats and increment 1 float OnGameFrame. This allow great flexibility (i.e. adding one second, checking time remaining, etc.). You have to ensure that you don't execute unnecessary code OnGameFrame though. Sometime you may not even need to use OnGameFrame, depending on your timer usage.
__________________
My plugins :
Red Maze
Afk Bomb
RAWR (per player/rounds Awp Restrict.)
Kill Assist
Be Medic

You can also Donate if you appreciate my work

Last edited by RedSword; 02-27-2015 at 17:40.
RedSword is offline
St00ne
Veteran Member
Join Date: Jan 2011
Location: Annecy - France
Old 03-03-2015 , 20:37   Re: Auto Sprint Source
Reply With Quote #40

Ok no pb, no need to look at the beta version.

v2.1 uploaded and I changed the gametype back to CS:S. There's still a TF2 version, though. Tests are ok so far.

Note to Red: I really tried to imagine all situations and to stay on the 'safest' side in any case.
As usual, any further advice are still welcome!

++
__________________

*** *** ***
-My plugins-

Last edited by St00ne; 04-04-2015 at 21:42.
St00ne 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 04:27.


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