Archived copy of war3source.com, the War3Source forum (2009–2020), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2012-09-22 (original capture). Forum · All archived topics · Wiki · Bug tracker · Blog

War3:Source

War3Source Races => Races / Items - Approved => Topic started by: James on July 23, 2010, 01:30:50 AM



Title: [Approved, OP] Shopmenu Item "jump" (Long Jump) Fixed (1.1.6)
Post by: James on July 23, 2010, 01:30:50 AM
Adds LongJump item in the shopmenu

Update: fixed a few errors using the 1.1.6 interface.
War3_ValidPlayer is ValidPlayer etc

Updated Code (8/17/2010) Fixed Depreciated functions
Code:
#pragma semicolon 1

#include <sourcemod>
#include "W3SIncs/War3Source_Interface"
#include <sdktools>

#undef REQUIRE_EXTENSIONS
#include <cstrike>
#define REQUIRE_EXTENSIONS

enum{
JUMP,
}
new shopItem[MAXITEMS];//
new bool:bDidDie[65]; // did they die before spawning?
new Handle:JumpCvar;
new m_vecVelocity_0, m_vecVelocity_1, m_vecBaseVelocity;
// Offsets

public Plugin:myinfo =
{
name = "War3Source Shopitem - Long Jump",
author = "InsaNe",
description = "Adds the Long Jump item to the War3Source shopmenu",
version = "1.0.0.0",
url = "http://surflords.net/"
};

public OnPluginStart()
{
m_vecVelocity_0 = FindSendPropOffs("CBasePlayer","m_vecVelocity[0]");
m_vecVelocity_1 = FindSendPropOffs("CBasePlayer","m_vecVelocity[1]");
m_vecBaseVelocity = FindSendPropOffs("CBasePlayer","m_vecBaseVelocity");
HookEvent("player_spawn",PlayerSpawnEvent);
HookEvent("player_death",PlayerDeathEvent);
HookEvent("round_start",RoundStartEvent);
HookEvent("player_jump",PlayerJumpEvent);
JumpCvar=CreateConVar("war3_shop_jump_level","4.0","How far will you jump. The higher the number the further the player jumps.");
}

public OnWar3LoadRaceOrItemOrdered2(num)
{
if(num==10){
for(new x=0;x<MAXITEMS;x++)
shopItem[x]=0;
shopItem[JUMP]=War3_CreateShopItem("Long Jump","jump","Allows you to jump longer/further.",10,2500);
}
}
public OnItemPurchase(client,item)
{
if(item==shopItem[JUMP])
{
if(IsPlayerAlive(client))
War3_SetOwnsItem(client,item,true);
//if(IsPlayerAlive(client))
//War3_ChatMessage(client,"You have successfully purchased Long Jump.");
}
}
public RoundStartEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
new userid=GetEventInt(event,"userid");
new client=GetClientOfUserId(userid);
for(new x=1;x<=MaxClients;x++)
{
bDidDie[client]=false;
if(ValidPlayer(x,true)&&War3_GetOwnsItem(x,shopItem[JUMP]))
{
War3_SetOwnsItem(client,shopItem[JUMP],true);
}
}
}
public PlayerJumpEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
for(new x=1;x<=MaxClients;x++)
{
if(ValidPlayer(x,true)&&War3_GetOwnsItem(x,shopItem[JUMP]))
{
            new Float:velocity[3]={0.0,0.0,0.0};
            velocity[0]= GetEntDataFloat(x,m_vecVelocity_0);
            velocity[1]= GetEntDataFloat(x,m_vecVelocity_1);
            velocity[0]*=GetConVarFloat(JumpCvar)*0.25;
            velocity[1]*=GetConVarFloat(JumpCvar)*0.25;
            SetEntDataVector(x,m_vecBaseVelocity,velocity,true);
        }
    }
}
public PlayerSpawnEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
new userid=GetEventInt(event,"userid");
new client=GetClientOfUserId(userid);
if(client>0)
{
bDidDie[client]=false;
if(War3_GetOwnsItem(client,shopItem[JUMP]))
        {
War3_SetOwnsItem(client,shopItem[JUMP],true);
        }
}
}
public PlayerDeathEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
new userid=GetEventInt(event,"userid");
new client=GetClientOfUserId(userid);

if(client>0)
{
new deathFlags = GetEventInt(event, "death_flags");
if (War3_GetGame()==Game_TF&&deathFlags & 32)
{
  //PrintToChat(client,"war3 debug: dead ringer kill");
}


else{
bDidDie[client]=true;
if(War3_GetOwnsItem(client,shopItem[JUMP])) // long jump
{
War3_SetOwnsItem(client,shopItem[JUMP],false);
}
}
}
}


