PDA

View Full Version : Terms Agreement [Memory Leak Fixed]


mateo10
07-07-2007, 16:44
Terms Agreement

Installation
[1] Create a file named "terms.txt" in addons/sourcemod/configs.
[2] Put your terms in that file, and save it (see down).

Example terms.txt file:

Before playing on this server
you have to agree to these terms:
- Do not cheat
- Do not swear
- Obey the admins


Notes
The plugin is untested, because I'm at my "bad" computer, which doesn't have CSS, or any other source mod.

Credits
Everyone that helped me at #sourcemod.
Extra big thanks to BAILOPAN.

If you have 1.0, you HAVE to update to 1.1. There was a bug, and I changed the menu system to panels.

Updated with CloseHandle(hFile)

Rebell
07-08-2007, 03:42
Good idea.

Will this be shown at connect or at every mapchange ?


cya

mateo10
07-08-2007, 05:59
It will be shown when the player spawns his first time. I don't know how to save the data, but when I do I will add that the player only has to agree to the terms 1 time.

mateo10
07-08-2007, 09:00
Plugin updated (see main post).

API
07-08-2007, 11:58
Cool idea :]

Falco
07-08-2007, 21:10
Works good except that if I enable the statsmeminimum menu when you join the agreement gets closed when this menu opens. You then do not have to agree and can play without reading agreement.
[02] Statsmeminimum Plug 1.3.0.8b Roger Devil RUN
smm_dmg_choosestats 0 // Displays a menu on the clientwhere you can choose the stats

Wolfman Jack
07-11-2007, 10:25
I have found that when a player declines to agree, it crashes the server. It is a Windows server, runing DOD:Source. I have the latest Sourcemod build as of yesterday and it still crashes the server.

mateo10
07-11-2007, 12:52
Strange, I tested to decline, and I got kicked.
Did it print an error message or anything?

yester64
07-11-2007, 23:18
mm.. does not work with gungame.
in the moment the gungame menu appears, your menu disappears.

can't use it so far, but would like to.

Rebell
07-12-2007, 13:40
mm.. does not work with gungame.
in the moment the gungame menu appears, your menu disappears.

can't use it so far, but would like to.

Would be nice if plugins would use somethink similar to eventscripts popup code from mattie. If there are more than 1 popups, then the other popup will come after the other....

cya

Wolfman Jack
07-13-2007, 14:13
It kicks you, as the decliner, but then the server crashes, effectively kicking all the other players. I dont know if the problem is only with your plugin, or the combination of several plugins, or Sourcemod. To be honest Sourcemod was crashing every few map changes, this was with no other plugins. When I added plugins it began to really go downhill.

I had every recent version of metamod, sourcemod, and the plugins so I am sure it wasnt an out of date issue.

Anyway I dont think Sourcemod is ready for prime time, as we used it for 2 weeks on a heavily loaded 24 player DOD:S server and had to dump it because of the issues. We are now using Mani 1.2/

Good luck and hope you can resolve whats going on.

imported_sparky
07-18-2007, 22:36
Linux
latest build

L 07/18/2007 - 10:26:22: "-[L.I.]- sparky<2><STEAM_0:0:644879><Axis>" disconnected (reason "You disagreed to the terms")
Dropped -[L.I.]- sparky from server (You disagreed to the terms)
./srcds_run: line 344: 14886 Segmentation fault $HL_CMD
Add "-debug" to the ./srcds_run command line to generate a debug.log to help with solving this problem
Wed Jul 18 10:26:22 EDT 2007: Server restart in 10 seconds


poof

Hell Phoenix
07-18-2007, 23:29
Anyway I dont think Sourcemod is ready for prime time, as we used it for 2 weeks on a heavily loaded 24 player DOD:S server and had to dump it because of the issues. We are now using Mani 1.2/


Havent had a single problem on our 28 player DoD:S server or our 26 man Insurgency server with sourcemod. Stable as a rock.

Spinner
07-19-2007, 00:04
Havent had a single problem on our 28 player DoD:S server or our 26 man Insurgency server with sourcemod. Stable as a rock.

Linux or windows?

Rebell
07-24-2007, 13:24
Hey works perfect with insurgency mod !

