Raised This Month: $ Target: $400
 0% 

Gravity --'


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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