Raised This Month: $ Target: $400
 0% 

Gravity --'


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Monster Truck
Member
Join Date: Jan 2012
Location: France
Old 01-01-2014 , 16:39   Gravity --'
Reply With Quote #1

Hi all, i've got some problems now with a plugin. I give you here a little description. It shows a menu each round for Terros and Cts wich allows them to choose their races. One of them (in Terro) gives Gravity, and there is my problem.

When it stills 1 Terro, he can open a menu that allows him to 1v1 each ct untill the last one.

The problem is that the last Terro get is gravity to normal, but it wont work. Honnestly, i don't really know the normal gravity value.

Anyway, had the same problem for speed and fixed it.

I show the whole code here :
PHP Code:
#include <amxmodx>
#include <fun>
#include <fakemeta>
#include <cstrike>
#include <hamsandwich>

#define VERSION "2.3"

new g_PlayersSpeedg_PlayersSpeedLastg_maxPlayers
new boolg_isAlive33 ], CsTeamsg_playerTeam33 ]

public 
plugin_init()
{
    
register_plugin("Classes"VERSION"Imag!ne")
    
RegisterHam(Ham_Spawn"player""PlayerSpawn"1)
    
    
g_PlayersSpeed register_cvar("terro_menu""700")
    
g_PlayersSpeedLast register_cvar("Gravity_Speed_Last_Handler""320")
    
g_maxPlayers get_maxplayers( );
}

public 
PlayerSpawn(id)
{
    if(
is_user_alive(id))
    {
        
strip_user_weapons(id)
        
set_pdata_int(id1160)
        
give_item(id"weapon_knife")
        switch(
cs_get_user_team(id))
        {
            case 
CS_TEAM_Tterro(id);
            case 
CS_TEAM_CTrace(id);
        }
    }
}

public 
race(id)
{
    new 
menu menu_create("Choisis Ta classe de Garde :""furien_menu")
    
menu_additem(menu"\wMilitaire \y- \w[ \rM4 \w+ \rDeagle \w]""1")
    
menu_additem(menu"\wSniper \y- \w[ \rAwp \w+ \rDeagle \w]""2")
    
menu_additem(menu"\wMarine \y- \w[ \rMitrailleuse \w+ \rUsp \w]""3")
    
menu_additem(menu"\wGarde \y- \w[ \rAk47 \w+ \rDeagle \w+ \rFlash \w]""4")
    
menu_setprop(menuMPROP_EXITNAME"Quitter")
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
menu_display(idmenu)
}

public 
terro(id)
{
    new 
menu menu_create("Choisis Ta classe de Prisonnier :""terro_menu")
    
menu_additem(menu"\wAssasin \y- \w[ \rGravite \w+ \rArmure \w]""1")
    
menu_additem(menu"\wDealer \y- \w[ \r140Hp \w+ \rArmure \w]""2")
    
menu_additem(menu"\wPedophile \y- \w[ \rVitesse \w+ \rArmure \w]""3")
    
menu_additem(menu"\wTerroriste \y- \w[ \rHe \w+ \rArmure \w]""4")
    
menu_setprop(menuMPROP_EXITNAME"Quitter")
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
menu_display(idmenu)
}



public 
furien_menu(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED;
    }
    new 
info[3]
    new 
accesscallback
    menu_item_getinfo
(menuitemaccessinfo6__callback)
    
    if(
is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT)
    {   
        new 
key str_to_num(info)
    
        switch(
key)
        {
            case 
1:
            {
                
give_item(id"weapon_m4a1")
                
cs_set_user_bpammo(idCSW_M4A19000)
                
give_item(id"weapon_deagle")
                
cs_set_user_bpammo(idCSW_DEAGLE3500)
            }
            case 
2:
            {
                
give_item(id"weapon_awp")
                
cs_set_user_bpammo(idCSW_AWP9000)
                
give_item(id"weapon_deagle")
                
cs_set_user_bpammo(idCSW_DEAGLE3500)
            }
            case 
3:
            {
                
give_item(id,"weapon_m249")
                
cs_set_user_bpammo(idCSW_M2499000)
                
give_item(id"weapon_usp")
                
cs_set_user_bpammo(idCSW_USP3500)
            }
            case 
4:
            {
                
give_item(id"weapon_ak47")
                
cs_set_user_bpammo(idCSW_AK479000)
                
give_item(id"weapon_deagle")
                
cs_set_user_bpammo(idCSW_DEAGLE3500)
                
give_item(id"weapon_flashbang")
            }
        }
    }
    return 
PLUGIN_CONTINUE;
}


public 
terro_menu(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED;
    }
    new 
info[3]
    new 
accesscallback
    menu_item_getinfo
(menuitemaccessinfo6__callback)
    
    if(
is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T)
    {   
        new 
key str_to_num(info)
    
        switch(
key)
        {
            case 
1:
            {
                
set_user_gravity(id,0.400)
                
cs_set_user_armor(id,100CS_ARMOR_VESTHELM)
            }
            case 
2:
            {
                
set_user_healthidget_user_health(id) + 40 )
                
cs_set_user_armor(id,100CS_ARMOR_VESTHELM)
            }
            case 
3:
            {
                
set_user_maxspeed(id,  get_pcvar_float(g_PlayersSpeed))
                
cs_set_user_armor(id100CS_ARMOR_VESTHELM)
            }
            case 
4:
            {
                
give_item(id"weapon_hegrenade")
                
cs_set_user_armor(id100CS_ARMOR_VESTHELM)
            }
        }
    }
    return 
