Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <cstrike>
  3. #include <hamsandwich>
  4. #include <fakemeta_util>
  5.  
  6. #define PLUGIN "RESPAWN"
  7. #define VERSION "0.1b"
  8. #define AUTHOR "amx-x.ru DEV-team"
  9.  
  10. public plugin_init() {
  11. register_plugin(PLUGIN, VERSION, AUTHOR)
  12.  
  13. RegisterHam(Ham_Spawn, "player", "SPAWN_POST", 1)
  14. register_event("DeathMsg", "EVENT_Death", "a")
  15.  
  16. register_clcmd("say /respawn", "TASK_RESPAWNN")
  17. register_clcmd("say_team /respawn", "TASK_RESPAWNN")
  18. }
  19.  
  20. public client_putinserver(id)
  21. set_task(5.0, "TASK_RESPAWN", id)
  22.  
  23. public SPAWN_POST(id) {
  24. if(is_user_connected(id) && is_user_alive(id) && get_user_team(id) != 3) {
  25. new Item[256],
  26. ItemLen = charsmax(Item)
  27. formatex(Item, ItemLen, "%s", get_user_team(id) == 1 ? "weapon_glock18" : "weapon_usp")
  28. fm_give_item(id, Item)
  29. fm_give_item(id, "weapon_knife")
  30. cs_set_user_bpammo(id, CSW_USP, 90)
  31. cs_set_user_bpammo(id, CSW_GLOCK18, 90)
  32. }
  33. }
  34.  
  35. public EVENT_Death() {
  36. new Killer = read_data(1),
  37. Victim = read_data(2)
  38. if(is_user_connected(Killer) && is_user_connected(Victim))
  39. set_task(1.0, "TASK_RESPAWN", Victim)
  40. }
  41.  
  42. public TASK_RESPAWNN(id) {
  43. if(is_user_connected(id))
  44. ExecuteHamB(Ham_CS_RoundRespawn,id);
  45. }
  46.  
  47. public TASK_RESPAWN(id) {
  48. if(is_user_connected(id) && !is_user_alive(id)) {
  49. if(get_user_team(id) == 3) {
  50. switch(random_num(1,2)) {
  51. case 1:
  52. cs_set_user_team(id, CS_TEAM_T)
  53. case 2:
  54. cs_set_user_team(id, CS_TEAM_CT)
  55. }
  56. }
  57. ExecuteHamB(Ham_CS_RoundRespawn,id);
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement