Raised This Month: $51 Target: $400
 12% 

Extra item that gives lower gravity to human players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GlobalPlague
Senior Member
Join Date: Feb 2016
Location: Pluto
Old 03-11-2022 , 06:47   Extra item that gives lower gravity to human players
Reply With Quote #1

Hello. I'm looking for an extra item that when bought, will give lower gravity to the human who bought it.

By default, in Zombie Plague mod, the gravity of the human is 800. When the human buys the extra item, the gravity will be lowered, depending on the car - it could be lowered from 800 to 500 or 400, for example.

So, does such a plugin exist, or am i looking for something that doesn't exist?

If it exists and you know it, please, give me a link to download it.

Thanks.
GlobalPlague is offline
Dyaus
Member
Join Date: Aug 2021
Old 03-11-2022 , 08:45   Re: Extra item that gives lower gravity to human players
Reply With Quote #2

i have legitimate concerns that this is guy is using BING to search for stuff and even then some results should have showed up .. sigh

PHP Code:
#include <amxmodx>
#include <zombieplague>
#include <fun>

#define g_cost 25

new cvar_gvalgID
new base_gravity

public plugin_init()
{
    
register_plugin("[ZP] Extra Item : Lower Gravity""1.0""Dyaus" )
    
    
cvar_gval register_cvar("zp_gravity_value""0.5")
    
    
register_event("HLTV""event_HLTV""a""1=0""2=0")
    
register_event("DeathMsg""Death""a")
    
    
gID zp_register_extra_item("Low Gravity"g_costZP_TEAM_HUMAN)
    
    
base_gravity get_cvar_pointer("zp_human_gravity")
}

public 
Death()
{
    static 
id
    id 
read_data(2)
    
set_user_gravity(idget_pcvar_float(base_gravity))
}
public 
event_HLTV()
{
    static 
id
    set_user_gravity
(idget_pcvar_float(base_gravity))
}
public 
zp_extra_item_selected(iditemid)
{
    if(
itemid == gID)
    {
        
set_user_gravity(idget_pcvar_float(cvar_gval))
        
client_print(idprint_chat"[ZP] You have Bought : Low Gravity !!")
    }

Dyaus is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 03-11-2022 , 10:39   Re: Extra item that gives lower gravity to human players
Reply With Quote #3

There are a few issues with that code.

First, don't use static variables outside functions that aren't called once per frame.
Second, there is no "id" in HLTV, the proper way would be to loop through all players.

In zombie plague, the gravity is reset whenever the player becomes a human, you don't need to reset it.

Code:
#include <amxmodx>
#include <zombieplague>
#include <fun>

#define g_cost 25

new cvar_gval, gID

public plugin_init()
{
    register_plugin("[ZP] Extra Item : Lower Gravity", "1.0", "Dyaus" )
    
    cvar_gval = register_cvar("zp_gravity_value", "0.5")

    gID = zp_register_extra_item("Low Gravity", g_cost, ZP_TEAM_HUMAN)
}

public zp_extra_item_selected(id, itemid)
{
    if(itemid == gID)
    {
        set_user_gravity(id, get_pcvar_float(cvar_gval))
        client_print(id, print_chat, "[ZP] You have Bought : Low Gravity !!")
    }
}
__________________








CrazY. is offline
Dyaus
Member
Join Date: Aug 2021
Old 03-11-2022 , 13:03   Re: Extra item that gives lower gravity to human players
Reply With Quote #4

Quote:
Originally Posted by CrazY. View Post
There are a few issues with that code.

First, don't use static variables outside functions that aren't called once per frame.
Second, there is no "id" in HLTV, the proper way would be to loop through all players.

In zombie plague, the gravity is reset whenever the player becomes a human, you don't need to reset it.
Ok , noted ,newbie here , thanks for that
Quote:
Originally Posted by CrazY. View Post
Code:
#include <amxmodx>
#include <zombieplague>
#include <fun>

#define g_cost 25

new cvar_gval, gID

public plugin_init()
{
    register_plugin("[ZP] Extra Item : Lower Gravity", "1.0", "Dyaus" )
    
    cvar_gval = register_cvar("zp_gravity_value", "0.5")

    gID = zp_register_extra_item("Low Gravity", g_cost, ZP_TEAM_HUMAN)
}

public zp_extra_item_selected(id, itemid)
{
    if(itemid == gID)
    {
        set_user_gravity(id, get_pcvar_float(cvar_gval))
        client_print(id, print_chat, "[ZP] You have Bought : Low Gravity !!")
    }
}
you didn't include HLTV event in your code , does it reset automatically evrey round ?
Dyaus is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 03-11-2022 , 13:13   Re: Extra item that gives lower gravity to human players
Reply With Quote #5

Quote:
Originally Posted by Dyaus View Post
Ok , noted ,newbie here , thanks for that


you didn't include HLTV event in your code , does it reset automatically evrey round ?
Yes, but when respawn, not when new round start, because there is an code check the gravity, speed, hp and armor... for humans


PHP Code:
set_user_gravity(idget_pcvar_float(cvar_gval)) 

PHP Code:
set_user_gravity(idget_pcvar_float(cvar_gval) / 800.0 
PHP Code:
cvar_gval register_cvar("zp_gravity_value""400"
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 03-11-2022 at 13:13.
Supremache is offline
Dyaus
Member
Join Date: Aug 2021
Old 03-11-2022 , 13:42   Re: Extra item that gives lower gravity to human players
Reply With Quote #6

Quote:
Originally Posted by Supremache View Post

PHP Code:
set_user_gravity(idget_pcvar_float(cvar_gval)) 

PHP Code:
set_user_gravity(idget_pcvar_float(cvar_gval) / 800.0 
PHP Code:
cvar_gval register_cvar("zp_gravity_value""400"
Fun module converts that float on its own ; 1.0 --> 800 as default , i don't see why that needs to be changed , unless this was intented for request author to make things easier for him (in that case by all means , please use this )
Dyaus is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 03-11-2022 , 13:59   Re: Extra item that gives lower gravity to human players
Reply With Quote #7

Quote:
Originally Posted by Dyaus View Post
Fun module converts that float on its own ; 1.0 --> 800 as default , i don't see why that needs to be changed , unless this was intented for request author to make things easier for him (in that case by all means , please use this )
Just to be easier
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.
Supremache 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 21:17.


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