http://xs217.xs.to/xs217/07302/ins_sinjar0000.jpg

cya :up:

imported_Anth0ny
07-25-2007, 08:45
http://www.sourcemod.net/compiler.php


Your plugin successfully compiled!
Use the link below to download your plugin. It will be valid for ten minutes.

.......

/home/groups/sourcemod/upload_tmp/phpXGuclV.sp(64) : warning 204: symbol is assigned a value that is never used: "szTerms"

bl4nk
07-25-2007, 16:39
@imported_Anth0ny: It's just something he put in there and forgot to remove. It's nothing to worry about, but if you're anal, go in and remove line 64 from the source and then compile it.

andye836
08-06-2007, 07:55
nice plugin but one thing ive noticed if you dont choose either option 1 or 2 the box disappears after about a min, would be better if it kicked if no option is chosen with a message saying something like you must either agree or disagree to the terms.

imported_sparky
08-22-2007, 18:59
Anyone using this with dod and linux???

Jedi
08-22-2007, 23:48
Works on dod and windows.

lamdacore
08-23-2007, 05:51
works on dods and linux

but only the bug exist if you don't push a button for a certain time the dialog vanishes and you can play without agreed the terms .. it would be better if then the player would be kicked instead.

MoggieX
08-23-2007, 08:22
What a really good idea!

Will add this tonight!

MoggieX
08-23-2007, 08:30
Oh when I compile I get this warning:

./spcomp termsagreement.sp
SourcePawn Compiler 1.0.0.1319
Copyright (c) 1997-2006, ITB CompuPhase, (C)2004-2007 AlliedModders, LLC

termsagreement.sp(64) : warning 204: symbol is assigned a value that is never us ed: "szTerms"
Header size: 1804 bytes
Code size: 1404 bytes
Data size: 716 bytes
Stack/heap size: 16384 bytes; Total requirements: 20308 bytes

1 Warning.I pressume its @ line 68 where its declared but never used?

new String:szTerms[512];

Also if you join a CS:S server (under linux) and then got as a spectator, then select 'I disagree' you are not kicked.

Matt

MoggieX
08-29-2007, 19:02
On checking the log files, I have a shed load of these:


L 08/29/2007 - 23:29:26: [SM] Plugin encountered error 15: Array index is out of bounds
L 08/29/2007 - 23:29:26: [SM] Displaying call stack trace for plugin "termsagreement.smx":
L 08/29/2007 - 23:29:26: [SM] [0] Line 46, termsagreement.sp::HookClientSpawn()
L 08/29/2007 - 23:29:26: [SM] Plugin encountered error 15: Array index is out of bounds
L 08/29/2007 - 23:29:26: [SM] Displaying call stack trace for plugin "termsagreement.smx":
L 08/29/2007 - 23:29:26: [SM] [0] Line 46, termsagreement.sp::HookClientSpawn()
L 08/29/2007 - 23:29:26: [SM] Plugin encountered error 15: Array index is out of bounds
L 08/29/2007 - 23:29:26: [SM] Displaying call stack trace for plugin "termsagreement.smx":
L 08/29/2007 - 23:29:26: [SM] [0] Line 46, termsagreement.sp::HookClientSpawn()
L 08/29/2007 - 23:29:26: [SM] Plugin encountered error 15: Array index is out of bounds
L 08/29/2007 - 23:29:26: [SM] Displaying call stack trace for plugin "termsagreement.smx":
L 08/29/2007 - 23:29:26: [SM] [0] Line 46, termsagreement.sp::HookClientSpawn()
L 08/29/2007 - 23:29:26: [SM] Plugin encountered error 15: Array index is out of bounds
L 08/29/2007 - 23:29:26: [SM] Displaying call stack trace for plugin "termsagreement.smx":
L 08/29/2007 - 23:29:26: [SM] [0] Line 46, termsagreement.sp::HookClientSpawn()
L 08/29/2007 - 23:29:26: [SM] Plugin encountered error 15: Array index is out of bounds
L 08/29/2007 - 23:29:26: [SM] Displaying call stack trace for plugin "termsagreement.smx":



Any ideas?

imported_Anth0ny
09-05-2007, 07:22
any news and updates?