Title: Re: Shopmenu Items (LongJump)
Post by: Ownz on July 23, 2010, 08:18:15 AM
wut does the cvar do?


Title: Re: Shopmenu Items (LongJump)
Post by: Ownz on July 23, 2010, 08:19:40 AM
and u were suppose to add long jump by itself in its own plugin, not including those default items


Title: Re: Shopmenu item (LongJump) addon
Post by: Ownz on July 24, 2010, 07:14:25 AM

public OnWar3LoadRaceOrItemOrdered2(num)


Title: Re: Shopmenu item (LongJump) addon
Post by: Scyther on July 28, 2010, 01:22:46 AM
Just wondering if its possible to make this last untill you die, not only 1 round? :)
Thanks =]


Title: Re: Shopmenu item (LongJump) addon
Post by: Ownz on July 28, 2010, 08:37:00 AM
thats a bug then


Title: Re: Shopmenu item (LongJump) addon
Post by: James on July 28, 2010, 11:44:09 AM
Bug? Where?

Yeah it is possible to make it so the long jump last until you change levels it's just a simple edit in the .sp file and a recompile.

This version should last the whole map until you change levels

Code:
#pragma semicolon 1

#include <sourcemod>
#include "W3SIncs/War3Source_Interface"
#include <sdktools>

#undef REQUIRE_EXTENSIONS
#include <cstrike>
#define REQUIRE_EXTENSIONS

enum{
JUMP,
}
new shopItem[MAXITEMS];//
new bool:bDidDie[65]; // did they die before spawning?
new Handle:JumpCvar;
new m_vecVelocity_0, m_vecVelocity_1, m_vecBaseVelocity;
// Offsets

public Plugin:myinfo =
{
name = "War3Source Shopitem - Long Jump",
author = "InsaNe",
description = "Adds the Long Jump item to the War3Source shopmenu",
version = "1.0.0.0",
url = "http://surflords.net/"
};

public OnPluginStart()
{
m_vecVelocity_0 = FindSendPropOffs("CBasePlayer","m_vecVelocity[0]");
m_vecVelocity_1 = FindSendPropOffs("CBasePlayer","m_vecVelocity[1]");
m_vecBaseVelocity = FindSendPropOffs("CBasePlayer","m_vecBaseVelocity");
HookEvent("player_jump",PlayerJumpEvent);
HookEvent("player_spawn",PlayerSpawnEvent);
JumpCvar=CreateConVar("war3_shop_jump_level","4.0","How far will you jump. The higher the number the further the player jumps.");
}

public OnWar3LoadRaceOrItemOrdered2(num)
{
if(num==10){
for(new x=0;x<MAXITEMS;x++)
shopItem[x]=0;
shopItem[JUMP]=War3_CreateShopItem("Long Jump","jump","Allows you to jump longer/further.",20);
}
}
public OnItemPurchase(client,item)
{
if(item==shopItem[JUMP])
{
if(IsPlayerAlive(client))
War3_SetOwnsItem(client,item,true);
}
}
public PlayerJumpEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
for(new x=1;x<=MaxClients;x++)
{
if(War3_ValidPlayer(x,true)&&War3_GetOwnsItem(x,shopItem[JUMP]))
{
            new Float:velocity[3]={0.0,0.0,0.0};
            velocity[0]= GetEntDataFloat(x,m_vecVelocity_0);
            velocity[1]= GetEntDataFloat(x,m_vecVelocity_1);
            velocity[0]*=GetConVarFloat(JumpCvar)*0.25;
            velocity[1]*=GetConVarFloat(JumpCvar)*0.25;
            SetEntDataVector(x,m_vecBaseVelocity,velocity,true);
        }
    }
}
public PlayerSpawnEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
new userid=GetEventInt(event,"userid");
new client=GetClientOfUserId(userid);
if(client>0)
{
if(War3_GetOwnsItem(client,shopItem[JUMP]))
        {
War3_SetOwnsItem(client,shopItem[JUMP],true);
        }
}
}
public PlayerDeathEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
new userid=GetEventInt(event,"userid");
new client=GetClientOfUserId(userid);

if(client>0)
{
new deathFlags = GetEventInt(event, "death_flags");
if (War3_GetGame()==Game_TF&&deathFlags & 32)
{
  //PrintToChat(client,"war3 debug: dead ringer kill");
}


else{
bDidDie[client]=true;
if(War3_GetOwnsItem(client,shopItem[JUMP])) // orb of frost
{
War3_SetOwnsItem(client,shopItem[JUMP],false);
}
}
}
}


