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

Solved Change maxspeed to all players.


Post New Thread Reply   
 
Thread Tools Display Modes
massouh2004
Junior Member
Join Date: Mar 2018
Location: Casablanca, Morocco.
Old 03-23-2018 , 14:13   Re: Change maxspeed to all players.
Reply With Quote #11

Is there any mistake in Natsheh's code, OciXCrom?
massouh2004 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 03-23-2018 , 17:19   Re: Change maxspeed to all players.
Reply With Quote #12

Quote:
Originally Posted by massouh2004 View Post
Is there any mistake in Natsheh's code, OciXCrom?
Why are you asking him, why wouldnt you test and find out.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
marcelowzd
Senior Member
Join Date: Feb 2011
Location: São Paulo, Brazil
Old 03-24-2018 , 01:36   Re: Change maxspeed to all players.
Reply With Quote #13

I usually use this

Code:
new const Float:g_fSpeed = 500.0;

public plugin_init( )
{
    RegisterHam( Ham_Item_PreFrame, "player", "OnPreFrame", 1 );
}

public OnPreFrame( iClient )
{
    if( !is_user_alive( iClient ) )
        return HAM_IGNORED;

    set_user_maxspeed( iClient, g_fSpeed );

    return HAM_IGNORED;
}

Last edited by marcelowzd; 03-24-2018 at 01:38.
marcelowzd is offline
massouh2004
Junior Member
Join Date: Mar 2018
Location: Casablanca, Morocco.
Old 03-24-2018 , 08:06   Re: Change maxspeed to all players.
Reply With Quote #14

Quote:
Originally Posted by marcelowzd View Post
I usually use this

Code:
new const Float:g_fSpeed = 500.0;

public plugin_init( )
{
    RegisterHam( Ham_Item_PreFrame, "player", "OnPreFrame", 1 );
}

public OnPreFrame( iClient )
{
    if( !is_user_alive( iClient ) )
        return HAM_IGNORED;

    set_user_maxspeed( iClient, g_fSpeed );

    return HAM_IGNORED;
}
Change this:

PHP Code:
  RegisterHamHam_Item_PreFrame"player""OnPreFrame"); 
To:

PHP Code:
  RegisterHamHam_Item_PreFrame"player""OnPreFrame"); 
massouh2004 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 03-24-2018 , 09:55   Re: Change maxspeed to all players.
Reply With Quote #15

Quote:
Originally Posted by massouh2004 View Post
Change this:

PHP Code:
  RegisterHamHam_Item_PreFrame"player""OnPreFrame"); 
To:

PHP Code:
  RegisterHamHam_Item_PreFrame"player""OnPreFrame"); 
Do you know even the difference?

Can you provide also why?
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
massouh2004
Junior Member
Join Date: Mar 2018
Location: Casablanca, Morocco.
Old 03-24-2018 , 16:56   Re: Change maxspeed to all players.
Reply With Quote #16

Natsheh, you're trying to moke me, am I wrong?
Nevermind. So, as I know, we use "pre" when the player is dead, and in marcelowzd's code, if I was right he should replace this:
PHP Code:
 RegisterHamHam_Item_PreFrame"player""OnPreFrame"); 
by this:

PHP Code:
 RegisterHamHam_Item_PreFrame"player""OnPostFrame"); 
It's my bad, I didn't noticed it. But it was his fault. I was confused, so don't blame me.

Last edited by massouh2004; 03-24-2018 at 16:58.
massouh2004 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 03-25-2018 , 04:52   Re: Change maxspeed to all players.
Reply With Quote #17

So you think pre is when the player is dead and post is when he's alive, what if the entity was a nonplayer?
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
massouh2004
Junior Member
Join Date: Mar 2018
Location: Casablanca, Morocco.
Old 03-25-2018 , 07:57   Re: Change maxspeed to all players.
Reply With Quote #18

Do we use the entity "0" in a HAM function? Hmmm..
massouh2004 is offline
marcelowzd
Senior Member
Join Date: Feb 2011
Location: São Paulo, Brazil
Old 03-25-2018 , 11:41   Re: Change maxspeed to all players.
Reply With Quote #19

Quote:
Originally Posted by massouh2004 View Post
Natsheh, you're trying to moke me, am I wrong?
Nevermind. So, as I know, we use "pre" when the player is dead, and in marcelowzd's code, if I was right he should replace this:
PHP Code:
 RegisterHamHam_Item_PreFrame"player""OnPreFrame"); 
by this:

PHP Code:
 RegisterHamHam_Item_PreFrame"player""OnPostFrame"); 
It's my bad, I didn't noticed it. But it was his fault. I was confused, so don't blame me.
No, it wasn't my fault, the const is defined as "Ham_Item_PreFrame" and that's why i named the function as "OnPreFrame". It would be my fault IF the function had "OnPreFramePre" as its name instead. I agree it can be a bit confusing but there is no reason to say it is a mistake.

Additionaly, if he does what you said ( Changing the post value to 0 ), the movespeed will not be considered because the game will reset his speed on POST (setting to the weapon maxspeed value)

Last edited by marcelowzd; 03-25-2018 at 11:59.
marcelowzd is offline
massouh2004
Junior Member
Join Date: Mar 2018
Location: Casablanca, Morocco.
Old 03-25-2018 , 11:55   Re: Change maxspeed to all players.
Reply With Quote #20

What the fuck?! LOL I didn't noticed it, hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh sorry!
massouh2004 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 03:06.


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