Raised This Month: $ Target: $400
 0% 

I cant script help me .. :)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 06-02-2007 , 13:46   Re: I cant script help me .. :)
Reply With Quote #2

This should help a little:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun> // you need this module for the set_user_* functions in this plugin
#include <cstrike> // you need this module for cs_[set/get]_user_money

#define PLUGIN "Gummi_Bears"
#define VERSION "1.0"
#define AUTHOR "Gummi_Bears_fan"

new bool:has_juice[33]

new 
GBJ_costGBJ_healthGBJ_armorGBJ_speedGBJ_gravity

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /GBJ","buy_GummiBerryJuice")
    
register_event("ResetHUD","event_ResetHUD","b"// use the ResetHUD event to catch when the player spawns
    
register_event("DeathMsg","event_DeathMsg","a"); // use the DeathMsg event to take away the Juice
    
register_event("CurWeapon","event_CurWeapon","be"); // use the CurWeapon event to keep setting player's speed

    
GBJ_cost register_cvar("gbj_cost","16000"// cvar for cost
    
GBJ_health register_cvar("gbj_health","999"// cvar for health
    
GBJ_armor register_cvar("gbj_armor","999"// cvar for armor
    
GBJ_speed register_cvar("gbj_speed","450.0"// cvar for speed
    
GBJ_gravity register_cvar("gbj_health","0.5"// cvar for gravity
}

public 
client_connect(id) {
    
has_juice[id] = false // reset the bool variable back to false on connect
}

public 
buy_GummiBerryJuice(id)
{
    if(
has_juice[id])
    {
        
client_print(idprint_chat"[AMXX] You already have Gummi Bear Juice!")
        return 
PLUGIN_CONTINUE
    
}

    new 
money cs_get_user_money(id)

    if((
money get_pcvar_num(GBJ_cost)) < 0// check if the player has enough cash
    
{
        
client_print(idprint_chat"[AMXX] You don't have enough money for Gummi Bear Juice!")
        return 
PLUGIN_CONTINUE
    
}

    
has_juice[id] = true;

    
client_print(idprint_chat"[AMXX] You now have Gummi Bear Juice!")

    return 
PLUGIN_CONTINUE
}

public 
event_ResetHUD(id) { // you need to delay it
    
set_task(0.3"check_juice"id)
}

public 
check_juice(id) {
    if(
has_juice[id]) // check if the player has juice
    
{
        
set_user_health(idget_pcvar_num(GBJ_health))
        
set_user_armor(idget_pcvar_num(GBJ_armor))
        
set_user_maxspeed(idget_pcvar_float(GBJ_speed))
        
set_user_gravity(idget_pcvar_float(GBJ_gravity)) // needs to be a float (0.5 is 400 gravity)
    
}
}

public 
event_DeathMsg(id) { // remove Juice after death
    
has_juice[read_data(2)] = false
}

public 
event_CurWeapon(id) { // set player's maxspeed continuously
    
if(is_user_alive(id) && has_juice[id]) {
        
set_user_maxspeed(idget_pcvar_float(GBJ_gravity))
    }

As for the multi-jump, just download the source to it, then piece it together in your plugin and add credits.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.

Last edited by v3x; 06-02-2007 at 13:58. Reason: updated code
v3x 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:32.


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