I also increased the amount of credits it costs to 20 and made it so it lasts the whole level for ya Scythe

Two simple edits...

Code:
public PlayerSpawnEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
new userid=GetEventInt(event,"userid");
new client=GetClientOfUserId(userid);
if(client>0)
{
if(War3_GetOwnsItem(client,shopItem[JUMP]))
        {
War3_SetOwnsItem(client,shopItem[JUMP],true);
        }
}
}

Code:
public OnWar3LoadRaceOrItemOrdered2(num)
{
if(num==10){
for(new x=0;x<MAXITEMS;x++)
shopItem[x]=0;
shopItem[JUMP]=War3_CreateShopItem("Long Jump","jump","Allows you to jump longer/further.",20);
}
}


Title: Re: Shopmenu item (LongJump) addon
Post by: James on July 28, 2010, 12:11:05 PM
It has been brought to my attention though.. If you made it every map change and say someone didn't want long jump anymore or wanted to replace it with another shop item they would have to reconnect wouldn't they?


Title: Re: Shopmenu item (LongJump) addon
Post by: Kami on July 28, 2010, 12:23:52 PM
Bug? Where?

Yeah it is possible to make it so the long jump last until you change levels it's just a simple edit in the .sp file and a recompile.

This version should last the whole map until you change levels

Code:
#pragma semicolon 1

#include <sourcemod>
#include "W3SIncs/War3Source_Interface"
#include <sdktools>

#undef REQUIRE_EXTENSIONS
#include <cstrike>
#define REQUIRE_EXTENSIONS

enum{
JUMP,
}
new shopItem[MAXITEMS];//
new bool:bDidDie[65]; // did they die before spawning?
new Handle:JumpCvar;
new m_vecVelocity_0, m_vecVelocity_1, m_vecBaseVelocity;
// Offsets

public Plugin:myinfo =
{
name = "War3Source Shopitem - Long Jump",
author = "InsaNe",
description = "Adds the Long Jump item to the War3Source shopmenu",
version = "1.0.0.0",
url = "http://surflords.net/"
};

public OnPluginStart()
{
m_vecVelocity_0 = FindSendPropOffs("CBasePlayer","m_vecVelocity[0]");
m_vecVelocity_1 = FindSendPropOffs("CBasePlayer","m_vecVelocity[1]");
m_vecBaseVelocity = FindSendPropOffs("CBasePlayer","m_vecBaseVelocity");
HookEvent("player_jump",PlayerJumpEvent);
HookEvent("player_spawn",PlayerSpawnEvent);
JumpCvar=CreateConVar("war3_shop_jump_level","4.0","How far will you jump. The higher the number the further the player jumps.");
}

public OnWar3LoadRaceOrItemOrdered2(num)
{
if(num==10){
for(new x=0;x<MAXITEMS;x++)
shopItem[x]=0;
shopItem[JUMP]=War3_CreateShopItem("Long Jump","jump","Allows you to jump longer/further.",20);
}
}
public OnItemPurchase(client,item)
{
if(item==shopItem[JUMP])
{
if(IsPlayerAlive(client))
War3_SetOwnsItem(client,item,true);
}
}
public PlayerJumpEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
for(new x=1;x<=MaxClients;x++)
{
if(War3_ValidPlayer(x,true)&&War3_GetOwnsItem(x,shopItem[JUMP]))
{
            new Float:velocity[3]={0.0,0.0,0.0};
            velocity[0]= GetEntDataFloat(x,m_vecVelocity_0);
            velocity[1]= GetEntDataFloat(x,m_vecVelocity_1);
            velocity[0]*=GetConVarFloat(JumpCvar)*0.25;
            velocity[1]*=GetConVarFloat(JumpCvar)*0.25;
            SetEntDataVector(x,m_vecBaseVelocity,velocity,true);
        }
    }
}
public PlayerSpawnEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
new userid=GetEventInt(event,"userid");
new client=GetClientOfUserId(userid);
if(client>0)
{
if(War3_GetOwnsItem(client,shopItem[JUMP]))
        {
War3_SetOwnsItem(client,shopItem[JUMP],true);
        }
}
}
public PlayerDeathEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
new userid=GetEventInt(event,"userid");
new client=GetClientOfUserId(userid);

if(client>0)
{
new deathFlags = GetEventInt(event, "death_flags");
if (War3_GetGame()==Game_TF&&deathFlags & 32)
{
  //PrintToChat(client,"war3 debug: dead ringer kill");
}


else{
bDidDie[client]=true;
if(War3_GetOwnsItem(client,shopItem[JUMP])) // orb of frost
{
War3_SetOwnsItem(client,shopItem[JUMP],false);
}
}
}
}


I also increased the amount of credits it costs to 20 and made it so it lasts the whole level for ya Scythe

Two simple edits...

Code:
public PlayerSpawnEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
new userid=GetEventInt(event,"userid");
new client=GetClientOfUserId(userid);
if(client>0)
{
if(War3_GetOwnsItem(client,shopItem[JUMP]))
        {
War3_SetOwnsItem(client,shopItem[JUMP],true);
        }
}
}

Code:
public OnWar3LoadRaceOrItemOrdered2(num)
{
if(num==10){
for(new x=0;x<MAXITEMS;x++)
shopItem[x]=0;
shopItem[JUMP]=War3_CreateShopItem("Long Jump","jump","Allows you to jump longer/further.",20);
}
}


Scyther doesnt want longjump to last the whole map, but until the player dies. Right now, whenever round ends, your Longjump is gone.


Title: Re: Shopmenu Item "jump" (Long Jump) (fixed)
Post by: Kami on July 28, 2010, 01:20:39 PM
I'm very sorry, but still you dont loose it on death.
Again its until mapchange I think.


Title: Re: Shopmenu Item "jump" (Long Jump) (fixed)
Post by: Ownz on July 28, 2010, 01:56:47 PM
what the hell are u doing? items are automatically removed on death


Title: Re: Shopmenu Item "jump" (Long Jump) (fixed)
Post by: Kami on July 28, 2010, 02:27:41 PM
Longjump does not for me and for scyther neither.

Having longjump the whole map works (and you can die without loosing it)

But still it does not last until death and fades after death.


Title: Re: Shopmenu Item "jump" (Long Jump) (fixed)
Post by: James on July 28, 2010, 05:44:42 PM
Try it now guys sorry  :-[


Title: Re: [needs feedback] Shopmenu Item "jump" (Long Jump) Fixed
Post by: James on August 01, 2010, 08:15:38 PM
Feedback guys?  :)


Title: Re: [needs feedback] Shopmenu Item "jump" (Long Jump) Fixed
Post by: Scyther on August 02, 2010, 12:48:21 AM
It now works great, only thing is compared to the skill sometimes you jump and then it pushes you forward really fast which is still a long jump but its much more extreme, but yeah it works fine and lasts till death


Title: Re: [needs feedback] Shopmenu Item "jump" (Long Jump) Fixed
Post by: Ownz on August 02, 2010, 07:50:16 AM
will i be able to bunny hop and gain infinite speed?


Title: Re: [needs feedback] Shopmenu Item "jump" (Long Jump) Fixed
Post by: Necavi on August 02, 2010, 04:30:54 PM
That's the whole point of longjumping :D


Title: Re: [Approved, OP] Shopmenu Item "jump" (Long Jump) Fixed (1.1.6)
Post by: Frenzzy on November 13, 2010, 11:51:03 PM
Hello!

I tested this item. In my opinion it is cheating item :)
With this item players able to bunny hopping have the big advantage before other players, especially that this item always gives additional acceleration for everyone following bunny hop jumps.
Players that know how bunny hopping often abuse it.

Therefore, I have divided this item into two: LongJump and BunnyHop. Here are the main differences with my version:

LongJump Item:
- New Price: 7 gold or $2500.
- Added dependency on sv_enablebunnyhopping, thus the player will not receive any additional acceleration with each new jump in sv_enablebunnyhopping 0.
- Added translations support.
- Added Russian translation.
- Contains less code than old version.
// Variable regulating the longer/further jump comes from the old version.

BunnyHop Item:
- Price: 2 gold or $500.
- Helps the bunny hopping player, automatically jumping while holding the space button.
// This is a very useful item for players who can not bunny hopping.

As a result, we get:
LongJump Item = Only Long Jump
BunnyHop Item = Only Bunny Hopping
BunnyHop Item LongJump Item = Easy BunnyHop
BunnyHop Item LongJump Item sv_enablebunnyhopping 1 = Turbo BunnyHop

Tested! Everything works fine! ;)
P.S.: Interestingly, there is a chance what these items appear in the official relese? :)

In any case, for reference:
What is LongJump? http://en.wikipedia.org/wiki/Long_Jump
What is BunnyHop? http://en.wikipedia.org/wiki/Bunny_hopping

..for Russian:
Приветствую!

