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

[REQ] Dif gravity for CTs and Ts


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
blanko
Senior Member
Join Date: Aug 2008
Old 02-13-2019 , 05:00   [REQ] Dif gravity for CTs and Ts
Reply With Quote #1

Any way to make gravity different for CTs and Ts? Like Ts can jump way higher than cts?
__________________
blanko is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 02-13-2019 , 08:01   Re: [REQ] Dif gravity for CTs and Ts
Reply With Quote #2

An easy method would be this below, but there are better ways to achieve the same result.

Code:
/* Plugin generated by AMXX-Studio */

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

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

new CvarCtGravity, CvarTrGravity

public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	CvarCtGravity = register_cvar("amx_ct_gravity", "800")
	CvarTrGravity = register_cvar("amx_tr_gravity", "500")
	RegisterHam(Ham_Spawn,"player","fwPlayerSpawn",1)
}

public fwPlayerSpawn( id )
{
	if(!is_user_alive(id)) return
	
	switch(cs_get_user_team(id))
	{
		case CS_TEAM_T: set_user_gravity(id, get_pcvar_float(CvarTrGravity))

		case CS_TEAM_CT: set_user_gravity(id, get_pcvar_float(CvarCtGravity))
	}
}
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/

Last edited by iceeedr; 02-14-2019 at 08:21.
iceeedr is offline
Send a message via Skype™ to iceeedr
blanko
Senior Member
Join Date: Aug 2008
Old 02-13-2019 , 18:16   Re: [REQ] Dif gravity for CTs and Ts
Reply With Quote #3

Quote:
Originally Posted by iceeedr View Post
An easy method would be this below, but there are better ways to achieve the same result.

Code:
/* Plugin generated by AMXX-Studio */

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

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

new CvarCtGravity, CvarTrGravity

public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	CvarCtGravity = register_cvar("amx_ct_gravity", "800")
	CvarTrGravity = register_cvar("amx_tr_gravity", "500")
	RegisterHam(Ham_Spawn,"player","fwPlayerSpawn",1)
}

public fwPlayerSpawn( id )
{
	if(!is_user_connected(id) || !is_user_alive(id)) return
	
	new CsTeams:Team = cs_get_user_team(id)
	switch(Team)
	{
		case CS_TEAM_T: set_user_gravity(id, get_pcvar_float(CvarTrGravity))

		case CS_TEAM_CT: set_user_gravity(id, get_pcvar_float(CvarCtGravity))
	}
}
nothing happened
__________________
blanko is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-14-2019 , 07:41   Re: [REQ] Dif gravity for CTs and Ts
Reply With Quote #4

That means you have another plugin that's blocking the effects from this one

PS: iceeedr - "is_user_alive" also checks if the user is connected, you don't need both checks in there. Also the "Team" variable is unnecessary.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 02-14-2019 , 07:45   Re: [REQ] Dif gravity for CTs and Ts
Reply With Quote #5

Quote:
Originally Posted by OciXCrom View Post
That means you have another plugin that's blocking the effects from this one

PS: iceeedr - "is_user_alive" also checks if the user is connected, you don't need both checks in there. Also the "Team" variable is unnecessary.
@Ocix You're right though, I've experienced some "invalid player" errors, when just check if the player is alive, I know in the documentation it's written that by obvious if someone is alive it's because they're connected but in reality I've experienced some problems with that ... and as for the variable, I really do not know what I was thinking at the time: D
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-14-2019 , 07:56   Re: [REQ] Dif gravity for CTs and Ts
Reply With Quote #6

Nope, it's not possible to experience such errors. "is_user_alive" is the only thing you need in this case - you can even check the function's code in Github:

PHP Code:
static cell AMX_NATIVE_CALL is_user_alive(AMX *amxcell *params/* 1 param */
{
    
int index params[1];

    if (
index || index gpGlobals->maxClients)
    {
        return 
FALSE;
    } 
As you can see, the first thing it checks is if the user is connected. If you got errors, it was probably a different scenario.
__________________

Last edited by OciXCrom; 02-14-2019 at 07:56.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
blanko
Senior Member
Join Date: Aug 2008
Old 02-14-2019 , 16:42   Re: [REQ] Dif gravity for CTs and Ts
Reply With Quote #7

Quote:
Originally Posted by OciXCrom View Post
That means you have another plugin that's blocking the effects from this one

PS: iceeedr - "is_user_alive" also checks if the user is connected, you don't need both checks in there. Also the "Team" variable is unnecessary.
I don't know how to solve this... what kind of plugin could be blocking this one, buddy?
__________________
blanko is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-14-2019 , 16:57   Re: [REQ] Dif gravity for CTs and Ts
Reply With Quote #8

Probably some that is changing the gravity. If you don't know which one has such an option, try disabling all of them and then enable 1 by 1 to find it.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
PartialCloning
Senior Member
Join Date: Dec 2015
Old 02-14-2019 , 17:27   Re: [REQ] Dif gravity for CTs and Ts
Reply With Quote #9

It's not your plugins, the above plugin isn't setting the gravity correctly.

Try this:

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

new gCvarGravity[4];

public 
plugin_init() 

    
register_plugin("Team Specific Gravity""1.0""Partial Cloning");

    
gCvarGravity[0] = get_cvar_pointer("sv_gravity");
    
gCvarGravity[1] = register_cvar("sv_gravity_tt""400");
    
gCvarGravity[2] = register_cvar("sv_gravity_ct""800");
    
gCvarGravity[3] = register_cvar("sv_gravity_sp""1900");

    
RegisterHam(Ham_Spawn"player""HamOnPlayerSpawnPost"1);
}

public 
HamOnPlayerSpawnPost(id)
{
    if(!
is_user_alive(id))
        return 
HAM_IGNORED;

    
set_pev(idpev_gravityget_pcvar_float(gCvarGravity[_:cs_get_user_team(id)]) / get_pcvar_float(gCvarGravity[0]));
    return 
HAM_IGNORED;

PartialCloning 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 05:39.


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