Pagalbos Bhop pluginas

Šiame forume rašomi vartotojų klausimai/problemos su kuriomis jie susidūrė kuriant pluginus.
Post Reply
Shalikas
Naujokas apylinkėse
Posts: 2
Joined: 2014 Jul 17 19:27

Pagalbos Bhop pluginas

Post by Shalikas »

Man reikia kad žaidėjai galėtų išjungt ir įjunkt bhop, būčiau dėkingas jei padėtumėt.:)

Code: Select all

 #include <amxmodx>#include <engine> #define FL_WATERJUMP    (1<<11) // player jumping out of water#define FL_ONGROUND (1<<9)  // At rest / on the ground public plugin_init() {    register_plugin("Super Bunny Hopper", "1.2", "Cheesy Peteza")    register_cvar("sbhopper_version", "1.2", FCVAR_SERVER)     register_cvar("bh_enabled", "1")    register_cvar("bh_autojump", "1")    register_cvar("bh_showusage", "1")} public client_PreThink(id) {    if (!get_cvar_num("bh_enabled"))        return PLUGIN_CONTINUE     entity_set_float(id, EV_FL_fuser2, 0.0)     // Disable slow down after jumping     if (!get_cvar_num("bh_autojump"))        return PLUGIN_CONTINUE // Code from CBasePlayer::Jump (player.cpp)     Make a player jump automatically    if (entity_get_int(id, EV_INT_button) & 2) {    // If holding jump        new flags = entity_get_int(id, EV_INT_flags)         if (flags & FL_WATERJUMP)            return PLUGIN_CONTINUE        if ( entity_get_int(id, EV_INT_waterlevel) >= 2 )            return PLUGIN_CONTINUE        if ( !(flags & FL_ONGROUND) )            return PLUGIN_CONTINUE         new Float:velocity[3]        entity_get_vector(id, EV_VEC_velocity, velocity)        velocity[2] += 250.0        entity_set_vector(id, EV_VEC_velocity, velocity)         entity_set_int(id, EV_INT_gaitsequence, 6)  // Play the Jump Animation    }    return PLUGIN_CONTINUE} public client_authorized(id)    set_task(30.0, "showUsage", id) public showUsage(id) {    if ( !get_cvar_num("bh_enabled") || !get_cvar_num("bh_showusage") )        return PLUGIN_HANDLED     if ( !get_cvar_num("bh_autojump") ) {        ChatColor( id, "!g[HdC]!t BHOP!y yra įjungtas šiame serveryje, jums tereikia laikyti !gSPACE!y.")    } else {        ChatColor( id, "!g[HdC]!t BHOP!y yra įjungtas šiame serveryje, jums tereikia laikyti !gSPACE!y.")    }    return PLUGIN_HANDLED} stock ChatColor(const id, const input[], any:...) {         new count = 1, players[32]         static msg[191]         vformat(msg, 190, input, 3)              replace_all(msg, 190, "!g", "^4")         replace_all(msg, 190, "!y", "^1")         replace_all(msg, 190, "!t", "^3")              if (id) players[0] = id; else get_players(players, count, "ch")         {                 for (new i = 0; i < count; i++)                 {                         if (is_user_connected(players[i]))                         {                                 message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);                                 write_byte(players[i]);                                 write_string(msg);                                 message_end();                         }                 }         } }    

User avatar
NZT
Flooderis arba specialistas
Posts: 836
Joined: 2011 Aug 18 17:44

Re: Pagalbos Bhop pluginas

Post by NZT »

Sveikas, išbandyk šitą:

Code: Select all

#include <amxmodx> #include <engine>  #define    FL_WATERJUMP    (1<<11)    // player jumping out of water #define    FL_ONGROUND    (1<<9)    // At rest / on the ground  new bool:bhopOn[33];  public plugin_init() {     register_plugin("Super Bunny Hopper", "1.2", "Cheesy Peteza")     register_cvar("sbhopper_version", "1.2", FCVAR_SERVER)          register_clcmd( "say /on", "itsOn" );     register_clcmd( "say /off", "itsOff" ); }  public itsOn( id ) {     if( bhopOn[id] )     {         client_print( id, print_chat, "Auto bhop is already on for you!" );         return PLUGIN_HANDLED;     }          bhopOn[id] = true;          new name[32];     get_user_name( id, name, 31 );     client_print( 0, print_chat, "%s has turned on auto bunnyhop!", name );     return PLUGIN_HANDLED; }  public itsOff( id ) {     if( !bhopOn[id] )     {         client_print( id, print_chat, "Auto bhop is already off for you!" );         return PLUGIN_HANDLED;     }          bhopOn[id] = false;          client_print( id, print_chat, "You have successfully turned auto bhop off." );     return PLUGIN_HANDLED; }  public client_PreThink(id)  {          if( !bhopOn[id] )         return PLUGIN_HANDLED;          entity_set_float(id, EV_FL_fuser2, 0.0)          if (entity_get_int(id, EV_INT_button) & 2)      {         new flags = entity_get_int(id, EV_INT_flags)                  if (flags & FL_WATERJUMP)             return PLUGIN_CONTINUE         if ( entity_get_int(id, EV_INT_waterlevel) >= 2 )             return PLUGIN_CONTINUE         if ( !(flags & FL_ONGROUND) )             return PLUGIN_CONTINUE                  new Float:velocity[3]         entity_get_vector(id, EV_VEC_velocity, velocity)         velocity[2] += 250.0         entity_set_vector(id, EV_VEC_velocity, velocity)                  entity_set_int(id, EV_INT_gaitsequence, 6)     }     return PLUGIN_CONTINUE }

Shalikas
Naujokas apylinkėse
Posts: 2
Joined: 2014 Jul 17 19:27

Re: Pagalbos Bhop pluginas

Post by Shalikas »

Dėkuj už pagalbą.:)

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests