Raised This Month: $51 Target: $400
 12% 

[DOD:s]fix [DoDS] Class Restrictions for individual players..


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mewbie222
Senior Member
Join Date: May 2018
Old 12-14-2022 , 13:16   [DOD:s]fix [DoDS] Class Restrictions for individual players..
Reply With Quote #1

there is such a plugin https://forums.alliedmods.net/showthread.php?t=81610 for DOD:s . In general, the problem is that some players somehow manage to "deceive = bypass" him .. And they can take the weapon blocked from their class.
Someone told me that like they very many times or quickly nadialied the choice of the player's class ...
I can’t understand how they do it .. Maybe there is a way to remake it a little differently.
Quote:
Originally Posted by mewbie222 View Post
Is it possible to add a ban on weapons, at the SDKHook level, as I understand it, this should be used:
SDKHook_WeaponEquip, SDKHook_WeaponCanUse or ...
And sometimes the plugin does not work for some players, I wrote about this above.
But I don’t know how it will work and whether there will be lags and other troubles on the server ..

Last edited by mewbie222; 12-14-2022 at 13:20.
mewbie222 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 12-14-2022 , 19:29   Re: [DOD:s]fix [DoDS] Class Restrictions for individual players..
Reply With Quote #2

not sure.

So you not use in game convars ?
PHP Code:

"mp_limit_allies_rifleman" "1" def"-1" )
 
game replicated
 
- Class limit for teamAllies class: Rifleman
"mp_limit_allies_assault" "-1"
 
game replicated
 
- Class limit for teamAllies class: Assault
"mp_limit_allies_support" "-1"
 
game replicated
 
- Class limit for teamAllies class: Support
"mp_limit_allies_sniper" "-1"
 
game replicated
 
- Class limit for teamAllies class: Sniper
"mp_limit_allies_mg" "-1"
 
game replicated
 
- Class limit for teamAllies class: Machinegunner
"mp_limit_allies_rocket" "-1"
 
game replicated
 
- Class limit for teamAllies class: Rocket
"mp_limit_axis_rifleman" "-1"
 
game replicated
 
- Class limit for teamAxis class: Rifleman
"mp_limit_axis_assault" "-1"
 
game replicated
 
- Class limit for teamAxis class: Assault
"mp_limit_axis_support" "-1"
 
game replicated
 
- Class limit for teamAxis class: Support
"mp_limit_axis_sniper" "-1"
 
game replicated
 
- Class limit for teamAxis class: Sniper
"mp_limit_axis_mg" "-1"
 
game replicated
 
- Class limit for teamAxis class: Machinegunner
"mp_limit_axis_rocket" "-1"
 
game replicated
 
- Class limit for teamAxis class: Rocket 
__________________
Do not Private Message @me
Bacardi is offline
mewbie222
Senior Member
Join Date: May 2018
Old 12-15-2022 , 01:56   Re: [DOD:s]fix [DoDS] Class Restrictions for individual players..
Reply With Quote #3

Quote:
Originally Posted by Bacardi View Post
not sure.

So you not use in game convars ?
[PHP]
Have you looked at the plugin what it does?!!!

And the plugin closes a certain class to a certain player ([DoDS] Class Restrictions for individual players)...

So sometimes some players, when a certain class is closed for them, this plugin is somehow bypassed = cheaters use some kind of hack or chip, and take the class that is forbidden from them. That is, for them, the admin ban in the form of a plug-in for the class is nonsense, which put a ban on, say, a sniper, no, they still manage to take it (the sniper class), but in the sense of a weapon class.

I began to look at the code, and there is not an extra "else" in this block?
Here is a piece of code (highlighted in red):
Quote:
public Action:ChangeClassEvent(Handle:event, const String:name[], bool:dontBroadcast)
{
if (GetConVarInt(g_Cvar_Enable))
{
new client = GetClientOfUserId(GetEventInt(event, "userid"))
new class = GetEventInt(event, "class")
new String:classstring[64]

if (g_Class[client][class] == 1)
{
PrintCenterText(client, "%s Class Unavailable", classname[class])
Format(classstring, sizeof(classstring), "joinclass %i", g_PreviousClass[client])
FakeClientCommand(client, classstring)
new team = GetClientTeam(client)
ShowVGUIPanel(client, team == 3 ? "class_ger" : "class_us")
}
else
{
g_PreviousClass[client] = class
}

}
return Plugin_Continue
}

Last edited by mewbie222; 12-15-2022 at 02:05.
mewbie222 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 12-15-2022 , 04:20   Re: [DOD:s]fix [DoDS] Class Restrictions for individual players..
Reply With Quote #4

ok.

Code:
L 12/15/2022 - 11:18:38: [SM] Exception reported: Array index out-of-bounds (index -2, limit 10)
L 12/15/2022 - 11:18:38: [SM] Blaming: sm_dod_class_block.smx
L 12/15/2022 - 11:18:38: [SM] Call stack trace:
L 12/15/2022 - 11:18:38: [SM]   [1] Line 84, /home/groups/alliedmodders/forums/files/2/4/5/7/3/34598.attach::ChangeClassE
They just need use "random class" then plugin get error.

*edit
You can disable this with mp_allowrandomclass 0

