Code
#include <sdktools>
#include <sourcemod>
#include cstrike
// gPlaySpawn[userid] = Toggle!
new cl_buttons;
new g_maxplayers;
new USE_BUTTON = IN_USE;
new notification_number;
new can_respawn;
new Handle:DeathTimers[64];
new Handle:ChatTimer[64];
new Float:g_PlayerSpawn[64];
static Handle:timer = INVALID_HANDLE;
public OnPluginStart()
{
new fds;
for (fds=1 ; fds <= 63 ; fds++){
g_PlayerSpawn[fds] = 0.0
}
CreateTimer( 60.0 , PrintRespAd, _, TIMER_REPEAT);
can_respawn = 1;
g_maxplayers = GetMaxClients();
HookEvent("player_death",Event_PlayerDeath);
HookEvent("round_start", on_round_start);
HookEvent("player_say", Event_PlayerSay);
}
public Action:PrintRespAd(Handle:timer)
{
PrintToChatAll("\x07FFFFFF[HolyRespawn] \x05This server has Holy Respawn!");
}
public on_round_start(Handle:event, const String:name[], bool:dontBroadcast) {
can_respawn = 1;
if (timer != INVALID_HANDLE)
CloseHandle(timer);
new Float:length = GetConVarFloat(FindConVar("mp_roundtime")) * 60.0 - 6.0;
LogMessage("End round in %f seconds", length);
notification_number = 5;
timer = CreateTimer(length, on_round_time_end);
}
public OnClientPutInServer(client)
{
g_maxplayers = GetMaxClients();
g_PlayerSpawn[client] = 0.0
}
public OnClientDisconnect(client){
g_maxplayers = GetMaxClients();
if(DeathTimers[client] != INVALID_HANDLE)
{
KillTimer(DeathTimers[client])
DeathTimers[client] = INVALID_HANDLE
}
}
public OnGameFrame(){
new x;
for (x=1; x <= g_maxplayers; x++){
new clt = GetClientOfUserId(x)
if (IsClientInGame(x) && GetClientTeam(clt) != 1 && GetClientTeam(clt) != 0 && can_respawn == 1 && !IsPlayerAlive(x)){
PrintToChatAll("Yes he is!");
cl_buttons = GetClientButtons(clt)
if(cl_buttons & USE_BUTTON){
CS_RespawnPlayer(x);
}
}
}
}
public Action:on_round_time_end(Handle:timer_) {
if (notification_number > 0) {
timer = CreateTimer(1.0, on_round_time_end);
--notification_number;
}
else {
can_respawn = 0;
timer = INVALID_HANDLE;
PrintToChatAll("\x07FFFFFF[HolyRespawn] \x05The timer has hit \x07e100000:00\x05. You will stop respawning.");
}
}
public Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast){
new client = GetClientOfUserId(GetEventInt(event,"userid"));
if (can_respawn == 1) {
if(g_PlayerSpawn[GetEventInt(event,"userid")] == 1.0){
PrintToChat(client,"\x07FFFFFF[HolyRespawn] \x05Press \x07e10000E \x05or your \x07e10000USE KEY \x05to respawn.");
}
if(g_PlayerSpawn[GetEventInt(event,"userid")] == 0 && GetClientTeam(GetEventInt(event,"userid")) != 1 )
{
PrintToChat(client,"\x07FFFFFF[HolyRespawn] \x05You will respawn in\x07e10000 [\x07FFFFFF1\x07e10000] \x05seconds.");
DeathTimers[client] = CreateTimer(4.0, AfterDeathLife, client);
}
}
else{
PrintToChatAll("\x07FFFFFF[HolyRespawn] \x05The timer has reached \x07e100000:00 \x05& you are unable to respawn.");
}
}
public Action:AfterDeathLife(Handle:timerx, any:client)
{
CS_RespawnPlayer(client);
}
Код давно давали. На E воскрешаться. Я не знаю может сможешь это переделать под себя.