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
Chat

War3:Source
September 21, 2012, 09:20:48 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Download: http://war3source.com/index.php?board=9.0
What is War3Source?: http://war3source.com/index.php?topic=200.0
Sample Stats: http://war3source.com/war3stats
Steam Community Group: http://steamcommunity.com/groups/war3source
War3Source SVN Checkout: http://ownageclan.com/svn/war3source/
War3Source servers: http://www.game-monitor.com/search.php?vars=war3_version=
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [Approved, OP] Shopmenu Item "jump" (Long Jump) Fixed (1.1.6)  (Read 4272 times)
James
Newbie
*
Posts: 18



View Profile WWW Email
« 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);
}
}
}
}
« Last Edit: August 17, 2010, 12:42:17 PM by James » Logged

Ownz
Developer
Administrator
Hero Member
*****
Posts: 2032



View Profile WWW Email
« Reply #1 on: July 23, 2010, 08:18:15 AM »

wut does the cvar do?
Logged

DarkEnergy
Ownz
Developer
Administrator
Hero Member
*****
Posts: 2032



View Profile WWW Email
« Reply #2 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
Logged

DarkEnergy
Ownz
Developer
Administrator
Hero Member
*****
Posts: 2032



View Profile WWW Email
« Reply #3 on: July 24, 2010, 07:14:25 AM »


public OnWar3LoadRaceOrItemOrdered2(num)
Logged

DarkEnergy
Scyther
Full Member
***
Posts: 120


View Profile Email
« Reply #4 on: July 28, 2010, 01:22:46 AM »

Just wondering if its possible to make this last untill you die, not only 1 round? Smiley
Thanks =]
Logged
Ownz
Developer
Administrator
Hero Member
*****
Posts: 2032



View Profile WWW Email
« Reply #5 on: July 28, 2010, 08:37:00 AM »

thats a bug then
Logged

DarkEnergy
James
Newbie
*
Posts: 18



View Profile WWW Email
« Reply #6 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);
}
}
« Last Edit: July 28, 2010, 04:42:57 PM by James » Logged

James
Newbie
*
Posts: 18



View Profile WWW Email
« Reply #7 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?
Logged

Kami
Newbie
*
Posts: 19


View Profile Email
« Reply #8 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.
Logged
Kami
Newbie
*
Posts: 19


View Profile Email
« Reply #9 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.
Logged
Ownz
Developer
Administrator
Hero Member
*****
Posts: 2032



View Profile WWW Email
« Reply #10 on: July 28, 2010, 01:56:47 PM »

what the hell are u doing? items are automatically removed on death
Logged

DarkEnergy
Kami
Newbie
*
Posts: 19


View Profile Email
« Reply #11 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.
Logged
James
Newbie
*
Posts: 18



View Profile WWW Email
« Reply #12 on: July 28, 2010, 05:44:42 PM »

Try it now guys sorry  Embarrassed
« Last Edit: July 28, 2010, 05:46:49 PM by James » Logged

James
Newbie
*
Posts: 18



View Profile WWW Email
« Reply #13 on: August 01, 2010, 08:15:38 PM »

Feedback guys?  Smiley
Logged

Scyther
Full Member
***
Posts: 120


View Profile Email
« Reply #14 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
Logged
Ownz
Developer
Administrator
Hero Member
*****
Posts: 2032



View Profile WWW Email
« Reply #15 on: August 02, 2010, 07:50:16 AM »

will i be able to bunny hop and gain infinite speed?
Logged

DarkEnergy
Necavi
Full Member
***
Posts: 217


View Profile
« Reply #16 on: August 02, 2010, 04:30:54 PM »

That's the whole point of longjumping Cheesy
Logged

Frenzzy
Full Member
***
Posts: 217


337905984 frenzzy@live.ru
View Profile WWW
« Reply #17 on: November 13, 2010, 11:51:03 PM »

Hello!

I tested this item. In my opinion it is cheating item Smiley
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! Wink
P.S.: Interestingly, there is a chance what these items appear in the official relese? Smiley

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/Распрыжка
« Last Edit: November 14, 2010, 11:23:25 AM by Frenzzy » Logged

O_o
Crazy-acm
Newbie
*
Posts: 39

STEAMWorld admin


View Profile WWW
« Reply #18 on: November 14, 2010, 03:02:49 AM »

прыжок в длинну стал таким же как для Суккуба? Я не ставил у себя на сервере именно по этой же причине, что ты описал
Logged
Frenzzy
Full Member
***
Posts: 217


337905984 frenzzy@live.ru
View Profile WWW
« Reply #19 on: November 14, 2010, 11:45:36 AM »

прыжок в длинну стал таким же как для Суккуба? Я не ставил у себя на сервере именно по этой же причине, что ты описал
Не совсем. Здесь при sv_enablebunnyhopping 0, после каждого прыжка скорость перемещения игрока не увеличивается. А у Суккуб-Охотника как я понял с каждым прыжком (если распрыгиваться) будет скорость выше и выше не зависимо от sv_enablebunnyhopping. А в остальном да, вроде такой же, war3_shop_jump_level 4 такой же прыжок как и у Суккуб-Охотника с 4-ым уровнем навыка.
Logged

O_o
Schmarotzer
Full Member
***
Posts: 189


Ich schmarotze dich!

258631507
View Profile WWW
« Reply #20 on: November 14, 2010, 11:59:29 AM »

Надо тестануть )
Logged

Welcome to my server
James
Newbie
*
Posts: 18



View Profile WWW Email
« Reply #21 on: November 14, 2010, 03:42:20 PM »

interesting lol...

I would have just kept it as one item.

Long Jump is from RPG .
Logged

Ownz
Developer
Administrator
Hero Member
*****
Posts: 2032



View Profile WWW Email
« Reply #22 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?
Logged

DarkEnergy
Chuck
Jr. Member
**
Posts: 98


View Profile Email
« Reply #23 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
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!