Admin bhop

Konstantin Shavrin

Участник
Сообщения
18
Реакции
1
Добрый вечер! Помогите пожалуйста прикрутить проверку на флаг "z" , то есть прыжки only admin. Не пойму никак каким действием это можно сделать!
#include <sourcemod>
#include <sdktools>

#pragma semicolon 1

// Declare offsets

new VelocityOffset_0;
new VelocityOffset_1;
new BaseVelocityOffset;

// Declare convar handles

new Handle:hPush;
new Handle:hHeight;

public Plugin:myinfo =
{
name = "BunnyHop",
author = "Soccerdude",
description = "Gives players the ability to jump higher",
version = "1.0.1",
url = "http://sourcemod.net/"
};

public OnPluginStart()
{
PrintToServer("----------------| BunnyHop Loading |---------------");
// Hook Events
HookEvent("player_jump",PlayerJumpEvent);
// Find offsets
VelocityOffset_0=FindSendPropOffs("CBasePlayer","m_vecVelocity[0]");
if(VelocityOffset_0==-1)
SetFailState("[BunnyHop] Error: Failed to find Velocity[0] offset, aborting");
VelocityOffset_1=FindSendPropOffs("CBasePlayer","m_vecVelocity[1]");
if(VelocityOffset_1==-1)
SetFailState("[BunnyHop] Error: Failed to find Velocity[1] offset, aborting");
BaseVelocityOffset=FindSendPropOffs("CBasePlayer","m_vecBaseVelocity");
if(BaseVelocityOffset==-1)
SetFailState("[BunnyHop] Error: Failed to find the BaseVelocity offset, aborting");
// Create cvars
hPush=CreateConVar("bunnyhop_push","1.0","The forward push when you jump");
hHeight=CreateConVar("bunnyhop_height","1.0","The upward push when you jump");
// Create config
AutoExecConfig();
// Public cvar
CreateConVar("bunnyhop_version","1.0.1","[BunnyHop] Current version of this plugin",FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);
PrintToServer("----------------| BunnyHop Loaded |---------------");
}

public PlayerJumpEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
new index=GetClientOfUserId(GetEventInt(event,"userid"));
new Float:finalvec[3];
finalvec[0]=GetEntDataFloat(index,VelocityOffset_0)*GetConVarFloat(hPush)/2.0;
finalvec[1]=GetEntDataFloat(index,VelocityOffset_1)*GetConVarFloat(hPush)/2.0;
finalvec[2]=GetConVarFloat(hHeight)*50.0;
SetEntDataVector(index,BaseVelocityOffset,finalvec,true);
}

Поправил.
 
Последнее редактирование:

kv.acid

Участник
Сообщения
2,025
Реакции
755
Konstantin Shavrin, Оффтоп
 
Сообщения
1
Реакции
0
Доброе время суток, присоединяюсь к вашему вопросу и тоже хочу узнать, можно ли сделать банни хоп только для админа, и если можно привязать к стим айди...
Заранее спасибо!
 

aktel

Участник
Сообщения
118
Реакции
13
Вот что на лепил
PHP:
#include <sourcemod>
#include <sdktools>

#pragma semicolon 1

// Declare offsets

new VelocityOffset_0;
new VelocityOffset_1;
new BaseVelocityOffset, bool:acces[MAXPLAYERS+1];

// Declare convar handles

new Handle:hPush;
new Handle:hHeight;

public Plugin:myinfo =
{
    name = "BunnyHop",
    author = "Soccerdude",
    description = "Gives players the ability to jump higher",
    version = "1.0.1",
    url = "http://sourcemod.net/"
};

public OnPluginStart()
{
    PrintToServer("----------------| BunnyHop Loading |---------------");
    // Hook Events
    HookEvent("player_jump",PlayerJumpEvent);
    // Find offsets
    VelocityOffset_0=FindSendPropOffs("CBasePlayer","m _vecVelocity[0]");
    if(VelocityOffset_0==-1)
    SetFailState("[BunnyHop] Error: Failed to find Velocity[0] offset, aborting");
    VelocityOffset_1=FindSendPropOffs("CBasePlayer","m _vecVelocity[1]");
    if(VelocityOffset_1==-1)
    SetFailState("[BunnyHop] Error: Failed to find Velocity[1] offset, aborting");
    BaseVelocityOffset=FindSendPropOffs("CBasePlayer", "m_vecBaseVelocity");
    if(BaseVelocityOffset==-1)
    SetFailState("[BunnyHop] Error: Failed to find the BaseVelocity offset, aborting");
    // Create cvars
    hPush=CreateConVar("bunnyhop_push","1.0","The forward push when you jump");
    hHeight=CreateConVar("bunnyhop_height","1.0","The upward push when you jump");
    // Create config
    AutoExecConfig();
    // Public cvar
    CreateConVar("bunnyhop_version","1.0.1","[BunnyHop] Current version of this plugin",FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|F CVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);
    PrintToServer("----------------| BunnyHop Loaded |---------------");
}

public OnClientPostAdminFilter(client)
{
    new AdminId:aid = GetUserAdmin(client);
    if (aid != INVALID_ADMIN_ID)
    {
        if (GetAdminFlag(aid, Admin_Root, Access_Effective))
            acces[client] = true;
    }
}

public OnClientDisconnect_Post(client) acces[client] = false;

public PlayerJumpEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
    new index=GetClientOfUserId(GetEventInt(event,"userid" ));
    if (acces[index])
    {
        new Float:finalvec[3];
        finalvec[0]=GetEntDataFloat(index,VelocityOffset_0)*GetConVar Float(hPush)/2.0;
        finalvec[1]=GetEntDataFloat(index,VelocityOffset_1)*GetConVar Float(hPush)/2.0;
        finalvec[2]=GetConVarFloat(hHeight)*50.0;
        SetEntDataVector(index,BaseVelocityOffset,finalvec ,true);
    }
}
Но он не компилируется, так как и его собрат в первом посте.
Загулил оригинал он с компилировался. Автор как то криво скопировал код суда, хм как такое возможно вобще :lol:.

Вот переделка оригинала
PHP:
/* BunnyHop
* Author: Soccerdude
* Description: Gives players the ability to jump higher
*/
#include <sourcemod>
#include <sdktools>

#pragma semicolon 1

// Declare offsets

new VelocityOffset_0;
new VelocityOffset_1;
new BaseVelocityOffset, bool:acces[MAXPLAYERS+1];

// Declare convar handles

new Handle:hPush;
new Handle:hHeight;

public Plugin:myinfo = 
{
  name = "BunnyHop",
  author = "Soccerdude",
  description = "Gives players the ability to jump higher",
  version = "1.0.1",
  url = "http://sourcemod.net/"
};

public OnPluginStart()
{
  PrintToServer("----------------|         BunnyHop Loading        |---------------");
  // Hook Events
  HookEvent("player_jump",PlayerJumpEvent);
  // Find offsets
  VelocityOffset_0=FindSendPropOffs("CBasePlayer","m_vecVelocity[0]");
  if(VelocityOffset_0==-1)
    SetFailState("[BunnyHop] Error: Failed to find Velocity[0] offset, aborting");
  VelocityOffset_1=FindSendPropOffs("CBasePlayer","m_vecVelocity[1]");
  if(VelocityOffset_1==-1)
    SetFailState("[BunnyHop] Error: Failed to find Velocity[1] offset, aborting");
  BaseVelocityOffset=FindSendPropOffs("CBasePlayer","m_vecBaseVelocity");
  if(BaseVelocityOffset==-1)
    SetFailState("[BunnyHop] Error: Failed to find the BaseVelocity offset, aborting");
  // Create cvars
  hPush=CreateConVar("bunnyhop_push","1.0","The forward push when you jump");
  hHeight=CreateConVar("bunnyhop_height","1.0","The upward push when you jump");
  // Create config
  AutoExecConfig();
  // Public cvar
  CreateConVar("bunnyhop_version","1.0.1","[BunnyHop] Current version of this plugin",FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);
  PrintToServer("----------------|         BunnyHop Loaded         |---------------");
}

public OnClientPostAdminFilter(client)
{
    new AdminId:aid = GetUserAdmin(client);
    if (aid != INVALID_ADMIN_ID)
    {
        if (GetAdminFlag(aid, Admin_Root, Access_Effective))
            acces[client] = true;
    }
}

public OnClientDisconnect_Post(client) acces[client] = false;

public PlayerJumpEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
  new index=GetClientOfUserId(GetEventInt(event,"userid"));
  if (acces[index])
  {
      new Float:finalvec[3];
      finalvec[0]=GetEntDataFloat(index,VelocityOffset_0)*GetConVarFloat(hPush)/2.0;
      finalvec[1]=GetEntDataFloat(index,VelocityOffset_1)*GetConVarFloat(hPush)/2.0;
      finalvec[2]=GetConVarFloat(hHeight)*50.0;
      SetEntDataVector(index,BaseVelocityOffset,finalvec,true);
  }
}
 
Последнее редактирование:

Туник

Участник
Сообщения
1,281
Реакции
263
Есть у кого нормальный бхоп для админов, по примеру как вип модуль чтобы скорость не была такой жесткой, в п.у арены не подходит слишком быстрый.
 

SIRIUS

♿___DejaVu
Сообщения
509
Реакции
253
Сверху Снизу