I decided to do it like this for now, check how it will be, but it confused me at the end
return Plugin_Continue , whether there will be an error again ...
PHP Code:
HookEvent("player_changeclass", ChangeClassEvent) //// removed EventHookMode_Pre
....
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])
return Plugin_Handled
//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
}
I tried the code above, they said they take the blocked class without problems .. In General, you need to think, otherwise I want to finish the old code ...
add
PHP Code:
else
{
g_PreviousClass[client] = class
}
By the way, I don’t like this piece of code, because as I was told, the lock on the blocked class works 1 time, and 2 times they take the blocked class without problems ..
That is, they chose a blocked class, the blocking worked for them, then, if I understood correctly, the blocked class became the previous one, and they can easily choose this class ..
Well, as I understand it, I can be wrong .. Maybe this is the whole problem?!!!