AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [DOD:s]fix [DoDS] Class Restrictions for individual players.. (https://forums.alliedmods.net/showthread.php?t=340853)

mewbie222 12-14-2022 13:16

[DOD:s]fix [DoDS] Class Restrictions for individual players..
 
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 (Post 2752529)
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 ..

Bacardi 12-14-2022 19:29

Re: [DOD:s]fix [DoDS] Class Restrictions for individual players..
 
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 


mewbie222 12-15-2022 01:56

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

Originally Posted by Bacardi (Post 2795216)
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
}

Bacardi 12-15-2022 04:20

Re: [DOD:s]fix [DoDS] Class Restrictions for individual players..
 
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

mewbie222 12-15-2022 05:36

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

Originally Posted by Bacardi (Post 2795246)
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.

Bacardi 12-16-2022 05:37

Re: [DOD:s]fix [DoDS] Class Restrictions for individual players..
 
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.

mewbie222 12-16-2022 08:45

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

Originally Posted by Bacardi (Post 2795367)
*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 12-22-2022 05:27

Re: [DOD:s]fix [DoDS] Class Restrictions for individual players..
 
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..

Bacardi 12-22-2022 05:34

Re: [DOD:s]fix [DoDS] Class Restrictions for individual players..
 
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 :crab: in here this topic.

mewbie222 12-22-2022 09:22

Re: [DOD:s]fix [DoDS] Class Restrictions for individual players..
 
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. ..


All times are GMT -4. The time now is 17:08.

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