inital commit
This commit is contained in:
138
autorespawn_for_admins_css.sp
Normal file
138
autorespawn_for_admins_css.sp
Normal file
@@ -0,0 +1,138 @@
|
||||
/* Plugin Template generated by Pawn Studio */
|
||||
|
||||
#include <sourcemod>
|
||||
#include <clients>
|
||||
#include <cstrike>
|
||||
#include <sdktools_functions>
|
||||
|
||||
#define AFA_VERSION "1.5.5"
|
||||
|
||||
new bool:temp_disabled = false
|
||||
new Handle:h_enabled, Handle:h_time, Handle:h_admins_only;
|
||||
new Float:client_orgin[MAXPLAYERS][3];
|
||||
new Float:client_angels[MAXPLAYERS][3];
|
||||
new Handle:h_teleport_enabled, Handle:h_flag;
|
||||
new AdminFlag:cflag;
|
||||
|
||||
public Plugin:myinfo =
|
||||
{
|
||||
name = "Autorespawn for Admins",
|
||||
author = "Chefe",
|
||||
description = "Respawn(&Teleport) Admins/Players in a varaible amount of time.",
|
||||
version = AFA_VERSION,
|
||||
url = "http://forums.alliedmods.net/showthread.php?t=110918"
|
||||
}
|
||||
|
||||
public OnPluginStart()
|
||||
{
|
||||
HookEvent("player_death", Event_PlayerDeath)
|
||||
HookEvent("player_class", Event_PlayerClass);
|
||||
HookEvent("player_team", Event_PlayerTeam);
|
||||
h_enabled = CreateConVar("sm_instant_enabled", "1", "Enable or Disable Instant Respawn for Admins.");
|
||||
h_time = CreateConVar("sm_instant_time", "0.1", "Set the Instant Respawn Time.", _, true, 0.1);
|
||||
h_admins_only = CreateConVar("sm_instant_admins_only", "1", "Set is instant respawn only enabled for admins or for all.");
|
||||
h_teleport_enabled = CreateConVar("sm_instant_teleport", "0", "Enable or Disable teleport Player to ther old Position");
|
||||
h_flag = CreateConVar("sm_instant_flag", "t", "Set the flag witch admins must have to use instant respawn.");
|
||||
CreateConVar("sm_instant_version", AFA_VERSION, "Autorespawn Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);
|
||||
|
||||
AutoExecConfig(true);
|
||||
|
||||
new String:flagcvar[1];
|
||||
GetConVarString(h_flag, flagcvar, sizeof(flagcvar));
|
||||
FindFlagByChar(flagcvar[0], cflag);
|
||||
}
|
||||
|
||||
public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
|
||||
{
|
||||
new client_userid = GetEventInt(event, "userid");
|
||||
new client = GetClientOfUserId(client_userid);
|
||||
|
||||
new AdminId:admin_id = GetUserAdmin(client);
|
||||
|
||||
if (GetConVarBool(h_teleport_enabled))
|
||||
{
|
||||
GetClientAbsOrigin(client, client_orgin[client]);
|
||||
GetClientAbsAngles(client, client_angels[client]);
|
||||
}
|
||||
|
||||
new Float:time = GetConVarFloat(h_time);
|
||||
|
||||
if (GetConVarBool(h_admins_only))
|
||||
{
|
||||
if (admin_id != INVALID_ADMIN_ID && IsClientInGame(client) && GetConVarBool(h_enabled) && !temp_disabled && GetAdminFlag(admin_id, cflag, AdmAccessMode:Access_Effective))
|
||||
{
|
||||
CreateTimer(time, RespawnClient, client)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsClientInGame(client) && GetConVarBool(h_enabled) && !temp_disabled)
|
||||
{
|
||||
CreateTimer(time, RespawnClient, client)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Event_PlayerClass(Handle:event, const String:name[], bool:dontBroadcast)
|
||||
{
|
||||
new client_userid = GetEventInt(event, "userid");
|
||||
new client = GetClientOfUserId(client_userid);
|
||||
//new team = GetEventInt(event, "team");
|
||||
|
||||
new AdminId:admin_id = GetUserAdmin(client);
|
||||
|
||||
new Float:time = GetConVarFloat(h_time);
|
||||
|
||||
if (GetConVarBool(h_admins_only))
|
||||
{
|
||||
if (admin_id != INVALID_ADMIN_ID && IsClientInGame(client) && GetConVarBool(h_enabled) && !temp_disabled && GetAdminFlag(admin_id, cflag, AdmAccessMode:Access_Effective))
|
||||
{
|
||||
CreateTimer(time, RespawnClient, client)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsClientInGame(client) && GetConVarBool(h_enabled) && !temp_disabled)
|
||||
{
|
||||
CreateTimer(time, RespawnClient, client)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Event_PlayerTeam(Handle:event, const String:name[], bool:dontBroadcast)
|
||||
{
|
||||
new client_userid = GetEventInt(event, "userid");
|
||||
new client = GetClientOfUserId(client_userid);
|
||||
new team = GetEventInt(event, "team");
|
||||
|
||||
new AdminId:admin_id = GetUserAdmin(client);
|
||||
|
||||
new Float:time = GetConVarFloat(h_time);
|
||||
|
||||
if (GetConVarBool(h_admins_only))
|
||||
{
|
||||
if (team > 0 && admin_id != INVALID_ADMIN_ID && IsClientInGame(client) && GetConVarBool(h_enabled) && !temp_disabled && GetAdminFlag(admin_id, cflag, AdmAccessMode:Access_Effective))
|
||||
{
|
||||
CreateTimer(time, RespawnClient, client)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (team > 0 && IsClientInGame(client) && GetConVarBool(h_enabled) && !temp_disabled)
|
||||
{
|
||||
CreateTimer(time, RespawnClient, client)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Action:RespawnClient(Handle:timer, any:client)
|
||||
{
|
||||
if (IsClientInGame(client))
|
||||
{
|
||||
CS_RespawnPlayer(client);
|
||||
if (GetConVarBool(h_teleport_enabled))
|
||||
{
|
||||
TeleportEntity(client, client_orgin[client], client_angels[client], NULL_VECTOR);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user