|
Senior Member
|
10-15-2016
, 09:07
Re: [Request] Lock Team for CS:GO
|
#7
|
Quote:
Originally Posted by Bacardi
Use AddCommandListener to jointeam, don't create new sm command.
|
thanks for respond
i found new useful plugin in here
https://forums.alliedmods.net/showth...20#post2279220
and the problem of this plugin is it locks team BUT YOU CANT UNDO IT ! i change the value of sm_lock_teams but it doesn't effect the game
anyway i dont know how to program in sm but i create one so can you check what is wrong in the source code or mine ?
note: my code is just like source but i tried to create another admin command to change the status of sm_lock_teams variable , when i enter sm_lockteams nothing will happen
PHP Code:
#pragma semicolon 1 #include <sourcemod> #define PLUGIN_VERSION "1.0"
new Handle:g_hLocked = INVALID_HANDLE;
public OnPluginStart() { AddCommandListener(Command_JoinTeam, "jointeam"); g_hLocked = CreateConVar("sm_lock_teams", "1", "Enable or disable locking teams during match", FCVAR_NOTIFY); RegAdminCmd("sm_lockteams", CMD_LOCK, ADMFLAG_ROOT, "Lock join teams"); }
public Action:Command_JoinTeam(client, const String:command[], args) { if (client != 0) { if(IsClientInGame(client) && !IsFakeClient(client)) { if (GetClientTeam(client) > 1 && GetConVarBool(g_hLocked)) { PrintToChat(client, "\x01 \x07[SM] Change team is locked by admin!"); return Plugin_Stop; } } }
return Plugin_Continue; }
public Action: CMD_LOCK(client, args) { if(!IsClientValid(client) || !IsClientInGame(client)) { return Plugin_Handled; } if(args != 1) { ReplyToCommand(client, "%t", "CMD_Extend_Usage"); return Plugin_Handled; } if (GetConVarBool(g_hLocked)){ SetConVarInt(g_hLocked, 0); PrintToChat(client, "\x01 \x07[SM] Change team is opened by admin");
}else{ SetConVarInt(g_hLocked, 1); PrintToChat(client, "\x01 \x07[SM] Change team is closed by admin");
} return Plugin_Handled; }
bool: IsClientValid(client) { return ((client > 0) && (client <= MaxClients)); }
Last edited by arcticx2; 10-15-2016 at 09:09.
Reason: add note
|
|
|
|