=) Please.

Craziness
09-29-2007, 12:28
Wonderful plugin idea!

Im trying to get it to work on my Linux Fortress Forever server atm but having a little trouble. When I spawn it has a clock icon in the upper left corner that tells me to either accept or decline but I don't get a list of the terms. Think this is a FF problem or possibly something I'm doing wrong? I put a terms.txt files in sourcemod/configs

thanks for any and all help. I would really like to have this working.

imported_Anth0ny
09-29-2007, 14:32
feature request: multiple pages need.

imported_Anth0ny
10-07-2007, 12:46
BUG FIX: http://forums.alliedmods.net/showpost.php?p=539361&postcount=13

Chaos Llama
12-05-2007, 00:44
I've encountered a weird bug (in pvkii). Sometimes (randomly) on map load the terms agreement doesnt display at all. If a player still pressed 1 or 2 it acts as if they agreed/dissagreed.

mateo10
01-27-2008, 13:12
I have fixed the memory leak now, it's safe to use again.

Box Cutter
02-17-2008, 22:16
Is there anyway to force the Terms to be answered before picking a team or class. The reason is, I am running the DeathMatch mod and by the time they get to the terms, the gun menu is popping up and making the terms disappear and they are not being accepted or declined. It would be great if this would pop up in the MOTD window, or is there a similar plugin like that already?

TIA

-BC

Box Cutter
04-05-2008, 17:30
Still no answer to my previous post. I would really love to use this plugin, but again it does me no good running CSSDM. Can you please add in a option to set a delay for when the rules appear on the players screen?

thank you

Box Cutter
04-19-2008, 14:37
What would be even better than what I suggested above is if the rules window kept popping up until the client accepts or declines. This way if something does pop up in its place (like the CSSDM menu) then it will come back again and again until the client responds.

I know the author of this plugin has been inactive for a couple months. If anyone is willing to revise the plugin with this feature that would be great.

Thank you

SixSicSix
04-20-2008, 11:39
Could you make it such that if a player never answers, it kicks them and says something like "Please check your game settings in the event that you did not see the terms of agreement."

SixSicSix
04-21-2008, 14:46
Also, can we get a local database in which the plugin stores Steam ID's that accept it (like just a .txt file with them)?

Kigen
07-11-2008, 19:34
new bool:gClientSpawned[33];
new bool:gClientAgreed[33];

Should be:

new bool:gClientSpawned[MAXPLAYERS+1];
new bool:gClientAgreed[MAXPLAYERS+1];

Box Cutter
07-11-2008, 19:53
Is that just a bug fix Kigen?

-BC

Kigen
07-11-2008, 19:56
Fixed the above posted bug (the bit in my post) and fixed a compile warning (unused variable szTerms).

I could easily add such things as not giving it to them on a map change, etc.

Box Cutter
07-11-2008, 20:01
Well I dropped this plugin because it did no good with CSSDM. By the time a player would see the rules the gun menu would pop up and the rules never got accepted or declined. I would consider using it again if the plugin could be made to force the players to accept or decline by bringing the menu back up until they respond. And if they don't respond for a certain time kick them.

-BC

Kigen
07-11-2008, 20:04
Yeah, that can be done. I personally, though, think the creator should say something. Cause if I started doing features for his plugin it really wouldn't be his anymore. :p

Box Cutter
07-11-2008, 20:45
Well honestly I can do without so if it never happens that is fine. But yeah I dont think the author will do it since he hasn't posted on here in ages. It would be nice to have but most people know the basic rules like no hacking and what not. They can just read my MOTD.

BTW, where the heck did you come from Kigen? lol, I never see anything from you then all of a sudden you have this badass anti cheat plugin and know a ton of shiz about scripting.

-BC

