AlliedModders Donor
|
04-28-2018
, 04:53
Re: Plugin to All Spec Admin
|
#5
|
Quote:
Originally Posted by Mitchell
or use sendproxy to fake their team to spectate.
|
Can you add example, please?
UPDATE for my plugin
Code:
#include <sourcemod>
#include <cstrike>
new teamplayer[MAXPLAYERS+1];
public Plugin myinfo =
{
name = "Free look for admin",
author = "-_-",
description = "",
version = "1.0",
url = ""
};
public OnPluginStart()
{
HookEvent("player_death", PlayerDeath, EventHookMode_Post);
HookEvent("round_end", RoundEnd, EventHookMode_PostNoCopy);
HookEvent("player_team", PlayerTeam, EventHookMode_Pre);
}
stock HasFlag(client, AdminFlag:flag)
{
new AdminId:admin = GetUserAdmin(client);
if((admin != INVALID_ADMIN_ID) && (GetAdminFlag(admin, flag, Access_Effective) == true))
{
return true;
}
return false;
}
public OnClientDisconnect(id)
{
if(IsClientInGame(id))
{
teamplayer[id] = 0;
}
}
public OnClientPutInServer(client)
{
if(0 < client <= MaxClients)
{
teamplayer[client] = 0;
}
}
public Action:PlayerTeam(Handle:event, const String:name[], bool:dontBroadcast)
{
SetEventBroadcast(event, true);
return Plugin_Continue;
}
public PlayerDeath(Handle:event, const String:EventName[], bool:nobroadcast)
{
new id = GetClientOfUserId(GetEventInt(event, "userid"));
if(!(0 < id <=MaxClients))
return;
if(!IsClientInGame(id))
return;
if(!HasFlag(id, Admin_Ban))
return;
teamplayer[id] = GetClientTeam(id);
CreateTimer(3.0, freelook, id, TIMER_FLAG_NO_MAPCHANGE);
}
public RoundEnd(Handle:event, const String:name[], bool:dnt)
{
for(new id=1; id<=MaxClients; id++)
{
if(!IsClientInGame(id))
continue;
if(GetClientTeam(id) == 1 && teamplayer[id] > 1)
{
ChangeClientTeam(id, teamplayer[id]);
}
}
}
public Action:freelook(Handle:timer, any:id)
{
if(!IsClientInGame(id))
return;
if(IsPlayerAlive(id))
return;
if(!HasFlag(id, Admin_Ban))
return;
ChangeClientTeam(id, CS_TEAM_SPECTATOR);
}
or
Code:
#include <sourcemod>
#include <cstrike>
new teamplayer[MAXPLAYERS+1];
public Plugin myinfo =
{
name = "Free look for admin",
author = "-_-",
description = "",
version = "1.0",
url = "https://forum.cs-classic.pl/"
};
public OnPluginStart()
{
HookEvent("player_death", PlayerDeath, EventHookMode_Post);
//HookEvent("round_end", RoundEnd, EventHookMode_PostNoCopy);
HookEvent("round_end", RoundEnd, EventHookMode_Pre);
//HookEvent("player_team", PlayerTeam, EventHookMode_Pre);
}
stock HasFlag(client, AdminFlag:flag)
{
new AdminId:admin = GetUserAdmin(client);
if((admin != INVALID_ADMIN_ID) && (GetAdminFlag(admin, flag, Access_Effective) == true))
{
return true;
}
return false;
}
public OnClientDisconnect(id)
{
if(IsClientInGame(id))
{
teamplayer[id] = 0;
}
}
public OnClientPutInServer(client)
{
if(0 < client <= MaxClients)
{
teamplayer[client] = 0;
}
}
public Action:PlayerTeam(Handle:event, const String:name[], bool:dontBroadcast)
{
SetEventBroadcast(event, true);
return Plugin_Continue;
}
public PlayerDeath(Handle:event, const String:EventName[], bool:nobroadcast)
{
new id = GetClientOfUserId(GetEventInt(event, "userid"));
if(!(0 < id <=MaxClients))
return;
if(!IsClientInGame(id))
return;
if(!HasFlag(id, Admin_Ban))
return;
teamplayer[id] = GetClientTeam(id);
CreateTimer(3.0, freelook, id, TIMER_FLAG_NO_MAPCHANGE);
}
public RoundEnd(Handle:event, const String:name[], bool:dnt)
{
for(new id=1; id<=MaxClients; id++)
{
if(!IsClientInGame(id))
continue;
if(GetClientTeam(id) == 1 && teamplayer[id] > 1)
{
//ChangeClientTeam(id, teamplayer[id]);
SetEntProp(id, Prop_Send, "m_iTeamNum", teamplayer[id]);
}
}
}
public Action:freelook(Handle:timer, any:id)
{
if(!IsClientInGame(id))
return;
if(IsPlayerAlive(id))
return;
if(!HasFlag(id, Admin_Ban))
return;
//ChangeClientTeam(id, CS_TEAM_SPECTATOR);
SetEntProp(id, Prop_Send, "m_iTeamNum", CS_TEAM_SPECTATOR);
}
Last edited by Qes; 04-29-2018 at 06:24.
|
|