Raised This Month: $32 Target: $400
 8% 

Solved Change maxspeed to all players.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
massouh2004
Junior Member
Join Date: Mar 2018
Location: Casablanca, Morocco.
Old 03-21-2018 , 17:40   Change maxspeed to all players.
Reply With Quote #1

Hi,

I didn't test my code, but... I just wanted to know if it's a good way to set maxspeed to players permanently.

Thanks.

PHP Code:
#include <amxmodx>
#include <fun>

public client_connect(id) {  
    
set_task(1.0"SPEED"id);
}
public 
SPEED(id) {
    
set_user_maxspeed(id500.0);

I maked this code already, but I want a simple code.

PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >

new Ham:Ham_Player_ResetMaxSpeed Ham_Item_PreFrame;

public 
plugin_init() 
{
    
RegisterHamHam_Player_ResetMaxSpeed"player""playerResetMaxSpeed");
}

public 
playerResetMaxSpeedid )
{
    if( 
is_user_aliveid ) )
    {
        new 
players32 ]
        , 
iMaxPlayers
        
i
        
player;
        
        
get_playersplayersiMaxPlayers );
        
        for( 
1iMaxPlayers++ )
        {
            
player players];
            
            
engfuncEngFunc_SetClientMaxspeedplayer500.0 );
        }
    }


Last edited by massouh2004; 03-22-2018 at 15:25.
massouh2004 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-21-2018 , 19:02   Re: Change maxspeed to all players.
Reply With Quote #2

The speed is changed every time a player changes his weapon.

// PS - I may or may not have reported the thread by accident. Depends on my ability to hit the stop button in time. :c
__________________

Last edited by OciXCrom; 03-21-2018 at 19:03.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
raizo11
BANNED
Join Date: Dec 2013
Location: https://t.me/pump_upp
Old 03-21-2018 , 19:12   Re: Change maxspeed to all players.
Reply With Quote #3

Code:
#include <amxmodx>
#include <fun>
#include <fakemeta>

public plugin_init() 
{
    register_forward(FM_CmdStart, "FW_CmdStart" );
}

public FW_CmdStart(id)
{
    set_user_maxspeed(id, 500.0)
}
raizo11 is offline
Send a message via ICQ to raizo11 Send a message via AIM to raizo11 Send a message via MSN to raizo11 Send a message via Yahoo to raizo11 Send a message via Skype™ to raizo11
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-21-2018 , 21:27   Re: Change maxspeed to all players.
Reply With Quote #4

@raizo11 - That's a terrible idea.

The second code in the first post is wrong - you're setting the speed for ALL players when the speed for ONE player is updated. The first code won't even do anything.
__________________

Last edited by OciXCrom; 03-21-2018 at 21:30.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
massouh2004
Junior Member
Join Date: Mar 2018
Location: Casablanca, Morocco.
Old 03-22-2018 , 09:08   Re: Change maxspeed to all players.
Reply With Quote #5

Quote:
Originally Posted by OciXCrom View Post
@raizo11 - That's a terrible idea.

The second code in the first post is wrong - you're setting the speed for ALL players when the speed for ONE player is updated. The first code won't even do anything.
OK. Then give me an example to convert my idea into a Pawn code, OciXCrom.

Last edited by massouh2004; 03-22-2018 at 09:10. Reason: I didn't write OciXCrom's name well.
massouh2004 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 03-22-2018 , 09:28   Re: Change maxspeed to all players.
Reply With Quote #6

PHP Code:

#include <amxmodx>
#include <hamsandwich>

public plugin_init()
{
    
    for(new 
CSW_P228sWpnname[32]; <= CSW_P90i++)
    {
        
get_weaponname(isWpnnamecharsmax(sWpnname))
        if(
strlen(sWpnname) <= 7) continue;
        
        
RegisterHam(Ham_CS_Item_GetMaxSpeedsWpnname"fw_weapon_maxspeed_pre")
    }
}

public 
fw_weapon_maxspeed_pre(const wpn)
{
        
SetHamReturnFloat(500.0)
        return 
HAM_SUPERCEDE;

__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 03-22-2018 at 09:33.
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-22-2018 , 13:31   Re: Change maxspeed to all players.
Reply With Quote #7

Quote:
Originally Posted by Natsheh View Post
PHP Code:

#include <amxmodx>
#include <hamsandwich>

public plugin_init()
{
    
    for(new 
CSW_P228sWpnname[32]; <= CSW_P90i++)
    {
        
get_weaponname(isWpnnamecharsmax(sWpnname))
        if(
strlen(sWpnname) <= 7) continue;
        
        
RegisterHam(Ham_CS_Item_GetMaxSpeedsWpnname"fw_weapon_maxspeed_pre")
    }
}

public 
fw_weapon_maxspeed_pre(const wpn)
{
        
SetHamReturnFloat(500.0)
        return 
HAM_SUPERCEDE;

Thanks for your reply, Natsheh. I'm wondering why you used "CSW_P228", without any other weapons type. The thing I understand from what you wanted to do in your code is using "CSW_P228" as a mediator of every weapon that exists in Counter-Strike 1.6, so when the player change his weapon, the speed he has won't decline or anything else. Please tell me if I was wrong.
massouh2004 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 03-22-2018 , 15:04   Re: Change maxspeed to all players.
Reply With Quote #8

Because im looping throw all weapons from 1 to 30
1 is the csw_p228 id

And nope it will be set to 500
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 03-22-2018 at 18:17.
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-22-2018 , 15:25   Re: Change maxspeed to all players.
Reply With Quote #9

Quote:
Originally Posted by Natsheh View Post
Because im looping throw all weapons from 1 to 32
1 is the csw_p228 id

And nope it will be set to 500
Oh! OK, then. Thanks for your help, Natsheh.
massouh2004 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-22-2018 , 17:56   Re: Change maxspeed to all players.
Reply With Quote #10

Quote:
Originally Posted by Natsheh View Post
Because im looping throw all weapons from 1 to 32
1 to 30*

P228 = 1
P90 = 30
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
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 20:46.


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