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

[REQ] Player Speed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Choose_Your_Destiny
Senior Member
Join Date: May 2011
Old 07-25-2011 , 08:33   [REQ] Player Speed
Reply With Quote #1

Hi guys,

I'm request a plugin. I make a code

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fun>
#include <cstrike>



public plugin_init() {
    
register_plugin("Player Speed""1.0""Choose")
    
RegisterHam(Ham_Spawn"player""player_speed",1)
}



public 
player_speed(player)
{
    
    
set_user_maxspeed(player,999.0)

Plugin is work. But, The beginning of each round will be reset speed( normal player speed )

I make a player speed "999.0"


Help me Please...
Choose_Your_Destiny is offline
Sepsis
Senior Member
Join Date: Jul 2011
Old 07-25-2011 , 09:00   Re: [REQ] Player Speed
Reply With Quote #2

Good This code only gravity?
Sepsis is offline
Old 07-25-2011, 09:02
Erdener
This message has been deleted by Erdener.
Old 07-25-2011, 09:04
Erdener
This message has been deleted by Erdener. Reason: misunderstand :)
Erdener
Senior Member
Join Date: Apr 2010
Location: Turkey
Old 07-25-2011 , 09:10   Re: [REQ] Player Speed
Reply With Quote #3

Try this:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fun>
#include <cstrike>



public plugin_init() {
    
register_plugin("Player Gravity""1.0""Choose")
    
RegisterHam(Ham_Spawn"player""player_gravity",1)
}



public 
player_gravity(player)
{
    
    
set_user_gravity(player,0.5)

__________________
Erdener is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-25-2011 , 10:24   Re: [REQ] Player Speed
Reply With Quote #4

You have to check if player is alive when you hook Ham_Spawn.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
2reason2kill
Senior Member
Join Date: Feb 2011
Old 07-25-2011 , 19:18   Re: [REQ] Player Speed
Reply With Quote #5

Quote:
Originally Posted by Exolent[jNr] View Post
You have to check if player is alive when you hook Ham_Spawn.
like
Is this right?
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#include <Hamsandwich>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_Spawn"player""CmdRoundstart"1)
}
public 
CmdRoundstart(id)
{
    if(!
is_user_alive(id)
        return 
PLUGIN_HANDLED
        
    
if(is_user_alive(id)
    {
        
set_user_gravity(player,0.5)
    }

2reason2kill is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-25-2011 , 19:36   Re: [REQ] Player Speed
Reply With Quote #6

Quote:
Originally Posted by 2reason2kill View Post
like
Is this right?
PHP Code:
public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_Spawn"player""CmdRoundstart"1)
}
public 
CmdRoundstart(id)
{
    if(!
is_user_alive(id)
        return 
PLUGIN_HANDLED
        
    
if(is_user_alive(id)
    {
        
set_user_gravity(player,0.5)
    }

It won't compile so it's clearly not correct. However, you should not ever check is_user_alive() twice in a function. Do it like this:

PHP Code:
// plugin init
    
RegisterHam(Ham_Spawn"player""PlayerSpawned"1)

public 
PlayerSpawned(id)
{
    if( 
is_user_alive(id) )
    {
        
// player spawned successfully.
    
}

If you notice, I use descriptive function names to describe when the function is actually being called (it's not called on round start).

Just noticed that this thread has been hijacked! The OP has never gotten an answer.
__________________

Last edited by fysiks; 07-25-2011 at 19:40.
fysiks is offline
Choose_Your_Destiny
Senior Member
Join Date: May 2011
Old 07-26-2011 , 01:14   Re: [REQ] Player Speed
Reply With Quote #7

Hey, I want to this isn't.

I want player speed 999.0 , No gravity
Choose_Your_Destiny is offline
Old 07-26-2011, 02:07
Kreation
This message has been deleted by Kreation. Reason: use code below
bibu
Veteran Member
Join Date: Sep 2010
Old 07-26-2011 , 10:24   Re: [REQ] Player Speed
Reply With Quote #8

"CurWeapon" is a bad way for changing player's speed.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-26-2011 , 17:15   Re: [REQ] Player Speed
Reply With Quote #9

Hook Ham_Item_PreFrame for player (AKA Ham_Player_ResetMaxSpeed) and set player's speed if their maxspeed is not 1.0.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Kreation
Veteran Member
Join Date: Jan 2010
Location: Illinois
Old 07-26-2011 , 22:51   Re: [REQ] Player Speed
Reply With Quote #10

I'm not sure if Ham_Spawn is still needed, but it's there anyways.

Code:
#include < amxmodx > #include < hamsandwich > #include < fakemeta > const Float:g_fSpeed = 999.0; new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame; public plugin_init( ) {     register_plugin( "Set Speed", "0.0.1", "kreationn" );         RegisterHam( Ham_Spawn, "player", "FwdPlayerSpawn_Post", 1 );     RegisterHam( Ham_Player_ResetMaxSpeed, "player", "FwdPlayerResetMaxSpeed_Post", 1 ); } public FwdPlayerSpawn_Post( id ) {     if( is_user_alive( id ) )     {         set_pev( id, pev_maxspeed, g_fSpeed );     } } public FwdPlayerResetMaxSpeed_Post( id ) {     if( is_user_alive( id ) && pev( id, pev_maxspeed ) != 1.0 )     {         set_pev( id, pev_maxspeed, g_fSpeed );     } }
__________________
Hi.
Kreation 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 06:07.


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