Forums

Pages: [1]
Author Topic: JumpBig - Jump Plugin  (Read 192 times)
Offline  Thomas
Maggot
*

Posts: 10
Dreams are
JumpBig

What is it?

JumpBig is an open source Jump plugin aimed at replacing JumpMode. While updating Jump plugins with new features.
This plugin is based mostly around CP's so mapmakers wanting to support this, make sure you include them!
SQL is currently not supported, but will be soon. I plan on having SQL and non-SQL versions to allow anyone to run the plugin.


Features:

  • CP counters per class (Number of points touched as demo, as soldier, etc)
  • Save / Teleport (Not class based or saved to a database. But requires touching the ground and not crouching)
  • Timer (this works off spawnpoints and CPs making it work perfectly on most maps, however there are some issues; See below)
  • Races! (Wooo hopefully not broken anymore!)
  • Disabling capture of CPs
  • Canceling waiting for players
  • Class and map specific regen (ex: Only enabling regen for Soldiers on Demo maps that are impossible without it)

Installation:
This part is only a little complicated as there a really two ways to go about using JB's regen.

Always enabled regen:
  • Download JumpBig.smx
  • Add JumpBig to your tf\addons\sourcemod\plugins folder
  • Add the following code to server.cfg
Code: [Select]
jb_demo_regen 1
jb_solly_regen 1
Doing this means demo or soldier can turn on their regen at any time

Map and class specific regen:
  • Download JumpBig.smx
  • Add JumpBig to your tf\addons\sourcemod\plugins folder
  • Add the following code to server.cfg
Code: [Select]
jb_demo_regen 0
jb_solly_regen 0
This means regen is disabled by default and any map you want to have regen, change the cvars in Mapname.cfg to 1
  • Download the 7zip file below for a bunch of pre made map cfgs
  • Unpack in tf\cfg

Player commands:

  • /s - Saves current location
  • /t  - Teleports back to saved location
  • /time /timer - Starts a timer and moves you back to a spawn point
  • /stoptime /stoptimer - Stops your timer
  • /stats - Shows which CPs you've reached as each class, useful for maps with lots of CPs like 4starters
  • /race - This command both asks a person to a race and accepts the race
  • /quit /forfeit - Leaves the current race, calling you a loser
  • /regen - Toggles your regen if it's enabled on the map
  • /jb_help - Prints info into the console

ToDo list:

This was made for a specific server, so there was no need for svars. There are no server cvars for enabling some features like; class specific saves, full plugin disabling, etc
SQL support, for saves and time tracking and leaderboards.
SQL feature: "Jump points" rather than track skill based on speedruns of maps it will give players points based of the difficulty of a CP. ex: CP 1 of 4 starters might give 1 point while 4 or 6 might give 10. This could also be connected and allow high-point jumpers some extra privileges such as; colored text, tags, etc when they reach some threshold
SQL feature: Race tracking / ELO / MMR system and race leaderboards
TAS tools for jumping; bounce calculating, line traces of player motion (So you can know where you are going to land; say, on a wall so triple or quint wallcatches will be easy)
Specing a player in a race will show their timer (I need help with this one!)
A huge list / compilation of all the maps and their regen needs

Known issues:

Some messages might display wrongly (highlighted CP instead of CP+# etc)
Sourcemod's tracking of leaving players is sometimes weird, so when players leave a race from a ragequit. It might not register.
With non-class-specific saves you can get to a CP, save, change class, and TP back. Meaning you can get messages saying someone beat littleman with heavy, and whatnot.
A few more I am likely forgetting

Notes and open source

This plugin needs More colors to be complied (http://forums.alliedmods.net/showthread.php?t=185016).
This was my first time working on such a big thing in sourcemod so I am sure there will be some things in the code that aren't perfect.
Since this project is open source I would love to get some input on making this thing better as well as other plugins better. If you would like to help me with this, add me on steam or send me a message on this forum.
Of course if you have your own plugin (Like JA and you want to steal races) you can chop up all of JB to make your plugin better!
I haven't been able to note which soldier maps need regen for demos because I don't know any super-ultra-pro demos. If anyone would be able to help me here that would be awesome
The map cfgs have code in there for a plugin that forces team spawning, if you don't have that plugin you can remove it or keep it in, it won't mess anything up.

Thanks to:
Nican, for being my goto guy when I couldn't figure something out!
Rubberbass, for letting me use his server to test my silly plugin!
Lumen, for being a guinea pig in all this.
Lolparty, Salt, Navin, AK and so many others on BBHOD for breaking my plugin time and time again!




JumpBig.smx
http://www.sendspace.com/file/1i5akf
JumpBig.sp
http://www.sendspace.com/file/rmy3c5
MapCFGs
http://www.sendspace.com/file/27p4lu
   
Offline  VoiDeD
Maggot
*

Posts: 3
Specing a player in a race will show their timer (I need help with this one!)



Code: [Select]
#define SPECMODE_NONE 0
#define SPECMODE_FIRSTPERSON 4
#define SPECMODE_3RDPERSON 5
#define SPECMODE_FREELOOK 6

stock GetObserverMode( client )
{
    return GetEntProp( client, Prop_Send, "m_iObserverMode" );
}

stock GetObserverTarget( client )
{
    return GetEntPropEnt( client, Prop_Send, "m_hObserverTarget" );
}

stock bool:IsValidObserverMode( client )
{
    new obsMode = GetObserverMode( client );
    return ( obsMode == SPECMODE_FIRSTPERSON || obsMode == SPECMODE_3RDPERSON );
}

GetObserverTarget will return the player index that `client` is currently spectating, the rest of those stocks should be straight forward.

You can also use the IsClientObserver function to check if a given player is spectating or not.
« Last Edit: October 28, 2013, 02:40:31 AM by VoiDeD »


---------------------------
   
Offline  CrancK
Rocketeer
*

ehh... what?
Posts: 397
dude...
Coolio,

I've browsed through the source quickly (and without actually checking it ingame :S)
and i wrote down some thingies i noticed

Most of it isnt like... serious or anything, just stuff i noticed
Hope it can help you :P

Code: [Select]
------------------------------

You make your arrays 24+1

what if a server has 32 players?

use MAXPLAYERS instead when initializing those cvars, its set to 64 (cos thats sourcelimit)
and once in code use MaxClients (which will always be set to servers actuall limit, but has to be after plugin loads)
(+1 or <= if using in a loop ofc with i<MaxClients+1 or i<=MaxClients)


----------------------------------------------

Also, best practice is to make any handle you initialize, initialize on INVALID_HANDLE

---------------------------

something most modders do cos then you can check version ingame is to make

public Plugin:myinfo =
{
name = "Jump Big",
author = "Thomas",
description = "Tf2 Jump plugin",
version = "1.4",
url = "none"
}

into

#define PLUGIN_VERSION "1.4"

public Plugin:myinfo =
{
name = "Jump Big",
author = "Thomas",
description = "Tf2 Jump plugin",
version = PLUGIN_VERSION,
url = "none"
}

then

public OnPluginStart()
{
CreateConVar("sm_jbig_version", PLUGIN_VERSION, "JumpBig Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);

dont need to, but might be cool, just something i noticed

---------------------------------------

Also, why did you not make regen into a command that ppl can decide on their own?
Cos now only admins will be able to set it, design choice?


--------------------------------------

public Action:eventPlayerDisconnect(Handle:event, const String:name[], bool:dontBroadcast)

use public OnClientDisconnect(client) instead (events are less reliable)

Also events always happen after the fact, and at that point the player is also likely invalid which might fuck some things up (or not)

---------------------------

public OnClientPutInServer(client)

i use public OnClientPostAdminCheck(client) instead, because iirc onclientputinserver it doesnt have everything set yet
(though ofc if you dont touch those things then np i guess)


Also here you do: ServerCommand("mp_waitingforplayers_cancel 1");
dont do a server command each time someone comes in, i mean, its not even sure if the server is waitingforplayers at that time
might be better to use it on public TF2_OnWaitingForPlayersStart()

ohw and you also do it on  roundstart and waitingbegins event... o.0

it doesnt work just doing it on waitingbegins event only? odd


------------------------

if you call info from players other then the variables you made yourself, its safer to lso check
IsValidEntity(client), otherwise you might end up with some errors,
(and some bugs cos of code stopping at that point, thus not executing full thing, but may have already done something)

like in the saveclient command for example, you are calling flags and pos of player, if that player is invalid for whatever reason
itll error (not a biggie, just... errors are bad mmmkay)

------------------------

in most string commands, you dont need to beforehand call a clients name, you can just use PrintToChat(client, "%N is stupid", client);
can save you a couple of calls

----------------------------

if (timeTimer[client] != INVALID_HANDLE)
{
KillTimer(timeTimer[client])
timeTimer[client] = INVALID_HANDLE;
}
if (timeTimer[player] != INVALID_HANDLE)
{
KillTimer(timeTimer[player])
timeTimer[player] = INVALID_HANDLE;
}

as far as i have learned, killtimer is crap, and using CloseHandle(handlename) works better, but if this works for you then, coolstuff

---------------------------

plz for the love of god do not use a timer for regens!!! regenTimer[client] = CreateTimer(1.0, Timer_regen, client, TIMER_REPEAT);

just like, check when they get damage then add hp on them to negate said damage, hell its not even a problem if you just add +500hp whenever someone gets damage
(except that that might not be enough for quints?)
anyway that way ppl cant die from doubles

Also, using TF2_RegeneratePlayer(client) is ok... but no... no its not
cos it wont actually save ppl from triples and double demosticky etc
also, just whenever someone shoots (or when he gets damage) setting ammo to full (or over) also just seems better of an idea

---------

very small not, a boolean thats true or not you can check with if(ImATrueBool) and if(!ImAFalseBool)
just... noticed you used if(ImABool == false) which is ok.. just  longer :P

oh wow.. in the same function after it you do have one like i just said... so ahh nvm..

-----------------

ShowHudText(client, -1, "Time: %s",goaltime)

iirc, the reason skillsrank and ja do not use that one,
but used synchronized ones instead is cos they have more channels and thus dont get killed off by messages that maps can give

but if it works fine it works fine.

-----------------------------------

raceCountdownTimer[client] = CreateTimer(1.0, Timer_countdown, client, TIMER_REPEAT);

for the countdown, since its finite, could be easier to not use TIMER_REPEAT since then you have to call somewhere else to close it

instead make it so it calls itself again after its done, and just dont call itslef on last time, that way it would close itself simply with the return Plugin_Handled

----------------------------------




So ye.. lots of minor thingys

but 1 important one, please make sure syncs dont kill people, other then that its all fine really, just make sure syncs dont kill ppl



---------------------------
   
Offline  CrancK
Rocketeer
*

ehh... what?
Posts: 397
dude...
for the observer thingy, skillsrank makes a timer repeat when someone switches team to spec

Code: [Select]
public Action:Event_Change_Team(Handle:event, const String:name[], bool:dontBroadcast)
{
if(pluginEnabled)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new team = GetEventInt(event, "team");

if(team == 1) //Spectator
{


then uses

Code: [Select]

public Action:spectimer(Handle:timer, any:client)
{
if(pluginEnabled)
{
if(!IsClientConnected(client))
{ return Plugin_Handled; }

new target = GetEntPropEnt(client, Prop_Send, "m_hObserverTarget");
if(target < 1 || target > MAXPLAYERS)
{ return Plugin_Handled; }

if(IsPlayerAlive(target) && onCourse[target] != -1)
{

to check which person is target hes speccing, then from there just call your own variables of which time hes got and print that to the speccing persons screen

if hes not speccing someone just let the timer do nothing

once he switches teams or disconnects CloseHandle(timer) or KillTimer if that works for you


-------------------------------------------


Also about that regen again... just make it a command only

theres no need to force things ever...
just make more code and make it clear what ppl choose, like if they use regen then just show it
for races you could make it so if one player wants regen on the race it shows up in the request for the race

but ye.. forcing it makes freestyling impossible, and also makes just mucking about impossible, 2 very important things


EDIT2:
ohw also, need to stop classes that are not Engineer, from using engi teleports

can do with: HookEvent("player_teleported", Event_Player_Teleported);

which is the event for when someone uses an engi tp, too bad its only through an event cos then you cant actually disable it, in skillsrank i just kill the timer when someone uses it, but you could also just tp a person back (though that would require knowing where the person was at that time before the event triggered)
« Last Edit: October 28, 2013, 03:35:48 AM by CrancK »


---------------------------
   
Offline  Thomas
Maggot
*

Posts: 10
Dreams are
Good to see from you Voided! Thanks for this info, I will start to work on JB once I am done with my map and get some health problems sorted! CrancK has a good point with regen I think, I need to think on all of this.
   
0 Members and 1 Guest are viewing this topic.
Pages: [1]
« previous next »


spirit Powered by SMF 2.0 RC5 | SMF © 2006–2011, Simple Machines LLC