Попробовал я поиграть с этим предметом, и на мой взгляд это слишком читерский предмет.
С этим предметом игроки умеющие распрыгиваться имеют большое преимущество перед остальными игроками, особенно из-за того, что этот предмет всегда дает дополнительное ускорение для каждого следующего прыжка.
Игроки которые умеют распрыгиваться часто злоупотребляют этим.

Поэтому я разделил этот предмет на два: «Прыжок в длину» и «Распрыжка». Вот основные различия с моей версией:

Предмет «Прыжок в длину»:
- Цена предмета: 7 золота или $2500.
- Добавлена зависимость от sv_enablebunnyhopping, тем самым игрок не будет получать дополнительное ускорение с каждым новым прыжком при sv_enablebunnyhopping 0.
- Добавлена поддержка переводов.
- Добавлен перевод на русский язык.
- Содержит меньше кода чем версия из первого сообщения.
// Переменная регулирующая длину/ускорение прыжка взята из старой версии.

Предмет «Распрыжка»:
- Цена предмета: 2 золота или $500.
- Помогает игроку в распрыжке, автоматически прыгая при удерживании клавиши пробела.

В итоге мы получаем:
Предмет «Прыжок в длину» = Только прыжок в длину
Предмет «Распрыжка» = Только распрыжка
Предмет «Распрыжка» + Предмет «Прыжок в длину» = Очень простая распражка
Предмет «Распрыжка» + Предмет «Прыжок в длину» + sv_enablebunnyhopping 1 = Распрыжка с постоянным ускорением

Протестировано, все работает!
P.S.: Интересно, есть ли шанс этим предметам оказаться в официальном дистрибутиве?

На всякий случай, для справки:
Что такое «Прыжок в длину»? http://ru.wikipedia.org/wiki/Прыжок_в_длину (http://ru.wikipedia.org/wiki/%D0%9F%D1%80%D1%8B%D0%B6%D0%BE%D0%BA_%D0%B2_%D0%B4%D0%BB%D0%B8%D0%BD%D1%83)
Что такое «Распрыжка»? http://ru.wikipedia.org/wiki/Распрыжка (http://ru.wikipedia.org/wiki/%D0%A0%D0%B0%D1%81%D0%BF%D1%80%D1%8B%D0%B6%D0%BA%D0%B0)


Title: Re: [Approved, OP] Shopmenu Item "jump" (Long Jump) Fixed (1.1.6)
Post by: Crazy-acm on November 14, 2010, 03:02:49 AM
прыжок в длинну стал таким же как для Суккуба? Я не ставил у себя на сервере именно по этой же причине, что ты описал


Title: Re: [Approved, OP] Shopmenu Item "jump" (Long Jump) Fixed (1.1.6)
Post by: Frenzzy on November 14, 2010, 11:45:36 AM
прыжок в длинну стал таким же как для Суккуба? Я не ставил у себя на сервере именно по этой же причине, что ты описал
Не совсем. Здесь при sv_enablebunnyhopping 0, после каждого прыжка скорость перемещения игрока не увеличивается. А у Суккуб-Охотника как я понял с каждым прыжком (если распрыгиваться) будет скорость выше и выше не зависимо от sv_enablebunnyhopping. А в остальном да, вроде такой же, war3_shop_jump_level 4 такой же прыжок как и у Суккуб-Охотника с 4-ым уровнем навыка.


Title: Re: [Approved, OP] Shopmenu Item "jump" (Long Jump) Fixed (1.1.6)
Post by: Schmarotzer on November 14, 2010, 11:59:29 AM
Надо тестануть )


Title: Re: [Approved, OP] Shopmenu Item "jump" (Long Jump) Fixed (1.1.6)
Post by: James on November 14, 2010, 03:42:20 PM
interesting lol...

I would have just kept it as one item.

Long Jump is from RPG .


Title: Re: [Approved, OP] Shopmenu Item "jump" (Long Jump) Fixed (1.1.6)
Post by: Ownz on March 23, 2012, 02:39:43 PM
is sv_enablebunnyhopping default 0?
 
is bunnyhop item automatically disabled when sv_enablebunnyhopping is 0 without map change? if not please add this as a feature

can someone else verify the items work as intended?


Title: Re: [Approved, OP] Shopmenu Item "jump" (Long Jump) Fixed (1.1.6)
Post by: Chuck on March 23, 2012, 07:37:03 PM
Frenzzy both bunnyhop and long jump works perfect! Bunnyhop doesn't work well  if it not set as sv_allowbunnyhop! I use those in my servers