Last edited by Bacardi; 12-15-2022 at 05:09.
Bacardi is offline
mewbie222
Senior Member
Join Date: May 2018
Old 12-15-2022 , 05:36   Re: [DOD:s]fix [DoDS] Class Restrictions for individual players..
Reply With Quote #5

Quote:
Originally Posted by Bacardi View Post
ok.

Code:
L 12/15/2022 - 11:18:38: [SM] Exception reported: Array index out-of-bounds (index -2, limit 10)
L 12/15/2022 - 11:18:38: [SM] Blaming: sm_dod_class_block.smx
L 12/15/2022 - 11:18:38: [SM] Call stack trace:
L 12/15/2022 - 11:18:38: [SM]   [1] Line 84, /home/groups/alliedmodders/forums/files/2/4/5/7/3/34598.attach::ChangeClassE
They just need use "random class" then plugin get error.

*edit
You can disable this with mp_allowrandomclass 0
Ok , testing ,in my server.cfg server mp_allowrandomclass 1..
thanks for the advice, we'll try, maybe this is really a mistake.
upd:nope did not help, still managed to take to get a blocked class.

so far this command has not helped ... but for now they checked, when the 1st time was chosen, the class was blocked for the player, as soon as he sharply clicks again on the same blocked class for the player, the player can open the class.

Last edited by mewbie222; 12-15-2022 at 10:25.
mewbie222 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 12-16-2022 , 05:37   Re: [DOD:s]fix [DoDS] Class Restrictions for individual players..
Reply With Quote #6

Hard to say, plugin look event what happens after player chose class, then plugin prevent this by sending fakeclient command to join back old class.

When player join server, default class is 1 (assault), so block maybe not work on that class 100%

And maybe game not accecpt everytime multiple client commands in single frame.


So, instead fixing that plugin, I have start looking in game functions.
Code:
bool CDODGameRules::CanPlayerJoinClass( CDODPlayer *pPlayer, int cls )
void CDODGameRules::ChooseRandomClass( CDODPlayer *pPlayer )
I need still build menu and kv file.

*edit
Also, server can send to client ConVar value (mp_limit_axis_rifleman 0). This will show on client screen in class menu that class is full/limited, but it not prevent player to choose it though.
But it is nice indicator.
__________________
Do not Private Message @me

Last edited by Bacardi; 12-16-2022 at 07:00.
Bacardi is offline
mewbie222
Senior Member
Join Date: May 2018
Old 12-16-2022 , 08:45   Re: [DOD:s]fix [DoDS] Class Restrictions for individual players..
Reply With Quote #7

Quote:
Originally Posted by Bacardi View Post
*edit
Also, server can send to client ConVar value (mp_limit_axis_rifleman 0). This will show on client screen in class menu that class is full/limited, but it not prevent player to choose it though.
But it is nice indicator.
By the way, yes, there was such a thought, but I still don’t know how to implement it. Yes, and programming, as it were, a noob = I’m learning .. Some more things were done for me ..
And so I had 3 versions of execution or rewrite this code using SDHook, but I don’t know how everything will be in this regard., if I wrote about it in the first message
Quote:
Is it possible to add a ban on weapons, at the SDKHook level, as I understand it, this should be used:
SDKHook_WeaponEquip, SDKHook_WeaponCanUse or ...
But either during the game, check the class from which it plays and stupidly select ...
and 3 play around with it
Quote:
HookEvent("player_changeclass", ChangeClassEvent, EventHookMode_Pre)
For example, not _Pre but _Post, that is, after checking ..or generally remove this EventHookMode_Pre additional parameter.
ps I hope I spelled it out clearly
mewbie222 is offline
mewbie222
Senior Member
Join Date: May 2018
Old 12-22-2022 , 05:27   Re: [DOD:s]fix [DoDS] Class Restrictions for individual players..
Reply With Quote #8

Bacardi, I thought I decided to try using SDKHook_WeaponCanUse , it seems like it should work when changing (player_changeclass) ..A little later I'll post the finished code, as I can write on the joint venture, all of a sudden where the error will be.
and event player_shoot , to try, at least as it does not allow playing with a forbidden class..
mewbie222 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 12-22-2022 , 05:34   Re: [DOD:s]fix [DoDS] Class Restrictions for individual players..
Reply With Quote #9

ok, try that.

I have build class restriction, but I struggle to make good menu options.
After that I add that SDKHook weapon can use check also.

If I get this plugin done, I release whole in here this topic.
__________________
Do not Private Message @me
Bacardi is offline
mewbie222
Senior Member
Join Date: May 2018
Old 12-22-2022 , 09:22   Re: [DOD:s]fix [DoDS] Class Restrictions for individual players..
Reply With Quote #10

Bacardiok, Ok, otherwise, to be honest, from me the writer on the joint venture is still%)))
But I’m also trying to do something and somehow, either redo it or write it .. But so far everything turns out crooked. Let’s just say it’s wrong according to the rules of scripting .. At least in this way, I’ll be able to do something to remake it under DODs, otherwise they completely forgot it, even insulting. ..

Last edited by mewbie222; 12-22-2022 at 09:31.
mewbie222 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:52.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode