Raised This Month: $ Target: $400
 0% 

Help longjump


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Akatsuki
Member
Join Date: Jul 2009
Old 11-01-2009 , 05:55   Help longjump
Reply With Quote #1

I have one error when i compile Warning: Function "fw_PlayerPreThink" should return a value on line 218


Here:

Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx> 
#include <amxmisc> 
#include <nvault> 
#include <cstrike> 
#include <fakemeta>

#define PLUGIN "ZombieXpMod"
#define VERSION "0.0.4"
#define AUTHOR "AKatsuki"

#define MAXCLASSES 4
#define Player

enum { 
    PLAYERLEVEL_1, 
    PLAYERLEVEL_2, 
    PLAYERLEVEL_3,
    PLAYERLEVEL_4, 
    PLAYERLEVEL_5, 
    PLAYERLEVEL_6 
} 
enum {
    CLASS_Hunter = 0,
    CLASS_Smoker, 
    CLASS_Boomer, 
    CLASS_Wich
} 

new PlayerXP[33],PlayerLevel[33],PlayerClass[33];
new XP_Kill,XP_Hs,SaveXP;
new g_Vault;


//Hunter
new Float:g_last_LongJump_time[33]
new g_LongJump_force, g_LongJump_height, g_LongJump_cooldown



//Class and xp
new const CLASSES[MAXCLASSES][] = {"Hunter","Smoker","Boomer","Wich"};
new const LEVELS[15] = {80,160,320,640,1280,2560,5120,8380,13560,19620,27820,38120,42320,51620,66400};

//Cvars
public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR);
 
    register_event("DeathMsg", "eDeath", "a");

    SaveXP = register_cvar("SaveXP","1");
    XP_Kill=register_cvar("XP_per_kill", "20");
    XP_Hs=register_cvar("XP_hs_bonus","20");
    g_Vault = nvault_open("ZombieXpMod");

    register_clcmd("say /class", "ChangeClass");
    register_clcmd("say class", "ChangeClass");
    register_clcmd("say /xp", "ShowHud");
    register_clcmd("say xp", "ShowHud");
    
    //Hunter cvars
    g_LongJump_force = register_cvar("gmx_longjump_force", "550")
    g_LongJump_height = register_cvar("gmx_longjump_height", "255")
    g_LongJump_cooldown = register_cvar("gmx_longjump_cooldown", "5.0")
    
    //Register
    register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")

    
    
    
}

public eDeath( )
{
    new attacker = read_data( 1 );
    new headshot = read_data( 3 );
    
       new clip, ammo, weapon = get_user_weapon(attacker, clip, ammo); 
        PlayerXP[attacker] += get_pcvar_num(XP_Kill); 
    if(headshot) 
    PlayerXP[attacker] += get_pcvar_num(XP_Hs) ;
 
    if(weapon == CSW_KNIFE)
    PlayerXP[attacker] += get_pcvar_num(XP_Kill);

    while(PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]]) 
    {
        client_print(attacker, print_chat, "[ZombieXpMod] Congratulations! You are a level %i %s!", PlayerLevel[attacker],CLASSES[PlayerClass[attacker]]) 
        PlayerLevel[attacker] += 1 
    } 
    ShowHud(attacker)
 
}  

public ShowHud(id) 
{ 
    set_hudmessage(255, 0, 0, 0.75, 0.01, 0, 6.0, 15.0) 
    show_hudmessage(id, "Level: %i^nXP: %i^nClass: %s",PlayerLevel[id],PlayerXP[id],CLASSES[PlayerClass[id]]) 
}  

//Menu
public ChangeClass(id) 
{
    new menu = menu_create("Class Menu" , "Class_Handle");
    menu_additem(menu ,"Hunter", "1" , 0); 
    menu_additem(menu ,"Smoker", "2" , 0); 
    menu_additem(menu ,"Boomer", "3" , 0); 
    menu_additem(menu ,"Wich", "4" , 0);
    menu_setprop(menu , MPROP_EXIT , MEXIT_ALL);
    menu_display(id , menu , 0); 
    return PLUGIN_CONTINUE; 
} 
 
public Class_Handle(id , menu , item)
{
    if(item == MENU_EXIT)
    {
    menu_destroy(menu);
    }
    new szCommand[6] , szName[64]; new access , callback;
    menu_item_getinfo(menu , item , access , szCommand , 5 , szName , 63 , callback);
    new i = str_to_num(szCommand)
    if(PlayerClass[id] != i)
    { 
    PlayerClass[id] = i;
    client_print(id,print_chat,"You are now a %s", CLASSES[i]);
    }
    else
    {
    client_print(id,print_chat,"You are alredy a %s",CLASSES[i])
    }
    menu_destroy(menu);
    return PLUGIN_CONTINUE 
}

//Save xp fuction
public client_connect(id) 
    {
    if(get_pcvar_num(SaveXP) == 1) 
    { 
    LoadData(id) 
    } 
}  
public client_disconnect(id) 
{ 
    if(get_pcvar_num(SaveXP) == 1) 
    SaveData(id) 
      
    PlayerXP[id]    = 0; 
    PlayerLevel[id]    = 0; 
    PlayerClass[id]    = 0; 
}
//Save data by IP
SaveData(id)
{ 
    new authip[32];
    get_user_ip(id,authip,31,1);
    
    new szData[256];
    new szKey[64];
            
    formatex( szKey , 63 , "%s-IP" , authip);
    formatex(szData, 255, "%i#%i#", PlayerXP[id], PlayerLevel[id]); 
        
    nvault_set( g_Vault , szKey , szData );
    
    return PLUGIN_CONTINUE; 
}
//Load data by IP
LoadData(id)
{
    new authip[32]
    get_user_ip(id,authip,31,1)

    
    new szData[256];
    new szKey[40];

    formatex( szKey , 39 , "%s-IP" , authip);
    formatex(szData, 255, "%i#%i#", PlayerXP[id], PlayerLevel[id]); 
            
    nvault_get(g_Vault, szKey, szData, 255) 

    replace_all(szData , 255, "#", " ")
    
    new playerxp[32], playerlevel[32]; 
    
    parse(szData, playerxp, 31, playerlevel, 31); 
    
    PlayerLevel[id] = str_to_num(playerlevel);
    PlayerXP[id] = str_to_num(playerxp); 
    
    return PLUGIN_CONTINUE; 
}

//Skilai
public fw_PlayerPreThink(id)
{    
    if (!is_user_alive(id))
        return FMRES_IGNORED
    
    if (allow_LongJump(id))
    {
        static Float:velocity[3]
        velocity_by_aim(id, get_pcvar_num(g_LongJump_force), velocity)
        
        velocity[2] = get_pcvar_float(g_LongJump_height)
            
        set_pev(id, pev_velocity, velocity)
        
        g_last_LongJump_time[id] = get_gametime()
    }    
return FMRES_IGNORED
}

allow_LongJump(id)
{
    if(PlayerClass[id] == CLASS_Hunter)
        return false
    
    if (!(pev(id, pev_flags) & FL_ONGROUND) || fm_get_speed(id) < 80)
        return false
    
    static buttons
    buttons = pev(id, pev_button)
    
    if (!is_user_bot(id) && (!(buttons & IN_JUMP) || !(buttons & IN_DUCK)))
        return false
    
    if (get_gametime() - g_last_LongJump_time[id] < get_pcvar_float(g_LongJump_cooldown))
        return false
    
    return true
}


stock fm_get_speed(entity)
{
    static Float:velocity[3]
    pev(entity, pev_velocity, velocity)
    
    return floatround(vector_length(velocity))
}
__________________
ZombieXpMod Done 100%
Maybe I will create Avatar mod Na'vi vs Humans pending...

Last edited by Akatsuki; 11-01-2009 at 06:24.
Akatsuki 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 17:35.


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