Raised This Month: $ Target: $400
 0% 

change gravity on round start?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
freaka61
Junior Member
Join Date: Dec 2010
Old 08-17-2012 , 02:56   change gravity on round start?
Reply With Quote #1

hi, i want to make a mod. but i can't make that. at the round start plugin will change gravity 500 for T players and change gravity 700 for CT players. that's all. can anybody help me? [please don't suggess any plugin, i wan't only simple-short plugin for this =)]
freaka61 is offline
floatman
Senior Member
Join Date: Oct 2009
Location: nowhere.
Old 08-17-2012 , 04:45   Re: change gravity on round start?
Reply With Quote #2

It would be something like this:
PHP Code:
#include < amxmodx >
#include < fun >


public plugin_init()
{
    
register_event"HLTV""roundstart""a""1=0""2=0" );
}

public 
roundstart()
{
    new 
players32 ], numi;
    
get_playersplayersnum );

    for( 
0numi++ )
    {
        switch( 
get_user_teamplayers] ) )
        {
            case 
1:
            {
                
set_user_gravityplayers], 0.625 );
            }

            case 
2:
            {
                
set_user_gravityplayers], 0.875 );
            }

            default: continue;
        }
    }

    return 
PLUGIN_HANDLED;

__________________


Last edited by floatman; 08-17-2012 at 05:50.
floatman is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 08-17-2012 , 05:13   Re: change gravity on round start?
Reply With Quote #3

default: continue;

if you return on default, some players might not get gravity when there is 1 player in TEAM_SPECTATOR
jimaway is offline
matsi
Thinkosaur
Join Date: Sep 2006
Old 08-17-2012 , 07:20   Re: change gravity on round start?
Reply With Quote #4

@floatman
New Round / Player Spawn / Round Start / Round End - do Not mess it

@freaka61
You should've posted in Suggestions / Requests
matsi is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 08-17-2012 , 14:01   Re: change gravity on round start?
Reply With Quote #5

I would have used Ham_Spawn

PHP Code:
public player_spawnPost(id)
{
    if(! 
is_user_alive(id) )
        return 
HAM_IGNORED

    
switch( get_user_team(id) )
    {
        case 
1:
            
set_user_gravity(id0.625 );
        case 
2:
            
set_user_gravity(id0.875 );
    }
    
    return 
HAM_HANDLED;

See how much easier that is?
Its faster as well.
__________________
What an elegant solution to a problem that doesn't need solving....

Last edited by Liverwiz; 08-17-2012 at 14:33. Reason: Fixed return types, added alive check, removed default
Liverwiz is offline
matsi
Thinkosaur
Join Date: Sep 2006
Old 08-17-2012 , 14:14   Re: change gravity on round start?
Reply With Quote #6

Quote:
Originally Posted by Liverwiz View Post
I would have used HamSpawn
Thats not something freaka61 asked for. He asked in round start.
__________________

Accepting all kinds of requests via private message.
matsi is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 08-17-2012 , 14:29   Re: change gravity on round start?
Reply With Quote #7

Quote:
Originally Posted by matsi View Post
Thats not something freaka61 asked for. He asked in round start.
Yeah, but it all depends on what he's actually trying to do. If its a CSDM server, yes there would be a different method to this. But assuming you spawn at round start and don't spawn again till the start of the next round....its a moot point.

Might OP be more specific so he can get better answers?
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
matsi
Thinkosaur
Join Date: Sep 2006
Old 08-17-2012 , 14:36   Re: change gravity on round start?
Reply With Quote #8

Quote:
Originally Posted by Liverwiz View Post
Yeah, but it all depends on what he's actually trying to do. If its a CSDM server, yes there would be a different method to this. But assuming you spawn at round start and don't spawn again till the start of the next round....its a moot point.

Might OP be more specific so he can get better answers?
Until you have more info about what he "really" wants like you said. You shouldn't suggest any other codes that might confuse the "OP". But like you said setting them in spawn would avoid problem of "late joining" and not getting the gravity.
__________________

Accepting all kinds of requests via private message.
matsi 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 05:51.


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