Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.56 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3. #include <cstrike>
  4.  
  5. #pragma semicolon 1
  6. #pragma newdecls required
  7.  
  8. bool team_vybran[MAXPLAYERS + 1] = {false,...};
  9.  
  10. stock bool IsValidClient(int client, bool alive = false)
  11. {
  12.     if(0 < client && client <= MaxClients && IsClientInGame(client) && (alive == false || IsPlayerAlive(client)))//IsFakeClient(client) == false
  13.         return true;
  14.     return false;
  15. }
  16. public Plugin myinfo =
  17. {
  18.     name = "Team Re-Kill",
  19.     author = "GamerX",
  20.     description = "...",
  21.     version = "1.0.0",
  22.     url = "http://steamcommunity.com/id/gamerxcz/"
  23. }
  24. public void OnPluginStart()
  25. {
  26.     AddCommandListener(Command_JoinTeam, "jointeam");
  27. }
  28. public void OnClientConnected(int client)
  29. {
  30.     team_vybran[client] = false;
  31. }
  32. public void OnClientDisconnect(int client)
  33. {
  34.     team_vybran[client] = false;
  35. }
  36. public Action Command_JoinTeam(int client, const char[] command, any argc)
  37. {
  38.     if(!argc || !IsValidClient(client) || team_vybran[client])
  39.         return Plugin_Continue;
  40.  
  41.     char m_szTeam[8];
  42.     GetCmdArg(1, m_szTeam, sizeof(m_szTeam));
  43.     int m_iTeam = StringToInt(m_szTeam);
  44.     team_vybran[client] = true;
  45.     if(CS_TEAM_SPECTATOR <= m_iTeam <= CS_TEAM_CT)
  46.         CreateTimer(0.2, Timer_SpawnPost, client);
  47.     return Plugin_Continue;
  48. }
  49. public Action Timer_SpawnPost(Handle timer, any client)
  50. {
  51.     if(IsValidClient(client, true))
  52.     {
  53.         ForcePlayerSuicide(client);
  54.         CreateTimer(0.2, Timer_Respawn, client);
  55.     }
  56.     else if(IsValidClient(client))
  57.         CreateTimer(0.2, Timer_Respawn, client);
  58. }
  59. public Action Timer_Respawn(Handle timer, any client)
  60. {
  61.     CS_RespawnPlayer(client);
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement