Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- #include <cstrike>
- #pragma semicolon 1
- #pragma newdecls required
- bool team_vybran[MAXPLAYERS + 1] = {false,...};
- stock bool IsValidClient(int client, bool alive = false)
- {
- if(0 < client && client <= MaxClients && IsClientInGame(client) && (alive == false || IsPlayerAlive(client)))//IsFakeClient(client) == false
- return true;
- return false;
- }
- public Plugin myinfo =
- {
- name = "Team Re-Kill",
- author = "GamerX",
- description = "...",
- version = "1.0.0",
- url = "http://steamcommunity.com/id/gamerxcz/"
- }
- public void OnPluginStart()
- {
- AddCommandListener(Command_JoinTeam, "jointeam");
- }
- public void OnClientConnected(int client)
- {
- team_vybran[client] = false;
- }
- public void OnClientDisconnect(int client)
- {
- team_vybran[client] = false;
- }
- public Action Command_JoinTeam(int client, const char[] command, any argc)
- {
- if(!argc || !IsValidClient(client) || team_vybran[client])
- return Plugin_Continue;
- char m_szTeam[8];
- GetCmdArg(1, m_szTeam, sizeof(m_szTeam));
- int m_iTeam = StringToInt(m_szTeam);
- team_vybran[client] = true;
- if(CS_TEAM_SPECTATOR <= m_iTeam <= CS_TEAM_CT)
- CreateTimer(0.2, Timer_SpawnPost, client);
- return Plugin_Continue;
- }
- public Action Timer_SpawnPost(Handle timer, any client)
- {
- if(IsValidClient(client, true))
- {
- ForcePlayerSuicide(client);
- CreateTimer(0.2, Timer_Respawn, client);
- }
- else if(IsValidClient(client))
- CreateTimer(0.2, Timer_Respawn, client);
- }
- public Action Timer_Respawn(Handle timer, any client)
- {
- CS_RespawnPlayer(client);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement