P1xeL

Heb Zm

Jul 3rd, 2012
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 58.97 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <sqlx>
  4. #include <cstrike>
  5. #include <hamsandwich>
  6. #include <zombieplague>
  7. #include <fun>
  8.  
  9. #pragma dynamic 32768
  10.  
  11. #define is_valid_player(%1) (1 <= %1 <= 32)
  12.  
  13. new Handle:g_SqlTuple
  14.  
  15. // Register System
  16. new bool:g_LoggedIn[33]
  17. new g_RegisterSelection[33]
  18.  
  19. new g_szTempName[33][100]
  20. new g_szTempPassWord[33][100]
  21.  
  22. // Stats System ( Points )
  23. new g_RankTempID
  24. new g_Top10TempID
  25.  
  26. new g_TotalPoints[33]
  27.  
  28. new g_HumanKillsZombiePoints[33]
  29. new g_HumanKillsNemesisPoints[33]
  30. new g_SurvivorKillsZombiePoints[33]
  31. new g_HumanKillsZombieKnifePoints[33]
  32.  
  33. new g_ZombieInfectsHumanPoints[33]
  34. new g_NemesisKillsHuman[33]
  35. new g_ZombieKillsSurvivor[33]
  36. new g_ZombieKillsHumanPS[33]
  37.  
  38. new g_AP[33]
  39. new g_DonateID[33]
  40.  
  41. // Achievements
  42. new g_Minutes[33]
  43. new g_ZombieKillCount1[33]
  44. new g_ZombieKillCount2[33]
  45. new g_ZombieKillCount3[33]
  46. new g_ZombieHSKillCount[33]
  47. new g_Rounds[33]
  48. new g_KillInfectCount1[33]
  49. new g_KillInfectCount2[33]
  50. new g_KillInfectCount3[33]
  51. new g_gotKillInfectCount[33]
  52. new g_nemeKillCountKnife[33]
  53. new g_killzombieknife[33]
  54. new g_winsurvivor[33]
  55. new g_winnemesis[33]
  56. new g_killsurvivorplague[33]
  57. new g_killnemesisplague[33]
  58. new g_kill600survivor[33]
  59. new g_kill600nemesis[33]
  60. new g_InfectionBombCount[33]
  61. new g_SprayCount[33]
  62. new g_awpkills[33]
  63. new g_infectinrowcount1[33]
  64. new g_infectinrowcount2[33]
  65. new g_zmkillrowcount1[33]
  66. new g_zmkillrowcount2[33]
  67. new g_lasthumankillall[33]
  68.  
  69. // Cvars
  70. new cvHost, cvUserName, cvPassWord, cvDbName
  71.  
  72. public plugin_init()
  73. {
  74.     register_plugin("zp_rabs by mottzi","2.1","mottzi")
  75.    
  76.     cvHost = register_cvar("zp_rabs_sql_host", "")
  77.     cvUserName = register_cvar("zp_rabs_sql_username", "")
  78.     cvPassWord = register_cvar("zp_rabs_sql_password", "")
  79.     cvDbName = register_cvar("zp_rabs_sql_database", "")
  80.    
  81.     makeTuple()
  82.    
  83.     register_clcmd("say /login", "menuRegister")
  84.    
  85.     register_clcmd("jointeam", "menuRegister")
  86.     register_event("TeamInfo", "joinTeamOldMenu", "a")
  87.    
  88.     register_clcmd("say /top10", "cmdTop10")
  89.     register_clcmd("say /rank", "cmdRank")
  90.     register_clcmd("say /zmtop10", "cmdTop10")
  91.     register_clcmd("say /zmrank", "cmdRank")
  92.    
  93.     register_clcmd("say /statistics", "menuStats")
  94.     register_clcmd("say /stats", "menuStats")
  95.    
  96.     register_clcmd("say /achievements", "menuAchvs")
  97.     register_clcmd("say /achvs", "menuAchvs")
  98.     register_clcmd("say /achv", "menuAchvs")
  99.    
  100.     register_clcmd("Username", "cmdUsername")
  101.     register_clcmd("szPassword", "cmdPw")
  102.    
  103.     register_clcmd("takeAmount", "cmdTakeAmount")
  104.     register_clcmd("saveAmount", "cmdSaveAmount")
  105.     register_clcmd("donate", "cmdDonate")
  106.    
  107.     register_clcmd("say /bank", "menuBank")
  108.     register_clcmd("say_team /bank", "menuBank")
  109.    
  110.     register_event("DeathMsg", "DeathMsg", "a")
  111.     register_event("23", "cmdNewSpray", "a", "1=112")
  112.    
  113.     RegisterHam( Ham_Item_AddToPlayer, "weapon_hegrenade", "AddGrenadeToPlayer" );
  114.    
  115.     createTable()
  116.    
  117.     register_logevent("cmdRoundStart", 2, "1=Round_Start")
  118.    
  119.     set_task(60.0, "increaseMinutes", .flags="b")
  120.     set_task(120.0, "cmdHelpCommands", .flags="b")
  121.     set_task(150.0, "cmdHelpCommands2", .flags="b")
  122. }
  123.  
  124. public makeTuple()
  125. {
  126.     new Host[100], UserName[20], PassWord[20], DbName[100]
  127.    
  128.     get_pcvar_string(cvHost, Host, 99)
  129.     get_pcvar_string(cvUserName, UserName, 19)
  130.     get_pcvar_string(cvPassWord, PassWord, 19)
  131.     get_pcvar_string(cvDbName, DbName, 99)
  132.    
  133.     g_SqlTuple = SQL_MakeDbTuple(Host, UserName, PassWord, DbName)
  134. }
  135.  
  136. public cmdHelpCommands()
  137. {
  138.     client_print(0, print_chat, ".קנבה תא חותפל ידכ '/bank' וא 'למשנ.' םושרת ]ויגלפ יבמוז[")
  139.     client_print(0, print_chat, ".םיגשיהה טירפת חותפל ידכ '/achvs' וא 'סהיבש.' םושרת ]ויגלפ יבמוז[")
  140.     client_print(0, print_chat, ".הקיטסיטטסה תא חותפל ידכ '/stats' וא 'דאשאד.' םושרת ]ויגלפ יבמוז[")
  141. }
  142.  
  143. public cmdHelpCommands2()
  144. {
  145.     client_print(0, print_chat, ".םיליבומה 10 תא תוארל ידכ '/zmtop10' וא '01פםאצז.' םושרת ]ויגלפ יבמוז[")
  146.     client_print(0, print_chat, ".ךלש םוקימה תא תוארל ידכ '/zmrank' וא 'למשרצז.' םושרת ]ויגלפ יבמוז[")
  147.     client_print(0, print_chat, "'MaRs'. ידי לע םגרותו 'Mottzi' ידי לע הנבנ המשרהו פוט+קנב+םילגשיהה לש דומה ]ויגלפ יבמוז[")
  148. }
  149.  
  150. public joinTeamOldMenu()
  151. {
  152.     new id = read_data(1)
  153.     new user_team[32]
  154.    
  155.     read_data(2, user_team, 31)    
  156.    
  157.     if(!is_user_connected(id))
  158.         return PLUGIN_HANDLED  
  159.    
  160.     if(g_LoggedIn[id])
  161.         return PLUGIN_HANDLED
  162.    
  163.     switch(user_team[0])
  164.     {
  165.         case 'C':  
  166.         {
  167.             menuRegister(id)
  168.         }
  169.         case 'T':
  170.         {
  171.             menuRegister(id)
  172.         }
  173.     }
  174.    
  175.     return PLUGIN_HANDLED
  176. }
  177.  
  178. public AddGrenadeToPlayer( iEnt, id )
  179. {
  180.     if(is_user_connected(id) && zp_get_user_zombie(id))
  181.     {
  182.         g_InfectionBombCount[id]++
  183.        
  184.         if(g_InfectionBombCount[id] == 300)
  185.         {
  186.             client_print(id, print_chat, "'רבמוב' תא התחתפ התא ]םיגשיה[")
  187.         }
  188.     }
  189. }
  190.  
  191. public cmdNewSpray()
  192. {
  193.     new sprayid = read_data(2)  // Spray Owner
  194.    
  195.     g_SprayCount[sprayid]++
  196.    
  197.     if(g_SprayCount[sprayid] == 300)
  198.     {
  199.         client_print(sprayid, print_chat, "'ברק תונמוא' תא התחתפ התא ]םיגשיה[")
  200.     }
  201. }
  202.  
  203. public menuAchvs(id)
  204. {
  205.     new achvsMenu = menu_create("Achievements", "menuAchvsHandler")
  206.     new szTitle[100]
  207.    
  208.     // 1
  209.     if(g_Minutes[id] >= 600)
  210.         formatex(szTitle, 99, "<3^n.תרשב ללוכ ןמזב תוקד 600 ךשמב קחש  \r(חתפנ)^n")
  211.     else
  212.         formatex(szTitle, 99, "^nשחק במשך 600 דקות (\y דקות \r%i)\y ^n<3", g_Minutes[id])
  213.    
  214.     menu_additem(achvsMenu, szTitle, "1")
  215.    
  216.     // 2
  217.     if(g_ZombieHSKillCount[id] >= 600)
  218.         formatex(szTitle, 99, "!טוש-דאה !םוב^n w\.טוש-דאה םע סיסמנ וא םיבמוז 600 גורהת r\(חתפנ)^n")
  219.     else
  220.         formatex(szTitle, 99, "!טוש-דאה !םוב^n \r%i\y( התגרהy\) טוש דאה םע ןיססא וא סיסמנ וא םיבמוז 600 גורהת^n)^n", g_ZombieHSKillCount[id])
  221.    
  222.     menu_additem(achvsMenu, szTitle, "2")
  223.    
  224.     // 3
  225.     if(g_Rounds[id] >= 3000)
  226.         formatex(szTitle, 99, "םירטסקאל^n w\.תרשב התאש ללוכ ןמזב תוקד 3000 קחש r\(חתפנ)^n")
  227.     else
  228.         formatex(szTitle, 99, "םירטסקאל^n \r%i\y( םיבוביסy\) םיבוביסה לכב םיבוביס 3000 קחש^n", g_Rounds[id])
  229.    
  230.     menu_additem(achvsMenu, szTitle, "3")
  231.    
  232.     // 4
  233.     if(g_ZombieKillCount1[id] >= 100)
  234.         formatex(szTitle, 99, "םיתמה םיבמוזה תא ףידע^n w\.םיבמוז 100 גורהת r\(חתפנ)^n")
  235.     else
  236.         formatex(szTitle, 99, "םיתמ םיבמוזה תא ףידע^n \r%i\y( התגרהy\) םיבמוז 100 גורהת^n", g_ZombieKillCount1[id])
  237.    
  238.     menu_additem(achvsMenu, szTitle, "4")
  239.    
  240.     // 5
  241.     if(g_ZombieKillCount2[id] >= 600)
  242.         formatex(szTitle, 99, "םיבמוז חצור^n w\.םיבמוז 600 גורהת r\(חתפנ)^n")
  243.     else
  244.         formatex(szTitle, 99, "םיבמוז חצור^n \r%i\y( התגרהy\) םיבמוז 600 גורהת^n", g_ZombieKillCount2[id])
  245.    
  246.     menu_additem(achvsMenu, szTitle, "5")
  247.    
  248.     // 6
  249.     if(g_ZombieKillCount2[id] >= 600)
  250.         formatex(szTitle, 99, "יעוצקמ םיבמוז חצור^n w\.םיבמוז 1000 גורהת r\(חתפנ)^n")
  251.     else
  252.         formatex(szTitle, 99, "יעוצקמ םיבמוז חצור^n \r%i\y( התגרהy\) םיבמוז 1000 גורהת^n", g_ZombieKillCount3[id])
  253.    
  254.     menu_additem(achvsMenu, szTitle, "6")
  255.    
  256.    
  257.     // 7
  258.     if(g_KillInfectCount1[id] >= 200)
  259.         formatex(szTitle, 99, "...חומ ממממ^n w\.םדא ינב 200 םיבמוזל ךופהת וא גורהת r\(חתפנ)^n")
  260.     else
  261.         formatex(szTitle, 99, "...חומ מממ^n \r%i\y( התמהיז/התגרהy\) םדא ינב 200 םהזת/גורהת^n", g_KillInfectCount1[id])
  262.    
  263.     menu_additem(achvsMenu, szTitle, "7")
  264.    
  265.     // 8
  266.     if(g_KillInfectCount2[id] >= 1200)
  267.         formatex(szTitle, 99, "הלוע סקינופה^n w\.םדא ינב 1200 םיבמוזל ךופהת וא גורהת r\(חתפנ)^n")
  268.     else
  269.         formatex(szTitle, 99, "הלועה סקינופה^n \r%i\y( התמהיז/התגרהy\) םדא ינב 1200 םהזת/גורהת^n", g_KillInfectCount2[id])
  270.    
  271.     menu_additem(achvsMenu, szTitle, "8")
  272.    
  273.     // 9
  274.     if(g_KillInfectCount3[id] >= 2000)
  275.         formatex(szTitle, 99, "םוהיזה^n w\.םדא ינב 2000 םיבמוזל ךופהת וא גורהת r\(חתפנ)^n")
  276.     else
  277.         formatex(szTitle, 99, "םוהיז^n \r%i\y( התמהיז/התגרהy\) םדא ינב 2000 םהזת/גורהת^n", g_KillInfectCount3[id])
  278.    
  279.     menu_additem(achvsMenu, szTitle, "9")
  280.    
  281.     // 10
  282.     if(g_gotKillInfectCount[id] >= 1000)
  283.         formatex(szTitle, 99, "תובטה םע םיביוא^n w\.םימעפ 1000 יבמוזל ךתוא וכפהיש וא גרהת r\(חתפנ)^n")
  284.     else
  285.         formatex(szTitle, 99, "תובטה םע םיביוא^n \r%i\y( התקבדנ/התגרהנy\) םדא ינב 1000 קבדת/גרהת^n", g_gotKillInfectCount[id])
  286.    
  287.     menu_additem(achvsMenu, szTitle, "10")
  288.    
  289.     // 11
  290.     if(g_nemeKillCountKnife[id] >= 10)
  291.         formatex(szTitle, 99, "לזרב לש םיבצע^n w\.ןיכס םע סיסמנ 10 גורהת r\(חתפנ)^n")
  292.     else
  293.         formatex(szTitle, 99, "לזרב יבצע^n \r%i\y( התגרהy\) ןיכס םע סיסמנ 10 גורהת^n", g_nemeKillCountKnife[id])
  294.    
  295.     menu_additem(achvsMenu, szTitle, "11")
  296.    
  297.     // 12
  298.     if(g_killzombieknife[id] >= 200)
  299.         formatex(szTitle, 99, "הדגאה^n w\.ןיכס םע םיבמוז 200 גורהת r\(חתפנ)^n")
  300.     else
  301.         formatex(szTitle, 99, "הדגאה^n \r%i\y( התגרהy\) ןיכס םע םיבמוז 200 גורהת^n", g_killzombieknife[id])
  302.    
  303.     menu_additem(achvsMenu, szTitle, "12")
  304.    
  305.     // 13
  306.     if(g_winsurvivor[id] >= 10)
  307.         formatex(szTitle, 99, "דרושה^n w\.דרושה בוביסב דרושכ םיבוביס 10 חצנת r\(חתפנ)^n")
  308.     else
  309.         formatex(szTitle, 99, "דרושה^n \r%i\y( התחצינy\) דרושה בוביסב דרושכ םימעפ 10 חצנת^n", g_winsurvivor[id])
  310.    
  311.     menu_additem(achvsMenu, szTitle, "13")
  312.    
  313.     // 14
  314.     if(g_winnemesis[id] >= 10)
  315.         formatex(szTitle, 99, "סיסמנה^n w\.סיסמנ בוביסב סיסמנכ םיבוביס 10 חצנת r\(חתפנ)^n")
  316.     else
  317.         formatex(szTitle, 99, "סיסמנ^n \r%i\y( התחצינy\) סיסמנ בוביסב סיסמנכ םימעפ 10 חצנת^n", g_winnemesis[id])
  318.    
  319.     menu_additem(achvsMenu, szTitle, "14")
  320.    
  321.     // 15
  322.     if(g_killsurvivorplague[id] >= 300)
  323.         formatex(szTitle, 99, "ה'גנינ^n w\.ויגלפ דנוארב םידרוש 300 גורהת r\(חתפנ)^n")
  324.     else
  325.         formatex(szTitle, 99, "ה'גנינ^n \r%i\y( התגרהy\) ויגלפ דנוארב םידרוש 300 גורהת^n", g_killsurvivorplague[id])
  326.    
  327.     menu_additem(achvsMenu, szTitle, "15")
  328.    
  329.     // 16
  330.     if(g_killnemesisplague[id] >= 300)
  331.         formatex(szTitle, 99, "!רהמ בושחת^n w\.ויגלפ דנוארב סיסמנ 300 גורהת r\(חתפנ)^n")
  332.     else
  333.         formatex(szTitle, 99, "רהמ בושחת^n \r%i\y( התגרהy\) ויגלפ דנוארב סיסמנ 300 גורהת^n", g_killnemesisplague[id])
  334.    
  335.     menu_additem(achvsMenu, szTitle, "16")
  336.    
  337.     // 17
  338.     if(g_kill600survivor[id] >= 600)
  339.         formatex(szTitle, 99, "תובבל רבוש^n w\.םידרוש 600 גורהת r\(חתפנ)^n")
  340.     else
  341.         formatex(szTitle, 99, "תובבל רבוש^n \r%i\y( התגרהy\) סיסמנ 600 גורהת^n", g_kill600survivor[id])
  342.    
  343.     menu_additem(achvsMenu, szTitle, "17")
  344.    
  345.     // 18
  346.     if(g_kill600nemesis[id] >= 600)
  347.         formatex(szTitle, 99, "חדינ^n w\.סיסמנ 600 גורהת r\(חתפנ)^n")
  348.     else
  349.         formatex(szTitle, 99, "חדינ^n \r%i\y( התגרהy\) םידרוש 600 גורהת^n", g_kill600nemesis[id])
  350.    
  351.     menu_additem(achvsMenu, szTitle, "18")
  352.    
  353.     // 19
  354.     if(g_InfectionBombCount[id] >= 300)
  355.         formatex(szTitle, 99, "ץיצפמה^n w\.םיבמוז תוצצפ 300 הנקת r\(חתפנ)^n")
  356.     else
  357.         formatex(szTitle, 99, "רבמוב^n \r%i\y( התינקy\) יבמוז תוצצפ 300 הנקת^n", g_InfectionBombCount[id])
  358.    
  359.     menu_additem(achvsMenu, szTitle, "19")
  360.    
  361.     // 20
  362.     if(g_SprayCount[id] >= 300)
  363.         formatex(szTitle, 99, "המחלמ תונמא^n w\.תרשב קחשמ התאש ןמזה לכב םימעפ 300 יירפס השעת r\(חתפנ)^n")
  364.     else
  365.         formatex(szTitle, 99, "המיחל תונמוא^n \r%i\y( התישעy\) תרשב התאש ןמזה לכב יירפס םימעפ 300 השעת^n", g_SprayCount[id])
  366.    
  367.     menu_additem(achvsMenu, szTitle, "20")
  368.    
  369.     // 21
  370.     if(g_awpkills[id] >= 200)
  371.         formatex(szTitle, 99, "םלשומה^n AWP.\w םע םיבמוז 200 גורהת r\(חתפנ)^n")
  372.     else
  373.         formatex(szTitle, 99, "^nתהרוג 200 זומבים עם AWP. (\yהרגתה \r%i\y) ^nהמושלם", g_awpkills[id])
  374.    
  375.     menu_additem(achvsMenu, szTitle, "21")
  376.    
  377.     // 22
  378.     if(g_infectinrowcount1[id] >= 5)
  379.         formatex(szTitle, 99, "םירודכ ןיסח^n w\.דחא בוביסב יבמוזל םישנא 5 ךופהת r\(חתפנ)^n")
  380.     else
  381.         formatex(szTitle, 99, "םירודכ ןיסח^n \r%i\y( התמהיזy\) .דחא בוביסב םדא ינב 5 םהזת^n", g_infectinrowcount1[id])
  382.    
  383.     menu_additem(achvsMenu, szTitle, "22")
  384.    
  385.     // 23
  386.     if(g_infectinrowcount2[id] >= 10)
  387.         formatex(szTitle, 99, "תוומה ךאלמ^n w\.דחא בוביסב יבמוזל םישנא 10 ךופהת r\(חתפנ)^n")
  388.     else
  389.         formatex(szTitle, 99, "תוומה ךאלמ^n \r%i\y( התמהיזy\) .דחא בוביסב םדא ינב 10 םהזת^n", g_infectinrowcount2[id])
  390.    
  391.     menu_additem(achvsMenu, szTitle, "23")
  392.    
  393.     // 24
  394.     if(g_zmkillrowcount1[id] >= 5)
  395.         formatex(szTitle, 99, "םיבמוז טבחמ^n w\.דחא בוביסב םיבמוז 5 גורהת r\(חתפנ)^n")
  396.     else
  397.         formatex(szTitle, 99, "םיימ טבחמ^n \r%i\y( התגרהy\) .דחא בוביסב םיבמוז 5 גורהת^n", g_zmkillrowcount1[id])
  398.    
  399.     menu_additem(achvsMenu, szTitle, "24")
  400.    
  401.     // 25
  402.     if(g_zmkillrowcount1[id] >= 10)
  403.         formatex(szTitle, 99, "חוטב ירי^n w\.דחא בוביסב םיבמוז 10 גורהת r\(חתפנ)^n")
  404.     else
  405.         formatex(szTitle, 99, "חוטב ירי^n \r%i\y( התגרהy\) .דחא בוביסב םיבמוז 10 גורהת^n", g_zmkillrowcount2[id])
  406.    
  407.     menu_additem(achvsMenu, szTitle, "24")
  408.    
  409.     // 26
  410.     if(g_lasthumankillall[id] >= 1)
  411.         formatex(szTitle, 99, "דדוב באז^n w\.םיבמוזה לכ תא גורהתו ןורחאה םדא ןבה היהת r\(חתפנ)^n")
  412.     else
  413.         formatex(szTitle, 99, "דדוב באז^n םיבמוזה לכ תא גורהתו ןורחאה םדא ןבה היהת^n")
  414.    
  415.     menu_additem(achvsMenu, szTitle, "25")
  416.    
  417.    
  418.     menu_setprop(achvsMenu, MPROP_EXIT, MEXIT_ALL)
  419.     menu_setprop(achvsMenu, MPROP_PERPAGE, 3)
  420.    
  421.     menu_display(id, achvsMenu, 0)
  422. }
  423.  
  424. public menuAchvsHandler(id, menu, item) {}
  425.  
  426. public increaseMinutes()
  427. {
  428.     new players[32], pnum, tempid
  429.     get_players(players, pnum)
  430.    
  431.     for(new i; i<pnum; i++)
  432.     {
  433.         tempid = players[i]
  434.         new CsTeams:team = cs_get_user_team(tempid)
  435.        
  436.         if(team != CS_TEAM_SPECTATOR && team != CS_TEAM_UNASSIGNED)
  437.         {
  438.             g_Minutes[tempid]++
  439.            
  440.             if(g_Minutes[tempid] == 600)
  441.             {
  442.                 client_print(tempid, print_chat, "^"<3^" תא התחתפ התא ]םיגשיה[")
  443.             }
  444.         }
  445.        
  446.         updateTableStats(tempid)
  447.     }
  448. }
  449.  
  450. public cmdRoundStart()
  451. {
  452.     new players[32], pnum, tempid
  453.     get_players(players, pnum)
  454.    
  455.     for(new i; i<pnum; i++)
  456.     {
  457.         tempid = players[i]
  458.         new CsTeams:team = cs_get_user_team(tempid)
  459.        
  460.         if(team != CS_TEAM_SPECTATOR && team != CS_TEAM_UNASSIGNED)
  461.         {
  462.             g_Rounds[tempid]++
  463.            
  464.             if(g_Rounds[tempid] == 3000)
  465.             {
  466.                 client_print(tempid, print_chat, "^"םירטסקאל^" תא התחתפ התא ]םיגשיה[")
  467.             }
  468.         }
  469.        
  470.         if(g_LoggedIn[tempid])
  471.         {
  472.             // Infect in round count (reset)
  473.             if(g_infectinrowcount1[tempid] != 5)  g_infectinrowcount1[tempid] = 0
  474.             if(g_infectinrowcount2[tempid] != 10) g_infectinrowcount2[tempid] = 0
  475.            
  476.             if(g_zmkillrowcount1[tempid] != 5)  g_zmkillrowcount1[tempid] = 0
  477.             if(g_zmkillrowcount2[tempid] != 10) g_zmkillrowcount2[tempid] = 0
  478.         }
  479.     }
  480. }
  481.  
  482. public createTable()
  483. {
  484.     new szQuery[2048]
  485.     new len
  486.    
  487.     len += format(szQuery[len], 2048,"CREATE TABLE IF NOT EXISTS zp_rabs(")
  488.     len += format(szQuery[len], 2048-len,"username VARCHAR(100), ")
  489.     len += format(szQuery[len], 2048-len,"password VARCHAR(100), ")
  490.     len += format(szQuery[len], 2048-len,"totalpoints INT(11), ")
  491.     len += format(szQuery[len], 2048-len,"hkzpoints INT(11), ")
  492.     len += format(szQuery[len], 2048-len,"hknpoints INT(11), ")
  493.     len += format(szQuery[len], 2048-len,"skzpoints INT(11), ")
  494.     len += format(szQuery[len], 2048-len,"hkzknifepoints INT(11), ")
  495.     len += format(szQuery[len], 2048-len,"zihpoints INT(11), ")
  496.     len += format(szQuery[len], 2048-len,"nkhpoints INT(11), ")
  497.     len += format(szQuery[len], 2048-len,"zkspoints INT(11), ")
  498.     len += format(szQuery[len], 2048-len,"zkhpspoints INT(11), ")
  499.     len += format(szQuery[len], 20480-len,"ammopacks INT(11), ")
  500.     len += format(szQuery[len], 2048-len,"minutesplayed INT(11), ")
  501.     len += format(szQuery[len], 2048-len,"zombiekills1 INT(11), ")
  502.     len += format(szQuery[len], 2048-len,"zombiekills2 INT(11), ")
  503.     len += format(szQuery[len], 2048-len,"zombiekills3 INT(11), ")
  504.     len += format(szQuery[len], 2048-len,"zombiehskills INT(11), ")
  505.     len += format(szQuery[len], 2048-len,"rounds INT(11), ")
  506.     len += format(szQuery[len], 2048-len,"humankillinfect1 INT(11), ")
  507.     len += format(szQuery[len], 2048-len,"humankillinfect2 INT(11), ")
  508.     len += format(szQuery[len], 2048-len,"humankillinfect3 INT(11), ")
  509.     len += format(szQuery[len], 2048-len,"gotkilledinfected INT(11), ")
  510.     len += format(szQuery[len], 2048-len,"nemekillknife INT(11), ")
  511.     len += format(szQuery[len], 2048-len,"zombiekillknife INT(11), ")
  512.     len += format(szQuery[len], 2048-len,"winsurvivor INT(11), ")
  513.     len += format(szQuery[len], 2048-len,"winnemesis INT(11), ")
  514.     len += format(szQuery[len], 2048-len,"ninja INT(11), ")
  515.     len += format(szQuery[len], 2048-len,"thinkfast INT(11), ")
  516.     len += format(szQuery[len], 2048-len,"kill600survivor INT(11), ")
  517.     len += format(szQuery[len], 2048-len,"kill600nemesis INT(11), ")
  518.     len += format(szQuery[len], 2048-len,"infectionbomb INT(11), ")
  519.     len += format(szQuery[len], 2048-len,"sprays INT(11), ")
  520.     len += format(szQuery[len], 2048-len,"awpkills INT(11), ")
  521.     len += format(szQuery[len], 2048-len,"infectround1 INT(11), ")
  522.     len += format(szQuery[len], 2048-len,"infectround2 INT(11), ")
  523.     len += format(szQuery[len], 2048-len,"zmkillrow1 INT(11), ")
  524.     len += format(szQuery[len], 2048-len,"zmkillrow2 INT(11), ")
  525.     len += format(szQuery[len], 2048-len,"lasthumankillall INT(11))")
  526.    
  527.     SQL_ThreadQuery(g_SqlTuple,"createTableThread", szQuery)
  528. }
  529.  
  530. public createTableThread(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
  531. {
  532.     if(FailState == TQUERY_CONNECT_FAILED)
  533.         return set_fail_state(".LQSל רבחתיהל היה ןתינ אל")
  534.     else if(FailState == TQUERY_QUERY_FAILED)
  535.         return set_fail_state("Query failed.")
  536.    
  537.     if(Errcode)
  538.         return log_amx("%s : תתליאש לע האיגש",Error)
  539.    
  540.     return PLUGIN_CONTINUE
  541. }
  542.  
  543. public DeathMsg()
  544. {
  545.     new killer = read_data(1)
  546.     new victim = read_data(2)
  547.     new hs = read_data(3)
  548.    
  549.     if(!g_LoggedIn[killer]) return PLUGIN_HANDLED
  550.    
  551.     // Suicide
  552.     if(killer == victim) return PLUGIN_HANDLED
  553.    
  554.     if(is_valid_player(killer) && is_valid_player(victim))
  555.     {
  556.         // HUMAN STATISTICS
  557.        
  558.         // Human kills Zombie
  559.         if(is_hkz_kill(killer, victim))
  560.         {
  561.             g_TotalPoints[killer] += 6
  562.             g_HumanKillsZombiePoints[killer] += 6
  563.            
  564.             client_print(killer, print_chat, ".יבמוז התגרהש ללגב תודוקנ 6 התלביק עגרכ התא]סוטטס[")
  565.            
  566.            
  567.             // Achievements
  568.            
  569.             if(zp_get_user_last_human(killer) && zp_get_user_last_zombie(victim))
  570.             {
  571.                 g_lasthumankillall[killer]++
  572.                 if(g_lasthumankillall[killer] == 1)
  573.                 {
  574.                     client_print(killer, print_chat, "^"דדוב באז^" תא התחתפ התא ]םיגשיה[")
  575.                 }
  576.             }
  577.            
  578.             new weapon = get_user_weapon(killer)
  579.             if(weapon == CSW_KNIFE)
  580.             {
  581.                 if(g_killzombieknife[killer] != 200)
  582.                 {
  583.                     g_killzombieknife[killer]++
  584.                    
  585.                     if(g_killzombieknife[killer] == 200)
  586.                     {
  587.                         client_print(killer, print_chat, "^"הדגאה^" תא התחתפ התא ]םיגשיה[")
  588.                     }
  589.                 }
  590.             }
  591.            
  592.             if(weapon == CSW_AWP)
  593.             {
  594.                 if(g_awpkills[killer] != 200)
  595.                 {
  596.                     g_awpkills[killer]++
  597.                    
  598.                     if(g_awpkills[killer] == 200)
  599.                     {
  600.                         client_print(killer, print_chat, "^"םלשומה^" תא התחתפ התא ]םיגשיה[")
  601.                     }
  602.                 }
  603.             }
  604.            
  605.            
  606.             if(g_infectinrowcount1[killer] != 5)
  607.             {
  608.                 g_zmkillrowcount1[killer]++
  609.                
  610.                 if(g_zmkillrowcount1[killer] == 5)
  611.                 {
  612.                     client_print(killer, print_chat, "^"םיבמוז טבחמ^" תא התחתפ התא ]םיגשיה[")
  613.                 }
  614.             }
  615.             else if(g_zmkillrowcount2[killer] != 10)
  616.             {
  617.                 g_zmkillrowcount2[killer]++
  618.                
  619.                 if(g_zmkillrowcount2[killer] == 10)
  620.                 {
  621.                     client_print(killer, print_chat, "^"חוטב ירי^" תא התחתפ התא ]םיגשיה[")
  622.                 }
  623.             }
  624.            
  625.             // Achievements
  626.             if(g_ZombieKillCount1[killer] != 100)
  627.             {
  628.                 g_ZombieKillCount1[killer]++
  629.                
  630.                 if(g_ZombieKillCount1[killer] == 100)
  631.                 {
  632.                     client_print(killer, print_chat, "^"םיתמ םיפידע םיבמוז^" תא התחתפ התא ]םיגשיה[")
  633.                 }
  634.             }
  635.             else
  636.             {
  637.                 // 1. Level is OK
  638.                 if(g_ZombieKillCount2[killer] != 600)
  639.                 {
  640.                     g_ZombieKillCount2[killer]++
  641.                    
  642.                     if(g_ZombieKillCount2[killer] == 600)
  643.                     {
  644.                         client_print(killer, print_chat, "^"םיבמוז חצור^" תא התחתפ התא ]םיגשיה[")
  645.                     }
  646.                 }
  647.                 else
  648.                 {
  649.                     // 2. Level is ok.
  650.                     if(g_ZombieKillCount3[killer] != 1000)
  651.                     {
  652.                         g_ZombieKillCount3[killer]++
  653.                        
  654.                         if(g_ZombieKillCount3[killer] == 1000)
  655.                         {
  656.                             client_print(killer, print_chat, "^"יעוצקמ םיבמוז חצור^" תא התחתפ התא ]םיגשיה[")
  657.                         }
  658.                     }
  659.                 }
  660.             }
  661.         }
  662.        
  663.         if(!zp_get_user_zombie(killer) && hs)
  664.         {
  665.             if(zp_get_user_zombie(victim) || zp_get_user_nemesis(victim)|| zp_get_user_assassin(victim))
  666.             {
  667.                 g_ZombieHSKillCount[killer]++
  668.                
  669.                 if(g_ZombieHSKillCount[killer] == 600)
  670.                 {
  671.                     client_print(killer, print_chat, "^"!טוש-דאה !םוב^" תא התחתפ התא ]םיגשיה[")
  672.                 }
  673.             }
  674.         }
  675.        
  676.         // Human kills Zombie by Knife
  677.         if(is_hkz_knife_kill(killer, victim))
  678.         {
  679.             g_TotalPoints[killer] += 10
  680.             g_HumanKillsZombieKnifePoints[killer] += 10
  681.            
  682.             client_print(killer, print_chat, ".ןיכס םע יבמוז התגרה יכ תודוקנ 10 התלביק התא ]סוטטס[")
  683.         }
  684.        
  685.         // Human kills Nemesis
  686.         if(is_hkn_kill(killer, victim))
  687.         {
  688.             g_TotalPoints[killer] += 10
  689.             g_HumanKillsNemesisPoints[killer] += 10
  690.            
  691.             client_print(killer, print_chat, ".סיסמנ התגרה יכ תודוקנ 10 התלביק התא ]סוטטס[")
  692.            
  693.             // Achievements
  694.             new weapon = get_user_weapon(killer)
  695.             if(weapon == CSW_KNIFE)
  696.             {
  697.                 if(g_nemeKillCountKnife[killer] != 10)
  698.                 {
  699.                     g_nemeKillCountKnife[killer]++
  700.                    
  701.                     if(g_nemeKillCountKnife[killer] == 10)
  702.                     {
  703.                         client_print(killer, print_chat, "^"לזרב יבצע^" תא התחתפ התא ]םיגשיה[")
  704.                     }
  705.                 }
  706.             }
  707.         }
  708.        
  709.         //achievement
  710.         if(zp_get_user_nemesis(victim) && !zp_get_user_zombie(killer))
  711.         {
  712.             if(zp_is_plague_round())
  713.             {
  714.                 if(g_killnemesisplague[killer] != 300)
  715.                 {
  716.                     g_killnemesisplague[killer]++
  717.                    
  718.                     if(g_killnemesisplague[killer] == 300)
  719.                     {
  720.                         client_print(killer, print_chat, "^"רהמ בושחת^" תא התחתפ התא ]םיגשיה[")
  721.                     }
  722.                 }
  723.                
  724.                 if(g_kill600nemesis[killer] != 600)
  725.                 {
  726.                     g_kill600nemesis[killer]++
  727.                    
  728.                     if(g_kill600nemesis[killer] == 600)
  729.                     {
  730.                         client_print(killer, print_chat, "^"חדינ^" תא התחתפ התא ]םיגשיה[")
  731.                     }
  732.                 }
  733.             }
  734.             else
  735.             {
  736.                 if(g_kill600nemesis[killer] != 600)
  737.                 {
  738.                     g_kill600nemesis[killer]++
  739.                    
  740.                     if(g_kill600nemesis[killer] == 600)
  741.                     {
  742.                         client_print(killer, print_chat, "^"חדינ^" תא התחתפ התא ]םיגשיה[")
  743.                     }
  744.                 }
  745.             }
  746.         }
  747.        
  748.         // Survivor kills Zombie
  749.         if(is_skz_kill(killer, victim))
  750.         {
  751.             g_TotalPoints[killer] += 6
  752.             g_SurvivorKillsZombiePoints[killer] += 6
  753.            
  754.             client_print(killer, print_chat, ".דרושה התאשכ יבמוז התגרה יכ תודוקנ 6 התלביק התא ]סוטטס[")
  755.            
  756.             // Achievements
  757.            
  758.             if(zp_get_user_last_zombie(victim))
  759.             {
  760.                 if(g_winsurvivor[killer] != 10)
  761.                 {
  762.                     g_winsurvivor[killer]++
  763.                    
  764.                     if(g_winsurvivor[killer] == 10)
  765.                     {
  766.                         client_print(killer, print_chat, "^"דרושה^" תא התחתפ התא ]םיגשיה[")
  767.                     }
  768.                 }
  769.                
  770.             }
  771.         }
  772.        
  773.         // ZOMBIE STATISTICS   
  774.        
  775.         // Nemesis kills Human
  776.         if(is_nkh_kill(killer, victim))
  777.         {
  778.             g_TotalPoints[killer] += 3
  779.             g_NemesisKillsHuman[killer] += 3
  780.            
  781.             client_print(killer, print_chat, ".סיסמנ התאשכ םדא-ןב התגרה יכ תודוקנ 3 התלביק התא ]סוטטס[")
  782.            
  783.             // Achievements
  784.            
  785.             if(zp_get_user_last_human(victim))
  786.             {
  787.                 if(g_winnemesis[killer] != 10)
  788.                 {
  789.                     g_winnemesis[killer]++
  790.                    
  791.                     if(g_winnemesis[killer] == 10)
  792.                     {
  793.                         client_print(killer, print_chat, "^"סיסמנ^" תא התחתפ התא ]םיגשיה[")
  794.                     }
  795.                 }
  796.                
  797.             }
  798.         }
  799.        
  800.         // Zombie kill survivor
  801.         if(is_zks_kill(killer, victim))
  802.         {
  803.             g_TotalPoints[killer] += 10
  804.             g_ZombieKillsSurvivor[killer] += 10
  805.            
  806.             client_print(killer, print_chat, ".דרושה תא התגרה יכ תודוקנ 10 התלביק התא ]סוטטס[")
  807.         }
  808.        
  809.         //achievement
  810.         if(zp_get_user_survivor(victim) && zp_get_user_zombie(killer))
  811.         {
  812.             if(zp_is_plague_round())
  813.             {
  814.                 if(g_killsurvivorplague[killer] != 300)
  815.                 {
  816.                     g_killsurvivorplague[killer]++
  817.                    
  818.                     if(g_killsurvivorplague[killer] == 300)
  819.                     {
  820.                         client_print(killer, print_chat, "^"ה'גנינ^" תא התחתפ התא ]םיגשיה[")
  821.                     }
  822.                 }
  823.                
  824.                 if(g_kill600survivor[killer] != 600)
  825.                 {
  826.                     g_kill600survivor[killer]++
  827.                    
  828.                     if(g_kill600survivor[killer] == 600)
  829.                     {
  830.                         client_print(killer, print_chat, "^"תובבל רבוש^" תא התחתפ התא ]םיגשיה[")
  831.                     }
  832.                 }
  833.             }
  834.             else
  835.             {
  836.                 if(g_kill600survivor[killer] != 600)
  837.                 {
  838.                     g_kill600survivor[killer]++
  839.                    
  840.                     if(g_kill600survivor[killer] == 600)
  841.                     {
  842.                         client_print(killer, print_chat, "^"תובבל רבוש^" תא התחתפ התא ]םיגשיה[")
  843.                     }
  844.                 }
  845.             }
  846.         }
  847.        
  848.         // Zombie kills Human
  849.         if(is_zkhps_kill(killer, victim))
  850.         {
  851.             g_TotalPoints[killer] += 4
  852.             g_ZombieKillsHumanPS[killer] += 4
  853.            
  854.             client_print(killer, print_chat, ".םדא ןב התגרה יכ תודוקנ 4 התלביק התא ]סוטטס[")
  855.            
  856.             // Achievements
  857.            
  858.             // Zombie Kill/Infect Achivement
  859.             if(g_KillInfectCount1[killer] != 200)
  860.             {
  861.                 g_KillInfectCount1[killer]++
  862.                
  863.                 if(g_KillInfectCount1[killer] == 200)
  864.                 {
  865.                     client_print(killer, print_chat, "^"...חומ מממ^" תא התחתפ התא ]םיגשיה[")
  866.                 }
  867.             }
  868.             else
  869.             {
  870.                 // 1. Level is OK
  871.                 if(g_KillInfectCount2[killer] != 1200)
  872.                 {
  873.                     g_KillInfectCount2[killer]++
  874.                    
  875.                     if(g_KillInfectCount2[killer] == 1200)
  876.                     {
  877.                         client_print(killer, print_chat, "^"הלועה סקינופה^" תא התחתפ התא ]םיגשיה[")
  878.                     }
  879.                 }
  880.                 else
  881.                 {
  882.                     // 2. Level is ok.
  883.                     if(g_KillInfectCount3[killer] != 2000)
  884.                     {
  885.                         g_KillInfectCount3[killer]++
  886.                        
  887.                         if(g_KillInfectCount3[killer] == 2000)
  888.                         {
  889.                             client_print(killer, print_chat, "^"םוהיז^" תא התחתפ התא ]םיגשיה[")
  890.                         }
  891.                     }
  892.                 }
  893.             }
  894.            
  895.             // Got Killed / Infected Achievements  
  896.             g_gotKillInfectCount[victim]++
  897.             if(g_gotKillInfectCount[victim] == 1000)
  898.             {
  899.                 client_print(killer, print_chat, "^"תובטה םע םיביוא^" תא התחתפ התא ]םיגשיה[")
  900.             }
  901.         }
  902.     }
  903.    
  904.     return PLUGIN_CONTINUE
  905. }
  906.  
  907. public zp_user_infected_pre(infected, infector, nemesis)
  908. {
  909.     if(!g_LoggedIn[infector]) return PLUGIN_HANDLED
  910.    
  911.     if(is_valid_player(infected) && is_valid_player(infector))
  912.     {
  913.         // zombie infects human
  914.         if(is_zih_infect(infected, infector, nemesis))
  915.         {
  916.             g_TotalPoints[infector] += 3
  917.             g_ZombieInfectsHumanPoints[infector] += 3
  918.            
  919.             client_print(infector, print_chat, ".יבמוזל םדא ןב התכפה יכ תודוקנ 3 התלביק התא ]סוטטס[")
  920.            
  921.             // Achievements
  922.            
  923.             if(g_KillInfectCount1[infector] != 200)
  924.             {
  925.                 g_KillInfectCount1[infector]++
  926.                
  927.                 if(g_KillInfectCount1[infector] == 200)
  928.                 {
  929.                     client_print(infector, print_chat, "^"...חומ מממ^" תא התחתפ התא ]םיגשיה[")
  930.                 }
  931.             }
  932.             else
  933.             {
  934.                 // 1. Level is OK
  935.                 if(g_KillInfectCount2[infector] != 1200)
  936.                 {
  937.                     g_KillInfectCount2[infector]++
  938.                    
  939.                     if(g_KillInfectCount2[infector] == 1200)
  940.                     {
  941.                         client_print(infector, print_chat, "^"הלועה סקינופה^" תא התחתפ התא ]םיגשיה[")
  942.                     }
  943.                 }
  944.                 else
  945.                 {
  946.                     // 2. Level is ok.
  947.                     if(g_KillInfectCount3[infector] != 2000)
  948.                     {
  949.                         g_KillInfectCount3[infector]++
  950.                        
  951.                         if(g_KillInfectCount3[infector] == 2000)
  952.                         {
  953.                             client_print(infector, print_chat, "^"םוהיז^" תא התחתפ התא ]םיגשיה[")
  954.                         }
  955.                     }
  956.                 }
  957.             }
  958.            
  959.             if(g_infectinrowcount1[infector] != 5)
  960.             {
  961.                 g_infectinrowcount1[infector]++
  962.                
  963.                 if(g_infectinrowcount1[infector] == 5)
  964.                 {
  965.                     client_print(infector, print_chat, "^"םירודכ ןיסח^" תא התחתפ התא ]םיגשיה[")
  966.                 }
  967.             }
  968.             else if(g_infectinrowcount2[infector] != 10)
  969.             {
  970.                 g_infectinrowcount2[infector]++
  971.                
  972.                 if(g_infectinrowcount2[infector] == 10)
  973.                 {
  974.                     client_print(infector, print_chat, "^"תוומה ךאלמ^" תא התחתפ התא ]םיגשיה[")
  975.                 }
  976.             }
  977.            
  978.             // Got Killed / Infected Achievements  
  979.             g_gotKillInfectCount[infected]++
  980.             if(g_gotKillInfectCount[infected] == 1000)
  981.             {
  982.                 client_print(infected, print_chat, "^"תובטה םע םיביוא^" תא התחתפ התא ]םיגשיה[")
  983.             }
  984.         }
  985.     }
  986.    
  987.     return PLUGIN_CONTINUE
  988. }
  989.  
  990. /* From here: STATUS POINTS SYSTEM FUNCTIONS *+*+*+*+* */
  991.  
  992. // killer: Zombie
  993. // victim: Human
  994. // rounds: Plague/Swarm
  995. public is_zkhps_kill(killer, victim)
  996. {
  997.     if(zp_get_user_zombie(killer) && !zp_get_user_zombie(victim) && !zp_get_user_survivor(victim) && !zp_get_user_nemesis(killer))
  998.         return 1
  999.     else
  1000.         return 0
  1001.    
  1002.     return PLUGIN_CONTINUE
  1003. }
  1004.  
  1005. // killer: Zombie No Neme
  1006. // victim: survivor
  1007. // rounds: survivorround
  1008. public is_zks_kill(killer, victim)
  1009. {
  1010.     if(zp_get_user_zombie(killer) && zp_get_user_survivor(victim) && zp_is_survivor_round() && !zp_get_user_nemesis(killer))
  1011.         return 1
  1012.     else
  1013.         return 0
  1014.    
  1015.     return PLUGIN_CONTINUE
  1016. }
  1017.  
  1018. // killer: Nemesis
  1019. public is_nkh_kill(killer, victim)
  1020. {
  1021.     if(zp_get_user_nemesis(killer))
  1022.         return 1
  1023.     else
  1024.         return 0
  1025.    
  1026.     return PLUGIN_CONTINUE
  1027. }
  1028.  
  1029. // Infector: Is Zombie, not turned to nemesis
  1030. public is_zih_infect(infected, infector, turnedtonemesis)
  1031. {
  1032.     if(zp_get_user_zombie(infector) && !turnedtonemesis)
  1033.         return 1
  1034.     else
  1035.         return 0
  1036.    
  1037.     return PLUGIN_CONTINUE
  1038. }
  1039.  
  1040. // killer: Human, No survivor
  1041. // victim: Is Zombie, not Nemesis
  1042. // rounds: No nemeround, no plgue/swarm, no survivorround
  1043. public is_hkz_kill(killer, victim)
  1044. {
  1045.     if(!zp_get_user_zombie(killer) && !zp_get_user_survivor(killer) && !zp_get_user_nemesis(victim) && zp_get_user_zombie(victim) && !zp_is_nemesis_round() && !zp_is_survivor_round())
  1046.         return 1
  1047.     else
  1048.         return 0
  1049.    
  1050.     return PLUGIN_CONTINUE
  1051. }
  1052.  
  1053. // killer: Human KILL BY KNIFE
  1054. // victim: Is Zombie
  1055. public is_hkz_knife_kill(killer, victim)
  1056. {
  1057.     if(!zp_get_user_zombie(killer) && zp_get_user_zombie(victim))
  1058.     {
  1059.         new weapon = get_user_weapon(killer)
  1060.         if(weapon == CSW_KNIFE)
  1061.         {
  1062.             return 1
  1063.         }
  1064.     }
  1065.     else
  1066.         return 0
  1067.    
  1068.     return PLUGIN_CONTINUE
  1069. }
  1070.  
  1071. // killer: no zombie
  1072. // victim: is Nemesis
  1073. // rounds: is neme round
  1074. public is_hkn_kill(killer, victim)
  1075. {
  1076.     if(!zp_get_user_zombie(killer) && zp_get_user_nemesis(victim) && zp_is_nemesis_round())
  1077.         return 1
  1078.     else
  1079.         return 0
  1080.    
  1081.     return PLUGIN_CONTINUE
  1082. }
  1083.  
  1084. // killer: is Survivor
  1085. // victim: is zombie
  1086. // rounds: is Survivor round
  1087. public is_skz_kill(killer, victim)
  1088. {
  1089.     if(zp_get_user_survivor(killer) && zp_get_user_zombie(victim) && zp_is_survivor_round())
  1090.         return 1
  1091.     else
  1092.         return 0
  1093.    
  1094.     return PLUGIN_CONTINUE
  1095. }
  1096.  
  1097. public menuStats(id)
  1098. {
  1099.     if(!g_LoggedIn[id])
  1100.     {
  1101.         client_print(id, print_chat, "[Stats] You arent logged in.")
  1102.         return PLUGIN_HANDLED
  1103.     }
  1104.     else
  1105.     {
  1106.         new menuStatistics = menu_create("\yהקיטסיטטס", "menuStatsHandler")
  1107.        
  1108.         menu_additem(menuStatistics, "\y15פוט^n", "1")
  1109.        
  1110.         new szTotalPoints[60]
  1111.         formatex(szTotalPoints, 59, "\r%i: \wתודוקנ כהס", g_TotalPoints[id])
  1112.         menu_addtext(menuStatistics, szTotalPoints, 0)
  1113.        
  1114.         new szMin[60]
  1115.         formatex(szMin, 59, "\r%i :\wתוקד התקחש", g_Minutes[id])
  1116.         menu_addtext(menuStatistics, szMin, 0)
  1117.        
  1118.         new szRounds[60]
  1119.         formatex(szRounds, 59, "\r%i :\wןקחשה לש םיבוביס^n", g_Rounds[id])
  1120.         menu_addtext(menuStatistics, szRounds, 0)
  1121.        
  1122.         // HUMAN
  1123.        
  1124.         new szHKZ[60]
  1125.         formatex(szHKZ, 59, "r\)תודוקנ (%i yוגירה %i : wתגרה םיבמוז המכ", g_HumanKillsZombiePoints[id] / 6, g_HumanKillsZombiePoints[id])
  1126.         menu_addtext(menuStatistics, szHKZ, 0)
  1127.        
  1128.         new szHKZknife[60]
  1129.         formatex(szHKZknife, 59, "r\)תודוקנ (%i yוגירה %i : wיכס םע התגרה םיבמוז המכ", g_HumanKillsZombieKnifePoints[id] / 10, g_HumanKillsZombieKnifePoints[id])
  1130.         menu_addtext(menuStatistics, szHKZknife, 0)
  1131.        
  1132.         new szHKN[60]
  1133.         formatex(szHKN, 59, "r\)תודוקנ (%i yוגירה %i : wתגרה סיסמנ המכ", g_HumanKillsNemesisPoints[id] / 10, g_HumanKillsNemesisPoints[id])
  1134.         menu_addtext(menuStatistics, szHKN, 0)
  1135.        
  1136.         new szSKZ[60]
  1137.         formatex(szSKZ, 59, "r\)תודוקנ (%i yוגירה %i : wרושכ התגרה םיבמוז המכ^n^n", g_SurvivorKillsZombiePoints[id] / 6, g_SurvivorKillsZombiePoints[id])
  1138.         menu_addtext(menuStatistics, szSKZ, 0)
  1139.        
  1140.         // Zombie
  1141.        
  1142.         new szZIH[60]
  1143.         formatex(szZIH, 59, "r\)תודוקנ (%i yימוהיז %i : wתקבדה םדא ינב המכ", g_ZombieInfectsHumanPoints[id] / 3, g_ZombieInfectsHumanPoints[id])
  1144.         menu_addtext(menuStatistics, szZIH, 0)
  1145.        
  1146.         new szZKH[60]
  1147.         formatex(szZKH, 59, "r\)תודוקנ (%i yתגרה %i : wתגרה םדא ינב המכ", g_ZombieKillsHumanPS[id] / 4, g_ZombieKillsHumanPS[id])
  1148.         menu_addtext(menuStatistics, szZKH, 0)
  1149.        
  1150.         new szZKS[60]
  1151.         formatex(szZKS, 59, "r\)תודוקנ (%i yתגרה %i : wתגרה םידרוש המכ", g_ZombieKillsSurvivor[id] / 10, g_ZombieKillsSurvivor[id])
  1152.         menu_addtext(menuStatistics, szZKS, 0)
  1153.        
  1154.         new szNKH[60]
  1155.         formatex(szNKH, 59, "r\)תודוקנ (%i yתגרה %i : wיסמנכ התגרה םדא ינב המכ", g_NemesisKillsHuman[id] / 3, g_NemesisKillsHuman[id])
  1156.         menu_addtext(menuStatistics, szNKH, 0)
  1157.        
  1158.         menu_display(id, menuStatistics, 0)
  1159.     }
  1160.    
  1161.     return PLUGIN_CONTINUE
  1162. }
  1163.  
  1164. public menuStatsHandler(id, menu, item)
  1165. {
  1166.     new data[6], iName[64], access, callback
  1167.     menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback)
  1168.    
  1169.     new key = str_to_num(data)
  1170.    
  1171.     switch(key)
  1172.     {
  1173.         // Top10
  1174.         case 1:
  1175.         {
  1176.             cmdTop10(id)
  1177.         }
  1178.     }
  1179.    
  1180.     menu_destroy(menu)
  1181. }
  1182.  
  1183.  
  1184. public cmdTop10(id)
  1185. {
  1186.     g_Top10TempID = id
  1187.     SQL_ThreadQuery(g_SqlTuple, "top10Thread","SELECT * FROM zp_rabs ORDER BY totalpoints DESC LIMIT 10")
  1188. }
  1189.  
  1190. public top10Thread(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
  1191. {
  1192.     if(FailState == TQUERY_CONNECT_FAILED)
  1193.         return set_fail_state("Could not connect to SQL database.")
  1194.     else if(FailState == TQUERY_QUERY_FAILED)
  1195.         return set_fail_state("Query failed.")
  1196.    
  1197.     if(Errcode)
  1198.         return log_amx("%s :שגיאה על שאילתת",Error)
  1199.    
  1200.     new id = g_Top10TempID
  1201.    
  1202.     const SIZE = 9000;
  1203.     new msg[SIZE + 1]
  1204.     new len;
  1205.    
  1206.     len += formatex(msg[len], SIZE, "<html><body><h1>Top10</h1>")
  1207.    
  1208.     len += formatex(msg[len], SIZE-len, "<table border=^"1^">")
  1209.    
  1210.     len += formatex(msg[len], SIZE-len, "<tr><td>הגרד</td>")
  1211.    
  1212.     len += formatex(msg[len], SIZE-len, "<td style=^"width: 40px;^">oa</td>")
  1213.    
  1214.     len += formatex(msg[len], SIZE-len, "<td>תודוקנ כהס</td>")
  1215.    
  1216.     len += formatex(msg[len], SIZE-len, "<td>וגרהנש םיבמוז</td>")
  1217.    
  1218.     len += formatex(msg[len], SIZE-len, "<td>וגרהנש םישנא</td>")
  1219.    
  1220.     len += formatex(msg[len], SIZE-len, "<td>וגרהנש סיסמנ</td>")
  1221.    
  1222.     len += formatex(msg[len], SIZE-len, "<td>וגרהנש םידרוש</td>")
  1223.    
  1224.     len += formatex(msg[len], SIZE-len, "<td>םיבמוזל וכפהנש םישנא</td></tr>")
  1225.    
  1226.     new name[45], totalpoints, hkzpoints, hknpoints, zih, zks, zkh
  1227.    
  1228.     new count = 1
  1229.     while(SQL_MoreResults(Query))
  1230.     {
  1231.         // columns start at 0
  1232.         totalpoints = SQL_ReadResult(Query, 2)
  1233.         hkzpoints = SQL_ReadResult(Query, 3)
  1234.         hknpoints = SQL_ReadResult(Query, 4)
  1235.         zih = SQL_ReadResult(Query, 7)
  1236.         zks = SQL_ReadResult(Query, 9)
  1237.         zkh = SQL_ReadResult(Query, 10)
  1238.         SQL_ReadResult(Query, 0, name, 44)
  1239.        
  1240.        
  1241.         len += formatex(msg[len], SIZE-len, "<tr><td>%i.</td>", count)
  1242.        
  1243.         len += formatex(msg[len], SIZE-len, "<td>%s</td>", name)
  1244.        
  1245.         len += formatex(msg[len], SIZE-len, "<td>%i</td>", totalpoints)
  1246.        
  1247.         len += formatex(msg[len], SIZE-len, "<td>%i</td>", hkzpoints / 6)
  1248.        
  1249.         len += formatex(msg[len], SIZE-len, "<td>%i</td>", zkh / 4, zkh)
  1250.        
  1251.         len += formatex(msg[len], SIZE-len, "<td>%i</td>", hknpoints / 10)
  1252.        
  1253.         len += formatex(msg[len], SIZE-len, "<td>%i</td>", zks / 10)
  1254.        
  1255.         len += formatex(msg[len], SIZE-len, "<td>%i</td></tr>", zih / 3)
  1256.        
  1257.         count++
  1258.        
  1259.         SQL_NextRow(Query)
  1260.     }
  1261.    
  1262.     len = formatex(msg[len], SIZE-len, "</table></body></html>")
  1263.    
  1264.     show_motd(id, msg, "Top10")
  1265.    
  1266.     return PLUGIN_CONTINUE
  1267. }
  1268.  
  1269. public cmdRank(id)
  1270. {
  1271.     if(!g_LoggedIn[id])
  1272.         return PLUGIN_HANDLED
  1273.    
  1274.     g_RankTempID = id
  1275.    
  1276.     SQL_ThreadQuery(g_SqlTuple,"rankThread","SELECT username, totalpoints FROM zp_rabs ORDER BY totalpoints DESC")
  1277.    
  1278.     return PLUGIN_CONTINUE
  1279. }
  1280.  
  1281. public rankThread(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
  1282. {
  1283.     if(FailState == TQUERY_CONNECT_FAILED)
  1284.         return set_fail_state(".LQSל רבחתיהל ןתינ אל")
  1285.     else if(FailState == TQUERY_QUERY_FAILED)
  1286.         return set_fail_state("Query failed.")
  1287.    
  1288.     if(Errcode)
  1289.         return log_amx(":%s תתליאש לע האיגש",Error)
  1290.    
  1291.     new iRowsFound = SQL_NumRows(Query)
  1292.    
  1293.     new szName[50]
  1294.     new iRank
  1295.     new iRowCount
  1296.    
  1297.     while(SQL_MoreResults(Query))
  1298.     {
  1299.         iRowCount++
  1300.        
  1301.         SQL_ReadResult(Query, 0, szName, 49)
  1302.        
  1303.         if(equal(g_szTempName[g_RankTempID], szName))
  1304.         {
  1305.             iRank = iRowCount
  1306.             break
  1307.         }
  1308.        
  1309.         SQL_NextRow(Query)
  1310.     }
  1311.    
  1312.     client_print(g_RankTempID, print_chat, ".תודוקנ %i םע %i ךותמ %i אוה ךלש קנארה",g_TotalPoints[g_RankTempID], iRowsFound, iRank)
  1313.    
  1314.    
  1315.     return PLUGIN_CONTINUE
  1316. }
  1317.  
  1318. /* END: STATUS POINTS SYSTEM FUNCTIONS */
  1319.  
  1320. /* From Here: REGISTER SYSTEM FUNCTIONS +*+*+*+ */
  1321. public menuRegister(id)
  1322. {
  1323.     // Show him the menu just if he isnt logged in so far
  1324.     if(g_LoggedIn[id] && is_valid_player(id))
  1325.     {
  1326.         client_print(id, print_chat, ".שדחמ רבחתהל הצור התא םא תרשל שדחמ סנכ.רבוחמ רבכ התא ]תורבחתה[")
  1327.     }
  1328.     if(!g_LoggedIn[id] && is_valid_player(id))
  1329.     {
  1330.         new menuLoginCreate = menu_create("\yתורבחתה תכרעמ", "menuLoginCreateHandler")
  1331.        
  1332.         menu_additem(menuLoginCreate, "\wשדח שמתשמ", "1")
  1333.         menu_additem(menuLoginCreate, "\rתורבחתה^n", "2")
  1334.        
  1335.         menu_display(id, menuLoginCreate, 0)
  1336.        
  1337.         // Prevent them from Joining a Team
  1338.         return PLUGIN_HANDLED
  1339.     }
  1340.    
  1341.     return PLUGIN_CONTINUE
  1342. }
  1343.  
  1344. public menuLoginCreateHandler(id, menuLoginCreate, item)
  1345. {      
  1346.     new data[6], iName[64], access, callback
  1347.     menu_item_getinfo(menuLoginCreate, item, access, data, 5, iName, 63, callback)
  1348.    
  1349.     new key = str_to_num(data)
  1350.    
  1351.     switch(key)
  1352.     {
  1353.         // New Account
  1354.         case 1:
  1355.         {
  1356.             g_RegisterSelection[id] = 1
  1357.             client_cmd(id, "שמתשמ םש-העדוהה בצמ")
  1358.         }
  1359.         case 2:
  1360.         {
  1361.             g_RegisterSelection[id] = 2
  1362.             client_cmd(id, "שמתשמ םש-העדוהה בצמ")
  1363.         }
  1364.     }
  1365. }
  1366.  
  1367. public cmdUsername(id)
  1368. {
  1369.     // if user is already logged in stop him
  1370.     if(g_LoggedIn[id])
  1371.     {
  1372.         return PLUGIN_HANDLED
  1373.     }
  1374.    
  1375.     read_args(g_szTempName[id], 99)
  1376.     remove_quotes(g_szTempName[id])
  1377.    
  1378.     if(contain(g_szTempName[id], " ") != -1 || strlen(g_szTempName[id]) < 3)
  1379.     {
  1380.         client_print(id, print_chat, "[Login] Invalid Username. Try another one now.")
  1381.         client_cmd(id, "שמתשמ םש-העדוהה בצמ")
  1382.        
  1383.         return PLUGIN_HANDLED
  1384.     }
  1385.    
  1386.    
  1387.     if(g_RegisterSelection[id] == 1 || g_RegisterSelection[id] == 2)
  1388.     {
  1389.         new ErrorCode
  1390.         new Error[512]
  1391.         new Handle:SqlConnection = SQL_Connect(g_SqlTuple, ErrorCode, Error, 511)
  1392.        
  1393.         if(SqlConnection == Empty_Handle)
  1394.         {  
  1395.             set_fail_state(Error)
  1396.         }
  1397.        
  1398.         new Handle:Query = SQL_PrepareQuery(SqlConnection, "SELECT * FROM zp_rabs WHERE username='%s'", g_szTempName[id])
  1399.        
  1400.         if(!SQL_Execute(Query))
  1401.         {
  1402.             SQL_QueryError(Query, Error, 511)
  1403.             set_fail_state(Error)
  1404.         }
  1405.        
  1406.         new iRowsFound = SQL_NumRows(Query)
  1407.        
  1408.         switch(g_RegisterSelection[id])
  1409.         {
  1410.             case 1:
  1411.             {
  1412.                 // No Resluts
  1413.                 if(iRowsFound < 1)
  1414.                 {
  1415.                     client_cmd(id, "אמסיס-העדוהה בצמ")
  1416.                 }
  1417.                 // Username Found
  1418.                 else
  1419.                 {
  1420.                     client_print(id, print_chat, ".רחא שמתשמ םש רחב םייק רבכ התרחבש שמתשמה םש ]תורבחתה[")
  1421.                     client_cmd(id, "שמתשמ םש-העדוהה בצמ")
  1422.                 }
  1423.             }
  1424.             case 2:
  1425.             {
  1426.                 // No Resluts
  1427.                 if(iRowsFound < 1)
  1428.                 {
  1429.                     client_print(id, print_chat, ".בוש הסנ אנא !תכרעמב אצמנ אל נתמשרש שמתשמה םש ]תורבחתה[")
  1430.                     client_cmd(id, "שמתשמ םש-העדוהה בצמ")
  1431.                 }
  1432.                 // Username Found
  1433.                 else
  1434.                 {
  1435.                     client_cmd(id, "אמסיס-העדוהה בצמ")
  1436.                 }
  1437.             }
  1438.         }
  1439.        
  1440.        
  1441.         SQL_FreeHandle(Query)
  1442.         SQL_FreeHandle(SqlConnection)      
  1443.     }
  1444.    
  1445.     return PLUGIN_CONTINUE
  1446. }
  1447.  
  1448. public cmdPw(id)
  1449. {
  1450.     // if user is already logged in stop him
  1451.     if(g_LoggedIn[id] == true)
  1452.     {
  1453.         return PLUGIN_HANDLED
  1454.     }
  1455.    
  1456.     read_args(g_szTempPassWord[id], 99)
  1457.     remove_quotes(g_szTempPassWord[id])
  1458.    
  1459.     if(contain(g_szTempPassWord[id], " ") != -1 || strlen(g_szTempPassWord[id]) < 3 || strlen(g_szTempName[id]) < 3)
  1460.     {
  1461.         client_print(id, print_chat, ".אמסיס דוע הסנ !הנוכנ הניא התמשרש אמסיסה ]תורבחתה[")
  1462.         client_cmd(id, "אמסיס-העדוהה בצמ")
  1463.        
  1464.         return PLUGIN_HANDLED
  1465.     }
  1466.    
  1467.     switch(g_RegisterSelection[id])
  1468.     {
  1469.         // Register new User
  1470.         case 1:
  1471.         {
  1472.             new ErrorCode
  1473.             new Error[512]
  1474.             new Handle:SqlConnection = SQL_Connect(g_SqlTuple, ErrorCode, Error, 511)
  1475.            
  1476.             if(SqlConnection == Empty_Handle)
  1477.             {  
  1478.                 set_fail_state(Error)
  1479.             }
  1480.            
  1481.             new Handle:Query = SQL_PrepareQuery(SqlConnection, "INSERT INTO zp_rabs VALUES('%s','%s', '0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0')", g_szTempName[id], g_szTempPassWord[id])
  1482.            
  1483.             if(!SQL_Execute(Query))
  1484.             {
  1485.                 SQL_QueryError(Query, Error, 511)
  1486.                 set_fail_state(Error)
  1487.             }
  1488.            
  1489.             // Set him to zombies
  1490.             client_cmd(id, "jointeam 2")
  1491.            
  1492.             // Set user as new in User
  1493.             g_LoggedIn[id] = true
  1494.            
  1495.             // Print him a Message
  1496.             client_print(id, print_chat, ".שדח ןובשח החלצהב התרצי ]תורבחתה[")
  1497.             client_print(id, print_chat, "'%s' = שמתשמ םש ]תורבחתה[", g_szTempName[id])
  1498.             client_print(id, print_chat, "'%s' = אמסיס ]תורבחתה[", g_szTempPassWord[id])
  1499.            
  1500.             SQL_FreeHandle(Query)
  1501.             SQL_FreeHandle(SqlConnection)
  1502.         }
  1503.         // Login User
  1504.         case 2:
  1505.         {
  1506.             new ErrorCode
  1507.             new Error[512]
  1508.             new Handle:SqlConnection = SQL_Connect(g_SqlTuple, ErrorCode, Error, 511)
  1509.            
  1510.             if(SqlConnection == Empty_Handle)
  1511.             {  
  1512.                 set_fail_state(Error)
  1513.             }
  1514.            
  1515.             new Handle:Query = SQL_PrepareQuery(SqlConnection, "SELECT * FROM zp_rabs WHERE username='%s'", g_szTempName[id])
  1516.            
  1517.             if(!SQL_Execute(Query))
  1518.             {
  1519.                 SQL_QueryError(Query, Error, 511)
  1520.                 set_fail_state(Error)
  1521.             }
  1522.            
  1523.             new szSqlPassword[100]
  1524.             SQL_ReadResult(Query, 1, szSqlPassword, 99)
  1525.            
  1526.             // if password is right
  1527.             if(equal(g_szTempPassWord[id], szSqlPassword))
  1528.             {
  1529.                 // Kick Player who has logged in with same data
  1530.                 new players[32], pnum, tempid
  1531.                 get_players(players, pnum)
  1532.                
  1533.                 for(new i; i<pnum; i++)
  1534.                 {
  1535.                     tempid = players[i]
  1536.                     if(equal(g_szTempName[id], g_szTempName[tempid]) && id != tempid)
  1537.                     {
  1538.                         client_cmd(tempid, "קתנתה")
  1539.                     }
  1540.                 }
  1541.                
  1542.                 // Set him to zombies
  1543.                 client_cmd(id, "jointeam 2")
  1544.                 g_LoggedIn[id] = true
  1545.                
  1546.                 // Get Data from Database
  1547.                 g_TotalPoints[id] = SQL_ReadResult(Query, 2)
  1548.                 g_HumanKillsZombiePoints[id] = SQL_ReadResult(Query, 3)
  1549.                 g_HumanKillsNemesisPoints[id] = SQL_ReadResult(Query, 4)
  1550.                 g_SurvivorKillsZombiePoints[id] = SQL_ReadResult(Query, 5)
  1551.                 g_HumanKillsZombieKnifePoints[id] = SQL_ReadResult(Query, 6)
  1552.                 g_ZombieInfectsHumanPoints[id] = SQL_ReadResult(Query, 7)
  1553.                 g_NemesisKillsHuman[id] = SQL_ReadResult(Query, 8)
  1554.                 g_ZombieKillsSurvivor[id] = SQL_ReadResult(Query, 9)
  1555.                 g_ZombieKillsHumanPS[id] = SQL_ReadResult(Query, 10)
  1556.                 g_AP[id] = SQL_ReadResult(Query, 11)
  1557.                 g_Minutes[id] = SQL_ReadResult(Query, 12)
  1558.                 g_ZombieKillCount1[id] = SQL_ReadResult(Query, 13)
  1559.                 g_ZombieKillCount2[id] = SQL_ReadResult(Query, 14)
  1560.                 g_ZombieKillCount3[id] = SQL_ReadResult(Query, 15)
  1561.                 g_ZombieHSKillCount[id] = SQL_ReadResult(Query, 16)
  1562.                 g_Rounds[id] = SQL_ReadResult(Query, 17)
  1563.                 g_KillInfectCount1[id] = SQL_ReadResult(Query, 18)
  1564.                 g_KillInfectCount2[id] = SQL_ReadResult(Query, 19)
  1565.                 g_KillInfectCount3[id] = SQL_ReadResult(Query, 20)
  1566.                 g_gotKillInfectCount[id] = SQL_ReadResult(Query, 21)
  1567.                 g_nemeKillCountKnife[id] = SQL_ReadResult(Query, 22)
  1568.                 g_killzombieknife[id] = SQL_ReadResult(Query, 23)
  1569.                 g_winsurvivor[id] = SQL_ReadResult(Query, 24)
  1570.                 g_winnemesis[id] = SQL_ReadResult(Query, 25)
  1571.                 g_killsurvivorplague[id] = SQL_ReadResult(Query, 26)
  1572.                 g_killnemesisplague[id] = SQL_ReadResult(Query, 27)
  1573.                 g_kill600survivor[id] = SQL_ReadResult(Query, 28)
  1574.                 g_kill600nemesis[id] = SQL_ReadResult(Query, 29)
  1575.                 g_InfectionBombCount[id] = SQL_ReadResult(Query, 30)
  1576.                 g_SprayCount[id] = SQL_ReadResult(Query, 31)
  1577.                 g_awpkills[id] = SQL_ReadResult(Query, 32)
  1578.                 g_infectinrowcount1[id] = SQL_ReadResult(Query, 33)
  1579.                 g_infectinrowcount2[id] = SQL_ReadResult(Query, 34)
  1580.                 g_zmkillrowcount1[id] = SQL_ReadResult(Query, 35)
  1581.                 g_zmkillrowcount2[id] = SQL_ReadResult(Query, 36)
  1582.                 g_lasthumankillall[id] = SQL_ReadResult(Query, 37)
  1583.                
  1584.                 client_print(id, print_chat, "%s. אבה ךורב ]תורבחתה[", g_szTempName[id])
  1585.             }
  1586.             else
  1587.             {
  1588.                 client_print(id, print_chat, ".בוש הסנ !הנוכנ אל אמסיס ]תורבחתה[")
  1589.                 client_cmd(id, "messagemode szPassword")
  1590.             }
  1591.            
  1592.             SQL_FreeHandle(Query)
  1593.             SQL_FreeHandle(SqlConnection)
  1594.         }
  1595.     }
  1596.    
  1597.     return PLUGIN_CONTINUE
  1598. }
  1599.  
  1600. /* END: REGISTER SYSTEM FUNCTIONS +*+*+*+ */
  1601.  
  1602. public client_disconnect(id)
  1603. {  
  1604.     updateTable(id)
  1605.    
  1606.     g_LoggedIn[id] = false
  1607.     g_szTempName[id][0] = EOS
  1608.     g_szTempPassWord[id][0] = EOS
  1609.    
  1610.     g_TotalPoints[id] = 0
  1611.    
  1612.     g_HumanKillsNemesisPoints[id] = 0
  1613.     g_HumanKillsZombiePoints[id] = 0
  1614.     g_SurvivorKillsZombiePoints[id] = 0
  1615.     g_HumanKillsZombieKnifePoints[id] = 0
  1616.    
  1617.     g_ZombieInfectsHumanPoints[id] = 0
  1618.     g_NemesisKillsHuman[id] = 0
  1619.     g_ZombieKillsSurvivor[id] = 0
  1620.     g_ZombieKillsHumanPS[id] = 0
  1621.    
  1622.     g_AP[id] = 0
  1623.    
  1624.     g_Minutes[id] = 0
  1625.     g_ZombieKillCount1[id] = 0
  1626.     g_ZombieKillCount2[id] = 0
  1627.     g_ZombieKillCount3[id] = 0
  1628.     g_ZombieHSKillCount[id] = 0
  1629.     g_Rounds[id] = 0
  1630.     g_KillInfectCount1[id] = 0
  1631.     g_KillInfectCount2[id] = 0
  1632.     g_KillInfectCount3[id] = 0
  1633.     g_gotKillInfectCount[id] = 0
  1634.     g_killzombieknife[id] = 0
  1635.     g_nemeKillCountKnife[id] = 0
  1636.     g_killsurvivorplague[id] = 0
  1637.     g_killnemesisplague[id] = 0
  1638.     g_kill600survivor[id] = 0
  1639.     g_kill600nemesis[id] = 0
  1640.     g_InfectionBombCount[id] = 0
  1641.     g_SprayCount[id] = 0
  1642.     g_awpkills[id] = 0
  1643.     g_infectinrowcount1[id] = 0
  1644.     g_infectinrowcount2[id] = 0
  1645.     g_zmkillrowcount1[id] = 0
  1646.     g_zmkillrowcount2[id] = 0
  1647.     g_lasthumankillall[id] = 0
  1648. }
  1649.  
  1650. public updateTable(id)
  1651. {
  1652.     // Save Data
  1653.     if(g_LoggedIn[id])
  1654.     {
  1655.         new szQuery[2048]
  1656.         new len = 0
  1657.         g_AP[id] += zp_get_user_ammo_packs(id)
  1658.         zp_set_user_ammo_packs(id, 0)
  1659.        
  1660.         len += format(szQuery[len], 2048, "UPDATE zp_rabs SET ")
  1661.         len += format(szQuery[len], 2048-len,"totalpoints = '%i', ", g_TotalPoints[id])
  1662.         len += format(szQuery[len], 2048-len,"hkzpoints = '%i', ", g_HumanKillsZombiePoints[id])
  1663.         len += format(szQuery[len], 2048-len,"hknpoints = '%i', ", g_HumanKillsNemesisPoints[id])
  1664.         len += format(szQuery[len], 2048-len,"skzpoints = '%i', ", g_SurvivorKillsZombiePoints[id])
  1665.         len += format(szQuery[len], 2048-len,"hkzknifepoints = '%i', ", g_HumanKillsZombieKnifePoints[id])
  1666.         len += format(szQuery[len], 2048-len,"zihpoints = '%i', ", g_ZombieInfectsHumanPoints[id])
  1667.         len += format(szQuery[len], 2048-len,"nkhpoints = '%i', ", g_NemesisKillsHuman[id])
  1668.         len += format(szQuery[len], 2048-len,"zkspoints = '%i', ", g_ZombieKillsSurvivor[id])
  1669.         len += format(szQuery[len], 2048-len,"zkhpspoints = '%i', ", g_ZombieKillsHumanPS[id])
  1670.         len += format(szQuery[len], 2048-len,"ammopacks = '%i', ", g_AP[id])
  1671.         len += format(szQuery[len], 2048-len,"minutesplayed = '%i', ", g_Minutes[id])
  1672.         len += format(szQuery[len], 2048-len,"zombiekills1 = '%i', ", g_ZombieKillCount1[id])
  1673.         len += format(szQuery[len], 2048-len,"zombiekills2 = '%i', ", g_ZombieKillCount2[id])
  1674.         len += format(szQuery[len], 2048-len,"zombiekills3 = '%i', ", g_ZombieKillCount3[id])
  1675.         len += format(szQuery[len], 2048-len,"zombiehskills = '%i', ", g_ZombieHSKillCount[id])
  1676.         len += format(szQuery[len], 2048-len,"rounds = '%i', ", g_Rounds[id])
  1677.         len += format(szQuery[len], 2048-len,"humankillinfect1 = '%i', ", g_KillInfectCount1[id])
  1678.         len += format(szQuery[len], 2048-len,"humankillinfect2 = '%i', ", g_KillInfectCount2[id])
  1679.         len += format(szQuery[len], 2048-len,"humankillinfect3 = '%i', ", g_KillInfectCount3[id])
  1680.         len += format(szQuery[len], 2048-len,"gotkilledinfected = '%i', ", g_gotKillInfectCount[id])
  1681.         len += format(szQuery[len], 2048-len,"nemekillknife = '%i', ", g_nemeKillCountKnife[id])
  1682.         len += format(szQuery[len], 2048-len,"zombiekillknife = '%i', ", g_nemeKillCountKnife[id])
  1683.         len += format(szQuery[len], 2048-len,"winsurvivor = '%i', ", g_winsurvivor[id])
  1684.         len += format(szQuery[len], 2048-len,"winnemesis = '%i', ", g_winnemesis[id])
  1685.         len += format(szQuery[len], 2048-len,"ninja = '%i', ", g_killsurvivorplague[id])
  1686.         len += format(szQuery[len], 2048-len,"thinkfast = '%i', ", g_killnemesisplague[id])
  1687.         len += format(szQuery[len], 2048-len,"kill600survivor = '%i', ", g_kill600survivor[id])
  1688.         len += format(szQuery[len], 2048-len,"kill600nemesis = '%i', ", g_kill600nemesis[id])
  1689.         len += format(szQuery[len], 2048-len,"infectionbomb = '%i', ", g_InfectionBombCount[id])
  1690.         len += format(szQuery[len], 2048-len,"sprays = '%i', ", g_SprayCount[id])
  1691.         len += format(szQuery[len], 2048-len,"awpkills = '%i', ", g_awpkills[id])
  1692.         len += format(szQuery[len], 2048-len,"infectround1 = '%i', ", g_infectinrowcount1[id])
  1693.         len += format(szQuery[len], 2048-len,"infectround2 = '%i', ", g_infectinrowcount2[id])
  1694.         len += format(szQuery[len], 2048-len,"zmkillrow1 = '%i', ", g_zmkillrowcount1[id])
  1695.         len += format(szQuery[len], 2048-len,"zmkillrow2 = '%i', ", g_zmkillrowcount2[id])
  1696.         len += format(szQuery[len], 2048-len,"lasthumankillall = '%i' ", g_lasthumankillall[id])
  1697.         len += format(szQuery[len], 2048-len,"WHERE username = '%s'", g_szTempName[id])
  1698.        
  1699.         SQL_ThreadQuery(g_SqlTuple,"updateTableThread", szQuery)
  1700.     }
  1701. }
  1702.  
  1703. public updateTableThread(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
  1704. {
  1705.     // lots of error checking
  1706.     if(FailState == TQUERY_CONNECT_FAILED)
  1707.         return set_fail_state(".LQSל רבחתיהל ןתינ אל")
  1708.     else if(FailState == TQUERY_QUERY_FAILED)
  1709.         return set_fail_state(".הלשכנ התליאשה")
  1710.    
  1711.     if(Errcode)
  1712.         return log_amx("%s : תתליאש לע האיגש",Error)
  1713.    
  1714.     return PLUGIN_CONTINUE
  1715. }
  1716.  
  1717. public updateTableStats(id)
  1718. {
  1719.     // Save Data
  1720.     if(g_LoggedIn[id])
  1721.     {
  1722.         new szQuery[2048]
  1723.         new len = 0
  1724.        
  1725.         len += format(szQuery[len], 2048, "UPDATE zp_rabs SET ")
  1726.         len += format(szQuery[len], 2048-len,"totalpoints = '%i', ", g_TotalPoints[id])
  1727.         len += format(szQuery[len], 2048-len,"hkzpoints = '%i', ", g_HumanKillsZombiePoints[id])
  1728.         len += format(szQuery[len], 2048-len,"hknpoints = '%i', ", g_HumanKillsNemesisPoints[id])
  1729.         len += format(szQuery[len], 2048-len,"skzpoints = '%i', ", g_SurvivorKillsZombiePoints[id])
  1730.         len += format(szQuery[len], 2048-len,"hkzknifepoints = '%i', ", g_HumanKillsZombieKnifePoints[id])
  1731.         len += format(szQuery[len], 2048-len,"zihpoints = '%i', ", g_ZombieInfectsHumanPoints[id])
  1732.         len += format(szQuery[len], 2048-len,"nkhpoints = '%i', ", g_NemesisKillsHuman[id])
  1733.         len += format(szQuery[len], 2048-len,"zkspoints = '%i', ", g_ZombieKillsSurvivor[id])
  1734.         len += format(szQuery[len], 2048-len,"zkhpspoints = '%i' ", g_ZombieKillsHumanPS[id])
  1735.         len += format(szQuery[len], 2048-len,"WHERE username = '%s'", g_szTempName[id])
  1736.        
  1737.         SQL_ThreadQuery(g_SqlTuple,"updateTableStatsThread", szQuery)
  1738.     }
  1739. }
  1740.  
  1741. public updateTableStatsThread(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
  1742. {
  1743.     // lots of error checking
  1744.     if(FailState == TQUERY_CONNECT_FAILED)
  1745.         return set_fail_state("Could not connect to SQL database.")
  1746.     else if(FailState == TQUERY_QUERY_FAILED)
  1747.         return set_fail_state("Query failed.")
  1748.    
  1749.     if(Errcode)
  1750.         return log_amx("%s : תתליאש לע האיגש",Error)
  1751.    
  1752.     return PLUGIN_CONTINUE
  1753. }
  1754.  
  1755. public menuBank(id)
  1756. {  
  1757.     if(g_LoggedIn[id] && is_valid_player(id))
  1758.     {
  1759.         new title[100]
  1760.        
  1761.         formatex(title, 99, "\w] %i \r : yילקש wנב[", g_AP[id])
  1762.        
  1763.        
  1764.         new bankMenu = menu_create(title, "menuBankHandler")
  1765.        
  1766.         menu_additem(bankMenu, "\wםוכס חק", "1")
  1767.         menu_additem(bankMenu, "\wלכה חק^n", "2")
  1768.        
  1769.         menu_additem(bankMenu, "\wםוכס רומש", "3")
  1770.         menu_additem(bankMenu, "\wלכה רומש^n", "4")
  1771.        
  1772.         menu_additem(bankMenu, "\wםוכס םורת^n^n", "5")
  1773.        
  1774.        
  1775.         menu_display(id, bankMenu, 0)
  1776.     }
  1777.     else client_print(id, print_chat, ".רבחתיהל ידכ '/login' וא 'מןעםך.' םושרת ]תורבחתה[")
  1778.    
  1779.     return PLUGIN_HANDLED;
  1780. }
  1781.  
  1782. public menuBankHandler(id, menu, item)
  1783. {      
  1784.     new data[6], iName[64], access, callback
  1785.     menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback)
  1786.    
  1787.     new key = str_to_num(data)
  1788.    
  1789.     switch(key)
  1790.     {
  1791.         case 1:
  1792.         {
  1793.             client_cmd(id, "םוכס חק - העדוה בצמ")
  1794.         }
  1795.         case 2:
  1796.         {
  1797.             cmdTakeAll(id)
  1798.         }
  1799.         case 3:
  1800.         {
  1801.             client_cmd(id, "םוכס רומש - העדוה בצמ")
  1802.         }
  1803.         case 4:
  1804.         {
  1805.             cmdSaveAll(id)
  1806.         }
  1807.         case 5:
  1808.         {
  1809.             menuDonate(id)
  1810.         }
  1811.     }
  1812. }
  1813.  
  1814. public cmdTakeAmount(id)
  1815. {
  1816.     if(!g_LoggedIn[id]) return PLUGIN_HANDLED
  1817.     new szAps[11]
  1818.     read_args(szAps, 10)
  1819.     remove_quotes(szAps)
  1820.    
  1821.     if(equal(szAps, "") || equal(szAps, " "))
  1822.         return PLUGIN_HANDLED
  1823.    
  1824.     new iAps = str_to_num(szAps)
  1825.    
  1826.     if(iAps < 1) return PLUGIN_HANDLED
  1827.    
  1828.     new iApsSum = iAps + zp_get_user_ammo_packs(id)
  1829.    
  1830.     if(iAps <= g_AP[id] && iApsSum <= 999)
  1831.     {
  1832.         zp_set_user_ammo_packs(id, iApsSum)
  1833.         g_AP[id] -= iAps
  1834.        
  1835.         client_print(id, print_chat, ".םילקש %i קנבב ךל שי וישכעו.ךלש קנבה ךותמ םילקש %i התחקל ]קנב ויגלפ יבמוז[", g_AP[id], iAps)
  1836.        
  1837.         return PLUGIN_CONTINUE
  1838.     }
  1839.     else
  1840.     {
  1841.         client_print(id, print_chat, ".ידמ לודג םוכס התמשרש וא םילקש קיפסמ ךל ןיא ]קנב ויגלפ יבמוז[")
  1842.     }
  1843.    
  1844.     return PLUGIN_CONTINUE
  1845. }
  1846.  
  1847. public cmdTakeAll(id)
  1848. {
  1849.     new iApsSum = zp_get_user_ammo_packs(id) + g_AP[id]
  1850.    
  1851.     if(iApsSum <= 999)
  1852.     {
  1853.         zp_set_user_ammo_packs(id, iApsSum)
  1854.        
  1855.         client_print(id, print_chat, ".קנבהמ ךלש םילקש %i לכ תא התחחקל ]קנב ויגלפ יבמוז[", g_AP[id])
  1856.        
  1857.         g_AP[id] = 0
  1858.     }
  1859.     else if(iApsSum > 999)
  1860.     {
  1861.         new giveAps = 999 - zp_get_user_ammo_packs(id)
  1862.        
  1863.         if(giveAps <= g_AP[id])
  1864.         {
  1865.             zp_set_user_ammo_packs(id, giveAps + zp_get_user_ammo_packs(id))
  1866.             g_AP[id] -= giveAps
  1867.            
  1868.             client_print(id, print_chat, ".קנבב םילקש %i ךל שי וישכע .ךלש קנבהמ םילקש %i התחקל]קנב ויגלפ יבמוז[", g_AP[id], giveAps)
  1869.         }
  1870.     }
  1871. }
  1872.  
  1873. public cmdSaveAmount(id)
  1874. {
  1875.     if(!g_LoggedIn[id]) return PLUGIN_HANDLED
  1876.     new szAps[11]
  1877.     read_args(szAps, 10)
  1878.     remove_quotes(szAps)
  1879.    
  1880.     if(equal(szAps, "") || equal(szAps, " "))
  1881.         return PLUGIN_HANDLED
  1882.    
  1883.     new iAps = str_to_num(szAps)
  1884.    
  1885.     if(iAps < 1) return PLUGIN_HANDLED
  1886.    
  1887.     new haveAps = zp_get_user_ammo_packs(id)
  1888.    
  1889.     if(iAps <= haveAps)
  1890.     {
  1891.         zp_set_user_ammo_packs(id, haveAps - iAps)
  1892.         g_AP[id] += iAps
  1893.        
  1894.         client_print(id, print_chat, "%i. ךל שי וישכעו ךלש קנבב םילקש %i התרמש התא]קנב ויגלפ יבמוז[", g_AP[id], iAps)
  1895.     }
  1896.     else
  1897.     {
  1898.         client_print(id, print_chat, ".םילקש קיפסמ ךל ןיא]קנב ויגלפ יבמוז[")
  1899.     }
  1900.    
  1901.     return PLUGIN_CONTINUE
  1902. }
  1903.  
  1904. public cmdSaveAll(id)
  1905. {
  1906.     new haveAps = zp_get_user_ammo_packs(id)
  1907.    
  1908.     zp_set_user_ammo_packs(id, 0)
  1909.     g_AP[id] += haveAps
  1910.    
  1911.     client_print(id, print_chat, ".םילקש %i ךל שי וישכע ךלש קנבב םילקש %i התרמש]קנב ויגלפ יבמוז[", g_AP[id], haveAps)
  1912. }
  1913.  
  1914. public menuDonate(id)
  1915. {
  1916.     new DonateMenu = menu_create("\r:ול םורתל ידכ ןקחש רחב", "menuDonateHandler")
  1917.    
  1918.     new players[32], pnum, tempid
  1919.    
  1920.     new szName[32], szTempid[10]
  1921.    
  1922.     get_players(players, pnum)
  1923.    
  1924.     for( new i; i<pnum; i++ )
  1925.     {
  1926.         tempid = players[i]
  1927.        
  1928.         if(id != tempid)
  1929.         {
  1930.             get_user_name(tempid, szName, 31)
  1931.             num_to_str(tempid, szTempid, 9)
  1932.            
  1933.             menu_additem(DonateMenu, szName, szTempid, 0)
  1934.         }
  1935.     }
  1936.    
  1937.     menu_display(id, DonateMenu, 0)
  1938. }
  1939.  
  1940. public menuDonateHandler(id, menu, item)
  1941. {  
  1942.     new data[6], iName[64];
  1943.     new access, callback;
  1944.     menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
  1945.    
  1946.     new tempid = str_to_num(data);
  1947.    
  1948.     g_DonateID[id] = tempid
  1949.    
  1950.     client_cmd(id, "המורת - העדוה בצמ")
  1951.    
  1952.     menu_destroy(menu);
  1953.     return PLUGIN_HANDLED;
  1954. }
  1955.  
  1956. public cmdDonate(id)
  1957. {
  1958.     if(!g_LoggedIn[id] && g_DonateID[id] == 0) return PLUGIN_HANDLED
  1959.    
  1960.     new szAps[11]
  1961.     read_args(szAps, 10)
  1962.     remove_quotes(szAps)
  1963.    
  1964.     if(equal(szAps, "") || equal(szAps, " "))
  1965.         return PLUGIN_HANDLED
  1966.    
  1967.     new iAps = str_to_num(szAps)
  1968.    
  1969.     if(iAps < 1) return PLUGIN_HANDLED
  1970.    
  1971.     if(iAps <= g_AP[id])
  1972.     {
  1973.         // Take iAps away
  1974.         g_AP[id] -= iAps
  1975.        
  1976.         new NameDonate[45]
  1977.         get_user_name(g_DonateID[id], NameDonate, 44)
  1978.         new Name[45]
  1979.         get_user_name(g_DonateID[id], Name, 44)
  1980.        
  1981.         client_print(id, print_chat, ".קנבב םילקש %i ךל שי וישכע.s%ל םילקש %i התמרת ]קנב ויגלפ יבמוז[", g_AP[id], NameDonate, iAps)
  1982.        
  1983.         // give iAps to Donateid
  1984.         g_AP[g_DonateID[id]] += iAps
  1985.         client_print(g_DonateID[id], print_chat, ".קנבב םילקש %i ךל שי וישכע.םילקש %i ךל םרת %s ]קנב ויגלפ יבמוז[", Name, iAps, g_AP[g_DonateID[id]])
  1986.     }
  1987.     else
  1988.     {
  1989.         client_print(id, print_chat, ".םילקש קיפסמ ךל ןיא ]קנב ויגלפ יבמוז[")
  1990.     }
  1991.    
  1992.     return PLUGIN_CONTINUE
  1993. }
  1994.  
  1995. public plugin_end()
  1996. {
  1997.     SQL_FreeHandle(g_SqlTuple)
  1998. }
Advertisement
Add Comment
Please, Sign In to add comment