Kigen
07-11-2008, 21:10
Meh. :p Was in TRIBES until the beginning of this year. After I left TRIBES I played CSS more then joined NS and started coding on Source PAWN (SourceMod's scripting language). Then with KAC is when I decided to start posting here.

rela
07-12-2008, 09:19
Meh. :p Was in TRIBES until the beginning of this year. After I left TRIBES I played CSS more then joined NS and started coding on Source PAWN (SourceMod's scripting language). Then with KAC is when I decided to start posting here.

Oh please try to update this Plugin. It would be great if every player had to accept the terms only once (per login or per steam id). I would appreciate an update of this plugin.

XARIUS
07-14-2008, 12:41
Oh please try to update this Plugin. It would be great if every player had to accept the terms only once (per login or per steam id). I would appreciate an update of this plugin.

Wow, I never knew this plugin existed. I wrote one almost exactly like it about a month ago.

I tried collecting the steam ID's on round end (hooking the scoreboard), then tried cycling thru the steam id's as clients reconnected on map change, only showing the rules to those steam id's not previously on the server, however I never could get it working properly. :cry:

I may take another stab at it soon.

Kigen
07-14-2008, 22:02
Well, as far as the map changes goes. Technically, all players disconnect from the server, the server is restarted in a sense, and all the players re-connect. Its fairly easy to do a map change carry over. Just push the Steam IDs of all players into a adt_array and use the native search function to see if they're there.

Either that, or you can create something like "new String:g_SteamIDs[MAXPLAYERS+1][64];" and push all the steam IDs into it on a map end.

rela
07-15-2008, 07:45
Well, as far as the map changes goes. Technically, all players disconnect from the server, the server is restarted in a sense, and all the players re-connect. Its fairly easy to do a map change carry over. Just push the Steam IDs of all players into a adt_array and use the native search function to see if they're there.

Either that, or you can create something like &quot;new String:g_SteamIDs[MAXPLAYERS+1][64];&quot; and push all the steam IDs into it on a map end.

Oo Unfortunately i cant do that on my own. So it would be awesome if someone would add a player-array to this plugin!

kobo1d
07-17-2008, 12:12
hmmm im on linux /css and i dont see the menu when i join!
when im very quck i can see a small box left top.. it says "DR Fix" or "DK Fix" .. dunno sumthing liek thet and it gets off pretty fast.. even before im "in-map"..

what could thet mean ?

XARIUS
07-18-2008, 16:01
Oh please try to update this Plugin. It would be great if every player had to accept the terms only once (per login or per steam id). I would appreciate an update of this plugin.

As I mentioned before, I didn't know this plugin existed before I wrote mine. I have however updated mine to include this "per session" functionality.

For more information, please see my update post. I hope it helps you out.

http://forums.alliedmods.net/showthread.php?t=72788

X

The Flyer
07-12-2009, 08:04
Hi,

can every on fix the Terms.txt?

We would to have the Term with colour.

{WHITE}, {RED}, {GREEN}, {BLUE}, {YELLOW}, {PURPLE}, {CYAN}, {ORANGE}, {PINK}, {OLIVE}, {LIME}, {VIOLET} and {LIGHTBLUE}

That you can write in the terms.txt:
{blue} Read this one! (That the Text is Blue)

Greetz

MoggieX
07-12-2009, 08:40
Hi,

can every on fix the Terms.txt?

We would to have the Term with colour.

{WHITE}, {RED}, {GREEN}, {BLUE}, {YELLOW}, {PURPLE}, {CYAN}, {ORANGE}, {PINK}, {OLIVE}, {LIME}, {VIOLET} and {LIGHTBLUE}

That you can write in the terms.txt:
{blue} Read this one! (That the Text is Blue)

Greetz

Thats not possible in these panels

Matt

BeG
07-14-2009, 14:40
hi can u made it so that when im type !regeln in the chat that comes the popup again but without the agree and disagreement ? i hope so.

love this plugin

BeG

dirtyjob
08-30-2009, 20:24
players can still spawn without accepting the rules, can someone issue a fix for this that can freeze them untill they accept? then they can move.

BeG
08-31-2009, 06:05
thats a pretty nice idea

BeG
10-02-2009, 14:28
*push* pls its important!pls pls pls

Box Cutter
10-02-2009, 16:14
I don't think the author is supporting this anymore since there hasnt been an update in 2 years and the author hasnt been on in a couple months.

You may want to try the plugin in the new plugins board.

http://forums.alliedmods.net/showthread.php?t=103430

ottobohn
12-24-2009, 14:57
There's a bug with this one that randomly kicks you now.

otto

ignitor
01-11-2010, 13:13
L 01/09/2010 - 00:00:46: [SM] Plugin encountered error 15: Array index is out of bounds
L 01/09/2010 - 00:00:46: [SM] Displaying call stack trace for plugin "termsagreement.smx":
L 01/09/2010 - 00:00:46: [SM] [0] Line 46, /home/groups/alliedmodders/forums/files/9/4/7/9/17927.attach::HookClientSpawn()

Inkognito
07-03-2011, 11:48
So, I've just updated/modded this Plugin to make it usefull again. Version is now 1.3
Problem was:
The menu can (and will be) lost when the player opens another menu (like SoD-Stats, Admin-Menu, Settings-Menu,... whatever).
So the player is not forced to make a choice.

My (simple) Solution:

I added a timer which will reopen the menu after 60 seconds again (if player hasn't agreed yet).
If the player ignors the menu again it will reopen once more after 30 seconds.
This time it will not display terms.txt, but termswarning.txt. (This is new! - You need to create this file!)
Just write something like following in termswarning.txt:Before playing on this server
you have to agree to these terms:
- Do not cheat
- Do not swear
- Obey the admins

Last warning! You need to agree on
this terms or you will be kicked in
less than 15 seconds!
And that's what will happen after 15 seconds if the player refuses to agree! ^^

Hope, you enjoy it! ;)
(I've also translated the PlugIn to the German language... although language ist hardcoded. That's why there are 2 SMX-Files attached.)

Some words of warning:
I have learned the API of SM by editing this Plugin. I've tried to do my best, sticked to Documentation, the Compiler didn't show even one error, console also doesn't show errors and during in-game testing it worked perfectly, but I would really appreciate it, if someone with more knowledge would briefly check the source-code.

If you want to show the Rules using !rules you have to install the Advanced Rules Menu additionally (link in post above) and set sm_rules_noconnect to 1. (Of course, you should have the same rules in both plugins... ^^)

Concerning freezing the player: Nice idea, I've taken it into consideration, but using the sm_freeze command freezing is possible, but it isn't a good approach for this purpose.
Reason: sm_freeze requires a time (how long the player will be frozen).
(=> My initial idea was freezing the player for 2 second, after this 2 seconds check if player agreed, freeze for another 2 seconds and so on.)
Another issue would have been if player joins the spectators. Freezing would be useless in that case which would require to rewrite another part of the plugin).
So, that's not a clean solution...

cya...

EDIT: Added Bot-Support...

Pinkfloyd
04-20-2012, 11:13
Hi.

Can anyone just advise if this plugin still works please?

Ive tried it and cant make it work at the moment.

MIKEE
09-16-2012, 23:54
So, I've just updated/modded this Plugin to make it usefull again. Version is now 1.3
Problem was:
The menu can (and will be) lost when the player opens another menu (like SoD-Stats, Admin-Menu, Settings-Menu,... whatever).
So the player is not forced to make a choice.

My (simple) Solution:

I added a timer which will reopen the menu after 60 seconds again (if player hasn't agreed yet).
If the player ignors the menu again it will reopen once more after 30 seconds.
This time it will not display terms.txt, but termswarning.txt. (This is new! - You need to create this file!)
Just write something like following in termswarning.txt:Before playing on this server
you have to agree to these terms:
- Do not cheat
- Do not swear
- Obey the admins

Last warning! You need to agree on
this terms or you will be kicked in
less than 15 seconds!
And that's what will happen after 15 seconds if the player refuses to agree! ^^

Hope, you enjoy it! ;)
(I've also translated the PlugIn to the German language... although language ist hardcoded. That's why there are 2 SMX-Files attached.)

Some words of warning:
I have learned the API of SM by editing this Plugin. I've tried to do my best, sticked to Documentation, the Compiler didn't show even one error, console also doesn't show errors and during in-game testing it worked perfectly, but I would really appreciate it, if someone with more knowledge would briefly check the source-code.

If you want to show the Rules using !rules you have to install the Advanced Rules Menu additionally (link in post above) and set sm_rules_noconnect to 1. (Of course, you should have the same rules in both plugins... ^^)

Concerning freezing the player: Nice idea, I've taken it into consideration, but using the sm_freeze command freezing is possible, but it isn't a good approach for this purpose.
Reason: sm_freeze requires a time (how long the player will be frozen).
(=> My initial idea was freezing the player for 2 second, after this 2 seconds check if player agreed, freeze for another 2 seconds and so on.)
Another issue would have been if player joins the spectators. Freezing would be useless in that case which would require to rewrite another part of the plugin).
So, that's not a clean solution...

