Advertisement
Guest User

mosz

a guest
Sep 11th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.52 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <cstrike>
  3. #include <fun>
  4. #include <hamsandwich>
  5. #include <cs_player_models_api>
  6.  
  7. new Array:g_Array, bool:g_Vip[33], g_Hudmsg;
  8.  
  9. new const g_Langcmd[][]={"say /vips","say_team /vips","say /vipy","say_team /vipy"};
  10.  
  11. new const gModelVipCT[] = "vipctsail";
  12. new const gModelVipCTPobieranie[] = "models/player/vipctsail/vipctsail.mdl";
  13. new const gModelVipTT[] = "vipttsail";
  14. new const gModelVipTTPobieranie[] = "models/player/vipttsail/vipttsail.mdl";
  15. new const gModelVipTTPobieranieTxt[] = "models/player/vipttsail/vipttsailT.mdl";
  16. public plugin_init(){
  17. register_plugin("VIP Ultimate", "12.3.0.2", "benio101 & speedkill");
  18. RegisterHam(Ham_Spawn, "player", "SpawnedEventPre", 1);
  19. register_event("DeathMsg", "DeathMsg", "a");
  20. register_event("ResetHUD", "fwSpawnvip", "b")
  21. register_message(get_user_msgid("ScoreAttrib"), "VipStatus");
  22. g_Array=ArrayCreate(64,32);
  23. for(new i;i<sizeof g_Langcmd;i++){
  24. register_clcmd(g_Langcmd[i], "ShowVips");
  25. }
  26. register_clcmd("say /vip", "ShowMotd");
  27. register_message(get_user_msgid("SayText"),"handleSayText");
  28. g_Hudmsg=CreateHudSyncObj();
  29. }
  30. public plugin_precache()
  31.  
  32. {
  33.  
  34.  
  35. precache_model(gModelVipCTPobieranie);
  36. precache_model(gModelVipTTPobieranie);
  37. precache_model(gModelVipTTPobieranieTxt);
  38.  
  39. }
  40. public client_authorized(id){
  41. if(get_user_flags(id) & 262144 == 262144){
  42. client_authorized_vip(id);
  43. }
  44. }
  45. public client_authorized_vip(id){
  46. g_Vip[id]=true;
  47. new g_Name[64];
  48. get_user_name(id,g_Name,charsmax(g_Name));
  49.  
  50. new g_Size = ArraySize(g_Array);
  51. new szName[64];
  52.  
  53. for(new i = 0; i < g_Size; i++){
  54. ArrayGetString(g_Array, i, szName, charsmax(szName));
  55.  
  56. if(equal(g_Name, szName)){
  57. return 0;
  58. }
  59. }
  60. ArrayPushString(g_Array,g_Name);
  61. set_hudmessage(24, 190, 220, 0.25, 0.2, 0, 6.0, 6.0);
  62. ShowSyncHudMsg(0, g_Hudmsg, "Vip %s wbija na serwer !",g_Name);
  63.  
  64. return PLUGIN_CONTINUE;
  65. }
  66. public client_disconnect(id){
  67. if(g_Vip[id]){
  68. client_disconnect_vip(id);
  69. }
  70. }
  71. public client_disconnect_vip(id){
  72. g_Vip[id]=false;
  73. new Name[64];
  74. get_user_name(id,Name,charsmax(Name));
  75.  
  76. new g_Size = ArraySize(g_Array);
  77. new g_Name[64];
  78.  
  79. for(new i = 0; i < g_Size; i++){
  80. ArrayGetString(g_Array, i, g_Name, charsmax(g_Name));
  81.  
  82. if(equal(g_Name,Name)){
  83. ArrayDeleteItem(g_Array,i);
  84. break;
  85. }
  86. }
  87. }
  88. public fwSpawnvip(id)
  89.  
  90. {
  91.  
  92. if ( !is_user_alive(id) )
  93.  
  94. return HAM_IGNORED;
  95.  
  96.  
  97.  
  98. new CsTeams:userTeam = cs_get_user_team(id);
  99.  
  100.  
  101.  
  102. if(get_user_flags(id) & ADMIN_LEVEL_G)
  103.  
  104. {
  105.  
  106. if (userTeam == CS_TEAM_T)
  107.  
  108. {
  109.  
  110. cs_set_player_model(id, gModelVipTT);
  111.  
  112. }
  113.  
  114. else if(userTeam == CS_TEAM_CT)
  115.  
  116. {
  117.  
  118. cs_set_player_model(id, gModelVipCT);
  119.  
  120. }
  121.  
  122. else
  123.  
  124. cs_reset_player_model(id)
  125.  
  126.  
  127.  
  128.  
  129. }
  130. return HAM_IGNORED;
  131.  
  132. }
  133.  
  134. public SpawnedEventPre(id){
  135. if(g_Vip[id]){
  136. if(is_user_alive(id)){
  137. SpawnedEventPreVip(id);
  138. }
  139. }
  140. }
  141. public SpawnedEventPreVip(id){
  142. set_user_health(id,110);
  143.  
  144.  
  145. }
  146.  
  147. public DeathMsg(){
  148. new killer=read_data(1);
  149. new victim=read_data(2);
  150.  
  151. if(is_user_alive(killer) && g_Vip[killer] && get_user_team(killer) != get_user_team(victim)){
  152. DeathMsgVip(killer,victim,read_data(3));
  153. }
  154. }
  155. public DeathMsgVip(kid,vid,hs){
  156. set_user_health(kid, min(get_user_health(kid)+(hs?15:10),120));
  157. }
  158. public VipStatus(){
  159. new id=get_msg_arg_int(1);
  160. if(is_user_alive(id) && g_Vip[id]){
  161. set_msg_arg_int(2, ARG_BYTE, get_msg_arg_int(2)|4);
  162. }
  163. }
  164. public ShowVips(id){
  165. return PLUGIN_CONTINUE;
  166. }
  167. public client_infochanged(id){
  168. if(g_Vip[id]){
  169. new szName[64];
  170. get_user_info(id,"name",szName,charsmax(szName));
  171.  
  172. new Name[64];
  173. get_user_name(id,Name,charsmax(Name));
  174.  
  175. if(!equal(szName,Name)){
  176. ArrayPushString(g_Array,szName);
  177.  
  178. new g_Size=ArraySize(g_Array);
  179. new g_Name[64];
  180. for(new i = 0; i < g_Size; i++){
  181. ArrayGetString(g_Array, i, g_Name, charsmax(g_Name));
  182.  
  183. if(equal(g_Name,Name)){
  184. ArrayDeleteItem(g_Array,i);
  185. break;
  186. }
  187. }
  188. }
  189. }
  190. }
  191. public plugin_end(){
  192. ArrayDestroy(g_Array);
  193. }
  194. public ShowMotd(id){
  195. show_motd(id, "vip.txt", "Informacje o vipie");
  196. }
  197. public handleSayText(msgId,msgDest,msgEnt){
  198.  
  199. new id = get_msg_arg_int(1);
  200.  
  201. if(is_user_connected(id) && g_Vip[id]){
  202.  
  203. new szTmp[192], szTmp2[192];
  204. get_msg_arg_string(2, szTmp, charsmax(szTmp));
  205.  
  206. new szPrefix[64] = "^x04[VIP]";
  207.  
  208. if(!equal(szTmp,"#Cstrike_Chat_All")){
  209. add(szTmp2, charsmax(szTmp2), "^x01");
  210. add(szTmp2, charsmax(szTmp2), szPrefix);
  211. add(szTmp2, charsmax(szTmp2), " ");
  212. add(szTmp2, charsmax(szTmp2), szTmp);
  213. }
  214. else{
  215. new szPlayerName[64];
  216. get_user_name(id, szPlayerName, charsmax(szPlayerName));
  217.  
  218. get_msg_arg_string(4, szTmp, charsmax(szTmp)); //4. argument zawiera tre�� wys�anej wiadomo�ci
  219. set_msg_arg_string(4, ""); //Musimy go wyzerowa�, gdy� gra wykorzysta wiadomo�� podw�jnie co mo�e skutkowa� crash'em 191+ znak�w.
  220.  
  221. add(szTmp2, charsmax(szTmp2), "^x01");
  222. add(szTmp2, charsmax(szTmp2), szPrefix);
  223. add(szTmp2, charsmax(szTmp2), "^x03 ");
  224. add(szTmp2, charsmax(szTmp2), szPlayerName);
  225. add(szTmp2, charsmax(szTmp2), "^x01 : ");
  226. add(szTmp2, charsmax(szTmp2), szTmp)
  227. }
  228.  
  229. set_msg_arg_string(2, szTmp2);
  230. }
  231. return PLUGIN_CONTINUE;
  232. }
  233. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  234. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
  235. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement