AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Why this doesn't work? (https://forums.alliedmods.net/showthread.php?t=153543)

KviZ 03-25-2011 10:26

Why this doesn't work?
 
PHP Code:

public Gravity_set(id)
{
       if(
get_user_gravity(id) == 1.0)
       {
       
set_user_gravity(id0.50)
       }


Why this code doesn't work?

<VeCo> 03-25-2011 11:11

Re: Why this doesn't work?
 
Show your full code..

drekes 03-25-2011 11:45

Re: Why this doesn't work?
 
The function is probably not being called

KviZ 03-25-2011 12:01

Re: Why this doesn't work?
 
Well, how can I call it whenever player's gravity is 800?

drekes 03-25-2011 12:21

Re: Why this doesn't work?
 
Then get_user_gravity will return 1.0.
Again, the function is probably not being called.

KviZ 03-25-2011 12:24

Re: Why this doesn't work?
 
I don't understand :/

drekes 03-25-2011 13:33

Re: Why this doesn't work?
 
Post all the code and we'll take a look at it.

KviZ 03-25-2011 15:55

Re: Why this doesn't work?
 
PHP Code:

/*================================================================================
    
    -----------------------------------
    -*- [BB] Default Zombie Classes -*-
    -----------------------------------
    
    ~~~~~~~~~~~~~~~
    - Description -
    ~~~~~~~~~~~~~~~
    
    This plugin adds the default zombie classes from Zombie Plague
    into Base Builder. All credit belongs to MeRcyLeZZ.
    
    All classes have been balanced, but feel free to edit them if
    you are not satisfied.
    
================================================================================*/

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

/*================================================================================
 [Plugin Customization]
=================================================================================*/

// Classic Zombie Attributes
new const zclass1_name[] = { "Classic Zombie" }
new const 
zclass1_info[] = { "HP: 4000 Speed: 260" }
new const 
zclass1_model[] = { "bb_classic" }
new const 
zclass1_clawmodel[] = { "v_bloodyhands" }
const 
zclass1_health 4000
const zclass1_speed 260
const Float:zclass1_gravity 1.0
const zclass1_adminflags ADMIN_ALL

// Fast Zombie Attributes
new const zclass2_name[] = { "Fast Zombie" }
new const 
zclass2_info[] = { "HP: 3000 Speed: 325" }
new const 
zclass2_model[] = { "bb_fast" }
new const 
zclass2_clawmodel[] = { "v_bloodyhands" }
const 
zclass2_health 3000
const zclass2_speed 325
const Float:zclass2_gravity 1.0
const zclass2_adminflags ADMIN_ALL

// Jumper Zombie Attributes
new const zclass3_name[] = { "Jumper Zombie" }
new const 
zclass3_info[] = { "HP: 3500 Speed: 285 Gravity: 0.5x" }
new const 
zclass3_model[] = { "bb_jumper" }
new const 
zclass3_clawmodel[] = { "v_bloodyhands" }
const 
zclass3_health 3500
const zclass3_speed 285
const Float:zclass3_gravity 0.5
const zclass3_adminflags ADMIN_ALL

// Tanker Zombie Attributes
new const zclass4_name[] = { "Tanker Zombie" }
new const 
zclass4_info[] = { "HP: 5000 Speed: 210" }
new const 
zclass4_model[] = { "bb_tanker" }
new const 
zclass4_clawmodel[] = { "v_bloodyhands" }
const 
zclass4_health 5000
const zclass4_speed 210
const Float:zclass4_gravity 1.0
const zclass4_adminflags ADMIN_ALL
#define TANK_ARMOR 200

/*============================================================================*/

new g_zclass_tanker
new g_zclass_grav

// Zombie Classes MUST be registered on plugin_precache
public plugin_precache()
{
    
register_plugin("[BB] Default Zombie Classes""6.5""Tirant")
    
    
// Register all classes
    
bb_register_zombie_class(zclass1_namezclass1_infozclass1_modelzclass1_clawmodelzclass1_healthzclass1_speedzclass1_gravity0.0zclass1_adminflags)
    
bb_register_zombie_class(zclass2_namezclass2_infozclass2_modelzclass2_clawmodelzclass2_healthzclass2_speedzclass2_gravity0.0zclass2_adminflags)
    
g_zclass_grav bb_register_zombie_class(zclass3_namezclass3_infozclass3_modelzclass3_clawmodelzclass3_healthzclass3_speedzclass3_gravity0.0zclass3_adminflags)
    
g_zclass_tanker bb_register_zombie_class(zclass4_namezclass4_infozclass4_modelzclass4_clawmodelzclass4_healthzclass4_speedzclass4_gravity0.0zclass4_adminflags)
}

#if defined TANK_ARMOR
public plugin_init()
{
    
RegisterHam(Ham_Spawn"player""ham_PlayerSpawn_Post"1)
}

public 
Gravity_set(id)
{
    if (
bb_is_user_zombie(id) && bb_get_user_zombie_class(id) == g_zclass_grav && get_user_gravity(id) == 1)
    {
        
set_user_gravity(id0.5);
    }
}

public 
ham_PlayerSpawn_Post(id)
{
    if (!
is_user_alive(id))
        return ;
        
    if (
bb_is_user_zombie(id) && bb_get_user_zombie_class(id) == g_zclass_tanker)
    {
        
give_item(id"item_assaultsuit");
        
cs_set_user_armor(idTANK_ARMORCS_ARMOR_VESTHELM);
    }
}
#endif 


drekes 03-25-2011 16:09

Re: Why this doesn't work?
 
Like i said before, you're not calling the Gravity_set function. That's why it doesn't work.

KviZ 03-25-2011 17:08

Re: Why this doesn't work?
 
So how can I call it? :P


All times are GMT -4. The time now is 14:40.

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