cya...

EDIT: Added Bot-Support... NOT WORK LOL man

Inkognito
09-17-2012, 16:34
It does work. I just tested it on my CSS-Server running latest dev-edition of SM and MM (on windows-server).

If you don't want to read the full post, just download and install the attachment.

Explanation what the plugin does:

When the player joins the server the plugin opens a menu-panel showing the terms and requesting the player to agree on them. Although, a menu might be closed if another plugin opens a menu for whatever reason. In that case the player would get kicked for no reason after the timeout.
My modification opens the panel again after 60 seconds displaying a reminder rather than kicking the player immediately. If this reminder is ignored again the warning (termswarning.txt) will be displayed after 30 seconds. If the player fails to agree within 15 seconds he will be kicked. These are 3 chances -or 105 seconds- to agree on the terms... Should be enough.
The problem some might have experienced: If the txt-files are not in place with the correct filename they are simply not displayed. Anyway, the player will be kicked after 105 seconds. The attached zip-file should prevent this in the future. Just edit the txt-files to whatever you want...

BR, Thomas

shavit
09-17-2012, 19:17
Wow you released it in 7/7/7 :D

Scipizoa
10-21-2012, 10:21
I've been looking for this mod FOREVER, this is something every trade/achievement server should have, but what threw me off was the name of the mod, terms agreement, like who would think to look for that xD

SmackDaddy
12-08-2012, 18:11
Any way to make admins/donors exempt from this plugin?

It does work. I just tested it on my CSS-Server running latest dev-edition of SM and MM (on windows-server).

If you don't want to read the full post, just download and install the attachment.

Explanation what the plugin does:

When the player joins the server the plugin opens a menu-panel showing the terms and requesting the player to agree on them. Although, a menu might be closed if another plugin opens a menu for whatever reason. In that case the player would get kicked for no reason after the timeout.
My modification opens the panel again after 60 seconds displaying a reminder rather than kicking the player immediately. If this reminder is ignored again the warning (termswarning.txt) will be displayed after 30 seconds. If the player fails to agree within 15 seconds he will be kicked. These are 3 chances -or 105 seconds- to agree on the terms... Should be enough.
The problem some might have experienced: If the txt-files are not in place with the correct filename they are simply not displayed. Anyway, the player will be kicked after 105 seconds. The attached zip-file should prevent this in the future. Just edit the txt-files to whatever you want...

BR, Thomas

And can we please get the .sp (source) file?

Inkognito
12-29-2012, 17:50
Refer to Post #58. Nothing has been modified. I just packaged it to allow an easier installation for the "I just wanna download asap"-admins.
Concerning your request for exemption: Possible yes. Although, my coding-skills are very limited. Therefore I will leave it as it is rather than making a probably buggy improvement. That may change in the future, but for now I won't touch it for the sake of stability.
This plugins is also thought to be a very basic, simple and stable one. For more features I would recommend to pick one of the "rules" plugins.

BR, Thomas

Wolfseye
06-01-2014, 10:56
Just tested this Plugin on my INSURGENCY (Standalone) Server. Technically it works, the problem is, if someone just waits long enough, the thing will just disappear even if the player didnt press on 1 to agree to the terms. And thats beside the point.

Too bad.

Rop
06-20-2014, 23:48
Why setmenutitle "Terms agreement", I dont get the point of this, if people want this to be displayed they can add it in terms.txt, so please remove this and add it on top of your terms example... Other than that nice plugin.

Hackmastr
08-06-2014, 14:00
That Bump. Use other plugins; https://forums.alliedmods.net/showthread.php?t=103430?t=103430
https://forums.alliedmods.net/showthread.php?t=72788?t=72788

Henry02
02-03-2016, 14:23
hi i love this plugin butt its showing on every mapchange i dont want that
i only want it to show at start of game