Coder Social home page Coder Social logo

nosoop / sm-tfutils Goto Github PK

View Code? Open in Web Editor NEW
24.0 24.0 4.0 76 KB

SourceMod function call and memory access natives for TF2

License: GNU General Public License v3.0

SourcePawn 84.73% Python 15.27%
sourcemod sourcemod-lib team-fortress-2 tf2

sm-tfutils's People

Contributors

arthurdead avatar batfoxkid avatar mikusch avatar nosoop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

sm-tfutils's Issues

Compile errors

Soucemod - 1.11 - build 6919

//// tf2utils.sp
//
// tf2utils.sp(500) : warning 209: function has explicit 'int' tag but does not return a value
// tf2utils.sp(559) : warning 209: function has explicit 'int' tag but does not return a value
// tf2utils.sp(580) : warning 209: function has explicit 'int' tag but does not return a value
// tf2utils.sp(610) : warning 209: function has explicit 'int' tag but does not return a value
// tf2utils.sp(776) : warning 242: function "Native_SetPlayerConditionDuration" should return an explicit value
// tf2utils.sp(808) : warning 242: function "Native_SetPlayerConditionProvider" should return an explicit value
// tf2utils.sp(836) : warning 242: function "Native_SetPlayerBurnDuration" should return an explicit value
// tf2utils.sp(836) : warning 242: function "Native_SetPlayerBurnDuration" should return an explicit value
// tf2utils.sp(849) : warning 242: function "Native_IgnitePlayer" should return an explicit value
// tf2utils.sp(971) : warning 242: function "Native_SetPlayerRespawnTimeOverride" should return an explicit value
// tf2utils.sp(971) : warning 242: function "Native_SetPlayerRespawnTimeOverride" should return an explicit value
// Code size: 31760 bytes
// Data size: 10000 bytes
// Stack/heap size: 16732 bytes
// Total requirements: 58492 bytes
//
// 11 Warnings.
//
// Compilation Time: 0.48 sec

Can you fix please?

Plugin fails to load with SM error

Fresh install, attempted using both the newest and second newest release, plugin in plugins folder, gamedata in gamedata file etc.
SM errors on attempting to load plugin:

[SM] Exception reported: Could not determine location to read CTFPlayer::m_aObjects from.
[SM] Blaming: tf2utils.smx
[SM] Call stack trace:
[SM] [0] SetFailState
[SM] [1] Line 243, scripting/tf2utils.sp::OnPluginStart

SM version 1.10.0.6528

`TF2Util_GetPlayerMaxHealth` does not discount overheal correctly.

TF2Util_GetPlayerMaxHealth doesn't handle overheal correctly, no matter what bIgnoreOverheal is set to. Fairly confident this isn't intended behaviour, as projectile_heal_on_teammate_contact.sp in the Custom Attribute Starter Pack explicitly uses base health to calculate a separate max overheal proportion.

This code:

	int iMaxHP = TF2Util_GetPlayerMaxHealth(attacker, false, false);
	PrintToServer("Max HP (bIgnoreOverheal = false):");
	char bffr5[16];
	IntToString(iMaxHP, bffr5, 16);
	PrintToServer(bffr5);
	
	iMaxHP = TF2Util_GetPlayerMaxHealth(attacker, false, true);
	PrintToServer("Max HP (bIgnoreOverheal = true):");
	char bffr6[16];
	IntToString(iMaxHP, bffr6, 16);
	PrintToServer(bffr6);

Produces this output in console:

image

(Note: This is on Demoman, so it is at least calculating max HP with overheal correctly.)

Cannot load after 4/18/2024 update

Posting for you the error I encounter upon trying to load tf2utils

L 04/18/2024 - 20:49:28: [nosoop_tf2utils.smx] TF_COND_LAST is not within expected bounds (found 83000000). Condition bounds checking will produce false positives and condition count native will report incorrect values.
L 04/18/2024 - 20:49:28: [SM] Exception reported: Could not determine offset of CTFPlayer::m_flRespawnTimeOverride (received bb831574)
L 04/18/2024 - 20:49:28: [SM] Blaming: nosoop_tf2utils.smx
L 04/18/2024 - 20:49:28: [SM] Call stack trace:
L 04/18/2024 - 20:49:28: [SM] [0] SetFailState
L 04/18/2024 - 20:49:28: [SM] [1] Line 433, scripting/tf2utils.sp::OnPluginStart

Gamedata for Windows contains some missing/broken signatures/offsets

L 04/18/2024 - 23:09:09: [SM] Exception reported: Failed to set up call to CTFPlayerShared::MakeBleed()
L 04/18/2024 - 23:09:09: [SM] Blaming: tf2utils.smx
L 04/18/2024 - 23:09:09: [SM] Call stack trace:
L 04/18/2024 - 23:09:09: [SM] [0] SetFailState
L 04/18/2024 - 23:09:09: [SM] [1] Line 236, scripting/tf2utils.sp::OnPluginStart

A function to end the round

nosoop โ€” Today at 4:48 PM
feel free to raise an issue for it in tf2utils if you want; was planning on adding [a function to force a team win]

... I love getting useless GitHub stats, say no more

Anyway, a function to force a team to win or stalemate would be nice

Some useful implementation details:
CTFGameRules (tf_gamerules) has a function called SetWinningTeam and SetStatemate
When game_round_win is used, it calls one of these 2 functions.

Arguments for CTFGameRules::SetWinningTeam:
0 is the team index (int)
1 is the win reason, used for pass time? It's also provided in the teamplay_round_win event (int)
2 resets the map if set to true (bool)
3 switches the teams if set to true (bool)
4 adds 1 to the team score thing that shows at the end if set to true (bool)
5 makes the humiliation period last for 5 seconds if true and if we're in competitive mode (bool)

CTFGameRules::SetStalemate only has args 1-3 of CTFGameRules::SetWinningTeam

Support for CTFPlayer::GetLoadoutItem and CTFPlayerInventory::GetItemInLoadout

CTFPlayerInventory::GetItemInLoadout gets the player's equipped item in the specified class's specified loadout slot.
CTFPlayer::GetLoadoutItem calls CTFPlayerInventory::GetItemInLoadout but also checks to see if the item is banned in the competitive whitelist, in which case, the base/stock item is returned.
I think natives to use those 2 functions would be useful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.