PLUGIN_CONTINUE;
}

public 
Gravity_Speed_Last_Handleridmenuitem )
{
    if( 
item == MENU_EXIT || getOneTerrorist( ) != id || !g_isAliveid ] )
    {
        
set_user_maxspeedidget_pcvar_float(g_PlayersSpeedLast))
        
set_user_gravity(id)
    }
}

stock getOneTerrorist( )
{
    new 
count;
       
    for( new 
id 1id <= g_maxPlayersid ++ )
    {
        if( 
g_isAliveid ] && g_playerTeamid ] == CS_TEAM_T )
        {
            if( 
count )
            {
                
count 0;
                break;
            }
            else
            {
                
count id;
            }
        }
    }
       
    return 
count;
}

public 
client_putinserverid )
{
    
g_playerTeamid ] = CS_TEAM_SPECTATOR;

Can anybody help me with that issue ?

Last edited by Monster Truck; 01-02-2014 at 06:55. Reason: New Code 2.3
Monster Truck is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 01-01-2014 , 18:37   Re: Gravity --'
Reply With Quote #2

set_user_gravity to 1 to set it back to sv_gravity
jimaway is offline
Monster Truck
Member
Join Date: Jan 2012
Location: France
Old 01-02-2014 , 04:38   Re: Gravity --'
Reply With Quote #3

I get "tag mismatch" if i do that, is it okay anyway ?

EDIT : it won't work, the gravity stays at 0,400 and won't back to normal. :/ (Pasted New Code)

EDIT2 : maybe the right question is : What is the normal value of gravity in set_user_gravity ? Thanks for any answer

Last edited by Monster Truck; 01-02-2014 at 05:53.
Monster Truck is offline
Monster Truck
Member
Join Date: Jan 2012
Location: France
Old 01-02-2014 , 06:40   Re: Gravity --'
Reply With Quote #4

Code Edited, i found the normal value (1.0) but is still wont work .

I'm not upping, just telling what's new on my problem :/

Thanks in advance for any answers.
Monster Truck is offline
DavidJr
Senior Member
Join Date: Apr 2012
Old 01-02-2014 , 06:47   Re: Gravity --'
Reply With Quote #5

PHP Code:
set_user_gravity(id
It makes the gravity normal.
__________________
What are you looking for here?
DavidJr is offline
Monster Truck
Member
Join Date: Jan 2012
Location: France
Old 01-02-2014 , 06:56   Re: Gravity --'
Reply With Quote #6

Code Edited to 2.3

Thank u, but ... i added this to the New Code with set_user_gravity (id) and IT STILL wont work :/

Help me i'm going mad

Last edited by Monster Truck; 01-02-2014 at 06:56.
Monster Truck is offline
11922911
Senior Member
Join Date: Dec 2011
Location: Yuen Long Country
Old 01-02-2014 , 07:03   Re: Gravity --'
Reply With Quote #7

where is Gravity_Speed_Last_Handler used?
__________________
youtube:
@holla16
11922911 is offline
Monster Truck
Member
Join Date: Jan 2012
Location: France
Old 01-02-2014 , 07:19   Re: Gravity --'
Reply With Quote #8

Used in the last public fuction, there is the code

PHP Code:
public Gravity_Speed_Last_Handleridmenuitem )
{
         if( 
item == MENU_EXIT || getOneTerrorist( ) != id || !g_isAliveid ] )
        {
                 
set_user_maxspeedidget_pcvar_float(g_PlayersSpeedLast))
                 
set_user_gravity(id)
        }


Last edited by Monster Truck; 01-02-2014 at 07:25.
Monster Truck is offline
11922911
Senior Member
Join Date: Dec 2011
Location: Yuen Long Country
Old 01-02-2014 , 07:38   Re: Gravity --'
Reply With Quote #9

Quote:
Originally Posted by Monster Truck View Post
Used in the last public fuction, there is the code

PHP Code:
public Gravity_Speed_Last_Handleridmenuitem )
{
         if( 
item == MENU_EXIT || getOneTerrorist( ) != id || !g_isAliveid ] )
        {
                 
set_user_maxspeedidget_pcvar_float(g_PlayersSpeedLast))
                 
set_user_gravity(id)
        }

It won't working because the function has never been used or called by other thing.
__________________
youtube:
@holla16
11922911 is offline
DavidJr
Senior Member
Join Date: Apr 2012
Old 01-02-2014 , 07:40   Re: Gravity --'
Reply With Quote #10

You didn't call this function.
PHP Code:
Gravity_Speed_Last_Handler 
Damn, you are faster than me.
__________________
What are you looking for here?

Last edited by DavidJr; 01-02-2014 at 07:46.
DavidJr 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 10:09.


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