AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   change gravity on round start? (https://forums.alliedmods.net/showthread.php?t=193163)

freaka61 08-17-2012 02:56

change gravity on round start?
 
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 =)]

floatman 08-17-2012 04:45

Re: change gravity on round start?
 
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;



jimaway 08-17-2012 05:13

Re: change gravity on round start?
 
default: continue;

if you return on default, some players might not get gravity when there is 1 player in TEAM_SPECTATOR

matsi 08-17-2012 07:20

Re: change gravity on round start?
 
@floatman
New Round / Player Spawn / Round Start / Round End - do Not mess it

@freaka61
You should've posted in Suggestions / Requests

Liverwiz 08-17-2012 14:01

Re: change gravity on round start?
 
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.

matsi 08-17-2012 14:14

Re: change gravity on round start?
 
Quote:

Originally Posted by Liverwiz (Post 1774246)
I would have used HamSpawn

Thats not something freaka61 asked for. He asked in round start.

Liverwiz 08-17-2012 14:29

Re: change gravity on round start?
 
Quote:

Originally Posted by matsi (Post 1774261)
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?

matsi 08-17-2012 14:36

Re: change gravity on round start?
 
Quote:

Originally Posted by Liverwiz (Post 1774283)
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". :3 But like you said setting them in spawn would avoid problem of "late joining" and not getting the gravity. :wink:


All times are GMT -4. The time now is 05:51.

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