Advertisement
Guest User

HarbuRP The Specialists

a guest
Jul 21st, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 45.83 KB | None | 0 0
  1. //////////////////////////////////////
  2. // HarbuRP Plugins Items ADD-On Pack
  3. //////////////////////////////////////
  4.  
  5.  
  6. #pragma dynamic 32768
  7.  
  8. #include <amxmodx>
  9. #include <amxmisc>
  10. #include <dbi>
  11. #include <tsx>
  12. #include <tsxaddon>
  13. #include <engine>
  14. #include <fun>
  15.  
  16. /*  THE LIST OF THE VALUES THAT CAN BE CHANGED
  17.  
  18.     Everything under here can/must be changed according to your
  19.     needs and settings
  20.  
  21. */
  22.  
  23. #define MAXIUMSTR 1024      // Length that SQL results can be
  24. #define MAXDOORS 32     // Maxium amount of doors that can be blowed up at the same time
  25.  
  26.  
  27. #define ITEMS 200       // Maxium amount of items user can have
  28. #define MCMDPACK 7      // ItemID for First Aid Kit
  29. #define MCMDPACKTWO 19      // Operation Kit
  30. #define SPRAYPACK 6     // ItemID for Spraycan
  31. #define MONEYTREE 500       // ItemID for Money Tree
  32. #define PIZZA 44        // ItemID for Pizza
  33.  
  34. #define PIZZAJOB 268        // JobID for a 'Pizza Boy' Job
  35. #define FOOD_SLOWDOWN 160   // How much speed to slowdown while eating
  36.  
  37.  
  38. /*  LIST ENDS HERE
  39.    
  40.     Only edit below if you know what you are doing
  41. */
  42.  
  43. // Variables
  44. new fire, rope
  45. new lightning
  46. new smoke
  47. new tazerd[33][2]           // Which color is the player glowing?, Speed?
  48. new alcohol[33][3]          // Has user passed out?, Current Procent?
  49. new smokevar[33][5]         // Used for storing if cig in mouth and if countdown of cig time
  50. new foodmouth[33]           // Does user have food in his mouth?
  51. new mcmdjobs[2] = {41,46}       // ALL MCPD jobs have to be between certain JOBIDS
  52. new Float:nullorigin[3] = {0.0,0.0,0.0} // Origin to where exploded door is temporarely keepen
  53. new Float:g_door_explode[MAXDOORS][3]       // Storing Doors old origins
  54. new Sql:dbc
  55. new Result:result
  56. new gmsgFade
  57. new DOOR_GIBS               // For keeping the door piece model
  58. new roped[33]               // If player is roped stores ropers player ID
  59.  
  60. // Timer Variables
  61. new minute = 0
  62. new hour = 20
  63. new day = 1
  64. new month = 1
  65. new year = 2005
  66.  
  67. new monthname[13][33] = {"","January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}
  68. new monthday[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31}
  69.  
  70.  
  71. // Thanks for Ben 'Promethus' for this script
  72. stock explode( output[][], input[], delimiter)
  73. {
  74.     new nIdx = 0
  75.     new iStringSize
  76.     while ( input[iStringSize] )
  77.         iStringSize++
  78.     new nLen = (1 + copyc( output[nIdx], iStringSize-1, input, delimiter ))
  79.  
  80.     while( nLen < strlen(input) )
  81.         nLen += (1 + copyc( output[++nIdx], iStringSize-1, input[nLen], delimiter ))
  82.     return nIdx + 1
  83. }
  84.  
  85. // Precaching necessary sprites
  86. public plugin_precache()
  87. {
  88.     smoke = precache_model("sprites/steam1.spr")        // Smoke sprite for smoking ciggs
  89.     DOOR_GIBS = precache_model( "models/woodgibs.mdl" ) // Woodgibs when you break a door
  90.     fire = precache_model("sprites/explode1.spr")       // Explosion of a door or kamikaze bombs
  91.     lightning = precache_model("sprites/lgtning.spr")   // Lightning effect from Tazer
  92.     rope = precache_model("sprites/rope.spr")       // Rope Sprite for rope item
  93.     precache_sound("phone/2.wav")
  94.     precache_sound("harburp/tazer.wav")
  95.     precache_sound("harburp/heart.wav")
  96.     precache_sound( "weapons/sfire-inslow.wav" )
  97. }
  98.  
  99. public plugin_init()
  100. {
  101.     register_plugin("Harbu RP Items Addon","Alpha 0.2a","Harbu")
  102.  
  103.     register_srvcmd("item_atm","item_atm")
  104.     register_srvcmd("item_food","item_food")
  105.     register_srvcmd("item_cigs","item_cigs")
  106.     register_srvcmd("item_lighter","item_lighter")
  107.     register_srvcmd("item_aid","item_aid")
  108.     register_srvcmd("item_spray","item_spray")
  109.     register_srvcmd("item_cellphone","item_cellphone")
  110.     register_srvcmd("item_prepaid","item_prepaid")
  111.     register_srvcmd("item_flashbang","item_flashbang")
  112.     register_srvcmd("item_phonebook","item_phonebook")
  113.     register_srvcmd("item_invisibility","item_invisibility")
  114.     register_srvcmd("item_picklock","item_picklock")
  115.     register_srvcmd("item_doorexplode","item_doorexplode")
  116.     register_srvcmd("item_kamikaze","item_kamikaze")
  117.     register_srvcmd("item_tazer","item_tazer")
  118.     register_srvcmd("item_csyringe","item_csyringe")
  119.     register_srvcmd("item_spill","item_spill")
  120.     register_srvcmd("item_searcher","item_searcher")
  121.     register_srvcmd("item_alcohol","item_alcohol")
  122.     register_srvcmd("item_rope","item_rope")
  123.     register_srvcmd("item_watch","item_watch")
  124.  
  125.     // Spraycan
  126.     register_impulse(201,"sprayimpulse")
  127.     register_clcmd("say /tazer","shortcut_tazer",ADMIN_ALL," - Shortcut for tazer item")
  128.     register_event("DeathMsg","death_msg","a")
  129.     register_event("ResetHUD","spawn_msg", "be")
  130.     register_event("WStatus","client_dropweapon","be")
  131.  
  132.     // Register Cvars
  133.     register_cvar("itemmod_mysql_host","127.0.0.1")
  134.     register_cvar("itemmod_mysql_user","root")
  135.     register_cvar("itemmod_mysql_pass","")
  136.     register_cvar("itemmod_mysql_db","economy")
  137.  
  138.     register_cvar("rp_item_tazer","26")
  139.  
  140.     set_task(Float:8.0,"sql_item")
  141.     set_task(300.0,"moneytree",0,"",0,"b")
  142.     set_task(1.0,"time_advance",0,"",0,"b")
  143.  
  144.     gmsgFade = get_user_msgid("ScreenFade")
  145.  
  146.     hour = random_num(1,23)
  147.     month = random_num(1,12)
  148.     day = random_num(1,monthday[month])
  149.     year = random_num(2000,2010)
  150. }
  151.  
  152.  
  153. public shortcut_tazer(id)
  154. {
  155.     callfunc_begin ("item_use","HarbuRPAlpha.amxx")
  156.     callfunc_push_int(id)
  157.     callfunc_push_int(get_cvar_num("rp_item_tazer"))
  158.     callfunc_end()
  159.     return PLUGIN_HANDLED
  160. }
  161.  
  162. // Connecting to MySQL Database
  163. public sql_item()
  164. {
  165.     new host[64], username[32], password[32], dbname[32], error[32]
  166.     get_cvar_string("itemmod_mysql_host",host,64)
  167.         get_cvar_string("itemmod_mysql_user",username,32)
  168.         get_cvar_string("itemmod_mysql_pass",password,32)
  169.         get_cvar_string("itemmod_mysql_db",dbname,32)
  170.     dbc = dbi_connect(host,username,password,dbname,error,32)
  171.     if(dbc == SQL_FAILED)
  172.     {
  173.         server_print("^n[HarbuRP Items] Could Not Connect To SQL Database")
  174.     }
  175.     else
  176.     {
  177.     server_print("^n[HarbuRP Items] Connected To SQL, Have A Nice Day!")
  178.     }
  179. }
  180.  
  181. // Function for adding/subtracting money from your wallet and Bank balance
  182. public edit_value(id,table[],index[],func[],amount)
  183. {
  184.     new authid[32], query[256]
  185.     get_user_authid(id,authid,31)
  186.     if(equali(func,"="))
  187.     {
  188.         format(query,255,"UPDATE %s SET %s=%i WHERE steamid='%s'",table,index,amount,authid)
  189.     }
  190.     else
  191.     {
  192.         format(query,255,"UPDATE %s SET %s=%s%s%i WHERE steamid='%s'",table,index,index,func,amount,authid)
  193.     }
  194.     dbi_query(dbc,query)
  195.     return PLUGIN_HANDLED
  196. }
  197.  
  198. public select_string(table[],index[],condition[],equals[],output[],size)
  199. {
  200.     new query[256]
  201.     format(query,255,"SELECT %s FROM %s WHERE %s='%s'",index,table,condition,equals)
  202.     result = dbi_query(dbc,query)
  203.     if(dbi_nextrow(result) > 0) dbi_field(result,1,output,size)
  204.     dbi_free_result(result)
  205. }
  206.  
  207. // Check the amount of the specified item
  208. stock get_item_amount(id,itemid,table[],customid[]="")
  209. {
  210.     new authid[32], amount, query[256]
  211.     if(equali(customid,"")) get_user_authid(id,authid,31)
  212.     else format(authid,31,customid)
  213.     format(query,255,"SELECT items FROM %s WHERE steamid='%s'",table,authid)
  214.     result = dbi_query(dbc,query)
  215.     if(dbi_nextrow(result) > 0)
  216.     {
  217.         new field[MAXIUMSTR]
  218.         new output[ITEMS][32]
  219.         dbi_field(result,1,field,MAXIUMSTR-1)
  220.         dbi_free_result(result)
  221.         new total = explode(output,field,' ')
  222.         for( new i = 0;  i < total; i++ )
  223.         {
  224.             new output2[2][32]
  225.             explode(output2,output[i],'|')
  226.             if(str_to_num(output2[0]) == itemid)
  227.             {
  228.                 amount = str_to_num(output2[1]
  229.                 )
  230.                 dbi_free_result(result)
  231.                 return amount
  232.             }
  233.         }
  234.     }
  235.     dbi_free_result(result)
  236.     return amount
  237. }
  238.  
  239. // For Adding/Subtracting Items Quickly
  240. stock set_item_amount(id,func[],itemid,amount,table[],customid[]="")
  241. {
  242.     new authid[32], query[256], itemfield[MAXIUMSTR]
  243.     if(equali(customid,"")) get_user_authid(id,authid,31)
  244.     else format(authid,31,customid)
  245.     new currentamount = get_item_amount(id,itemid,table,customid)
  246.     format(query,255,"SELECT items FROM %s WHERE steamid='%s'",table,authid)
  247.     result = dbi_query(dbc,query)
  248.     if(dbi_nextrow(result) > 0)
  249.     {
  250.         dbi_field(result,1,itemfield,MAXIUMSTR-1)
  251.         dbi_free_result(result)
  252.  
  253.         if(equali(func,"-"))
  254.         {
  255.             new string[32]
  256.             format(string,31," %i|%i",itemid,currentamount)
  257.             if(containi(itemfield,string) != -1)
  258.             {
  259.                 if((currentamount - amount) <= 0)
  260.                 {
  261.                     replace(itemfield,MAXIUMSTR-1,string,"")
  262.                 }
  263.                 else
  264.                 {
  265.                     new newstring[32]
  266.                     format(newstring,31," %i|%i",itemid,currentamount-amount)
  267.                     replace(itemfield,MAXIUMSTR-1,string,newstring)
  268.                 }
  269.                 format(query,255,"UPDATE %s SET items='%s' WHERE steamid='%s'",table,itemfield,authid)
  270.                 dbi_query(dbc,query)
  271.             }
  272.             else
  273.             {
  274.                 client_print(id,print_chat,"[ItemMod] Error #150 LOOP. Please contact an administrator^n")
  275.                 dbi_free_result(result)
  276.                 return PLUGIN_HANDLED
  277.             }
  278.         }
  279.         if(equali(func,"+"))
  280.         {
  281.             if(get_item_amount(id,itemid,table,authid) == 0)
  282.             {
  283.                 new str[32]
  284.                 format(str,31," %i|%i",itemid,(currentamount +amount))
  285.                 add(itemfield,sizeof(itemfield),str)
  286.                 format(query,MAXIUMSTR-1,"UPDATE %s SET items='%s' WHERE steamid='%s'",table,itemfield,authid)
  287.                 dbi_query(dbc,query)
  288.             }
  289.             else
  290.             {
  291.                 if(currentamount > 0)
  292.                 {
  293.                     new newstr[32], oldstr[32]
  294.                     format(oldstr,31," %i|%i",itemid,currentamount)
  295.                     format(newstr,31," %i|%i",itemid,(currentamount +amount))
  296.                     replace(itemfield,255,oldstr,newstr)
  297.                     format(query,MAXIUMSTR-1,"UPDATE %s SET items='%s' WHERE steamid='%s'",table,itemfield,authid)
  298.                     dbi_query(dbc,query)
  299.                 }
  300.                 else
  301.                 {
  302.                     client_print(id,print_chat,"[ItemMod] Error #200. Please contact an administrator^n")
  303.                     dbi_free_result(result)
  304.                     return PLUGIN_HANDLED
  305.                 }
  306.             }
  307.         }
  308.     }
  309.     dbi_free_result(result)
  310.     return PLUGIN_HANDLED
  311. }
  312.  
  313.  
  314. ////////////////////////////////////
  315. //      ITEMS
  316. ///////////////////////////////////
  317.  
  318. // Checking if user uses spray button
  319. public sprayimpulse(id)
  320. {
  321.     if(get_item_amount(id,SPRAYPACK,"money") == 0)
  322.     {
  323.         client_print(id,print_chat,"[ItemMod] You need a spraycan to spray!^n")
  324.         return PLUGIN_HANDLED
  325.     }
  326.  
  327.     else
  328.     {
  329.         set_item_amount(id,"-",SPRAYPACK,1,"money")
  330.         return PLUGIN_CONTINUE
  331.     }
  332.     return PLUGIN_HANDLED
  333.    
  334. }
  335.  
  336. // Spraycan
  337. public item_spray()
  338. {
  339.     new id,arg[32]
  340.     read_argv(1,arg,31)
  341.     id = str_to_num(arg)
  342.     client_cmd(id,"impulse 201")
  343.     return PLUGIN_HANDLED
  344. }
  345.  
  346. // ATM Card
  347. public item_atm(id)
  348. {
  349.     new str[32], targetid
  350.     read_argv(1,str,31)
  351.     targetid = str_to_num(str)
  352.     client_print(targetid,print_chat,"[ItemMod] Can't be used through menu. Go to an ATM Machine and write /use^n")
  353.     return PLUGIN_HANDLED
  354. }
  355.  
  356. // All kinds of food/medikits etc.
  357. public item_food()
  358. {
  359.     new arg[32], arg2[32], arg3[32], arg4[32], arg5[32], id, query[256], authid[32], Float:addhunger, currenthunger, addhuntemp, itemid
  360.     read_argv(1,arg,31) // PlayerID
  361.     read_argv(2,arg2,31)    // Item Name
  362.     read_argv(3,arg3,31)    // Amount to recover of hunger
  363.     read_argv(4,arg4,31)    // ItemID
  364.     read_argv(5,arg5,31)    // Eating or Drinking
  365.     addhuntemp = str_to_num(arg3)
  366.     addhunger = float(addhuntemp)
  367.     itemid = str_to_num(arg4)
  368.     id = str_to_num(arg)
  369.  
  370.     if(foodmouth[id] == 1)
  371.     {
  372.         set_item_amount(id,"+",itemid,1,"money")
  373.  
  374.         client_print(id,print_chat,"[ItemMod] You are already eating/drinking something^n")
  375.         return PLUGIN_HANDLED
  376.     }
  377.  
  378.     get_user_authid(id,authid,31)
  379.     format(query,255,"SELECT hunger FROM money WHERE steamid='%s'",authid)
  380.     result = dbi_query(dbc,query)
  381.     if(dbi_nextrow(result) > 0)
  382.     {
  383.         currenthunger = dbi_field(result,1)
  384.         dbi_free_result(result)
  385.         if(currenthunger <= 10) {
  386.             set_item_amount(id,"+",itemid,1,"money")
  387.             client_print(id,print_chat,"[ItemMod] Your feel too full to eat, wait a while^n")
  388.             return PLUGIN_HANDLED
  389.         }
  390.         if(currenthunger >= 60) addhunger *= 1.5
  391.         if(currenthunger <= 30 && addhuntemp >= 40) addhunger *= 0.5
  392.  
  393.         new Float:speed = get_user_maxspeed(id)
  394.         speed -= float(FOOD_SLOWDOWN)
  395.         set_user_maxspeed(id,speed)
  396.    
  397.         foodmouth[id] = 1
  398.         set_task(0.5,"food_heal",id,"",0,"a",floatround(addhunger))
  399.         set_task((addhunger/2),"food_speed",id)
  400.  
  401.         client_print(id,print_chat,"[ItemMod] You start %sing one %s^n",arg5,arg2)
  402.     }
  403.     dbi_free_result(result)
  404.     return PLUGIN_HANDLED
  405. }
  406.  
  407. public food_heal(id)
  408. {
  409.     edit_value(id,"money","hunger","-",1)
  410.     return PLUGIN_HANDLED
  411. }
  412.  
  413. public food_speed(id)
  414. {
  415.     new Float:speed = get_user_maxspeed(id)
  416.     speed += float(FOOD_SLOWDOWN)
  417.     set_user_maxspeed(id,speed)
  418.     foodmouth[id] = 0
  419.     return PLUGIN_HANDLED
  420. }
  421.  
  422. // Used for medikit package - item_aid <id> "<targetname>" Heal_Amount Minium_HP ItemID
  423. public item_aid()
  424. {
  425.     new arg[32], arg2[32], arg3[32], id, targetid, amount, name[33], name2[33], arg4[32], minium, query[256], arg5[32], itemid
  426.     read_argv(1,arg,31)
  427.     read_argv(2,arg2,31)
  428.     read_argv(3,arg3,31)
  429.     read_argv(4,arg4,31)
  430.     read_argv(5,arg5,31)
  431.  
  432.     id = str_to_num(arg)
  433.     targetid = str_to_num(arg2)
  434.     amount = str_to_num(arg3)
  435.     minium = str_to_num(arg4)
  436.     itemid = str_to_num(arg5)
  437.  
  438.     get_user_name(id,name,sizeof(name))
  439.     get_user_name(targetid,name2,sizeof(name2))
  440.  
  441.     if(amount >= 80){
  442.         new authid[32]
  443.         get_user_authid(id,authid,31)
  444.         format(query,255,"SELECT JobID FROM money WHERE steamid='%s'",authid)
  445.         if(dbi_nextrow(result) > 0)
  446.         {
  447.             new JobID
  448.             JobID = dbi_field(result,1)
  449.             dbi_free_result(result)
  450.             if(JobID < mcmdjobs[0] && JobID > mcmdjobs[1])
  451.             {
  452.                 client_print(id,print_chat,"[HealMod] You have to work for MCMD to do operations!^n")
  453.                 set_item_amount(id,"+",itemid,1,"money")
  454.                 return PLUGIN_HANDLED
  455.             }
  456.         }
  457.     }
  458.  
  459.     new currenthealth = get_user_health(targetid)
  460.     if(currenthealth >= 100)
  461.     {
  462.         client_print(id,print_chat,"[HealMod] The person you are looking at has already full health^n")
  463.         set_item_amount(id,"+",itemid,1,"money")
  464.         return PLUGIN_HANDLED
  465.     }
  466.     if(currenthealth <= minium)
  467.     {
  468.         client_print(id,print_chat,"[HealMod] Too much damage! The person you are looking at need's a more advanced procedure^n")
  469.         set_item_amount(id,"+",itemid,1,"money")
  470.         return PLUGIN_HANDLED
  471.     }
  472.     if((currenthealth+amount) > 100)
  473.     {
  474.         new val = (currenthealth+amount) - 100
  475.         amount -=val
  476.     }
  477.     set_user_health(targetid,currenthealth+amount)
  478.     client_print(targetid,print_chat,"[HealMod] Received %i HP From Player %s!.^n",amount,name)
  479.     client_print(id,print_chat,"[HealMod] Gave %i HP To Player %s!.^n",amount,name2)
  480.     client_cmd(id,"speak ^"items/smallmedkit1^"")
  481.     client_cmd(targetid,"speak ^"items/smallmedkit1^"")
  482.     return PLUGIN_HANDLED
  483.  
  484. }
  485.  
  486. // Cigarettes item_cigs <id> <itemid> <hploose> <smoketime> <"mari" for marihuana>
  487. public item_cigs()
  488. {
  489.     new arg[32], arg2[32], arg3[32], arg4[32], arg5[32], id, itemid, minushp, smoketime
  490.     read_argv(1,arg,31)
  491.     read_argv(2,arg2,31)
  492.     read_argv(3,arg3,31)
  493.     read_argv(4,arg4,31)
  494.     read_argv(5,arg5,31)
  495.  
  496.     id = str_to_num(arg)
  497.     itemid = str_to_num(arg2)
  498.     minushp = str_to_num(arg3)
  499.     smoketime = str_to_num(arg4)
  500.  
  501.     if(smokevar[id][0] == 1 && smokevar[id][4] == 0) {
  502.         set_item_amount(id,"+",itemid,1,"money")
  503.         set_item_amount(id,"+",smokevar[id][1],1,"money")
  504.  
  505.         smokevar[id][0] = 0
  506.         smokevar[id][1] = 0
  507.         smokevar[id][2] = 0
  508.         smokevar[id][3] = 0
  509.  
  510.         client_print(id,print_chat,"[ItemMod] You take the smoke out of your mouth^n")
  511.         return PLUGIN_HANDLED
  512.     }
  513.     if(smokevar[id][0] == 1 && smokevar[id][4] == 1)
  514.     {
  515.         smokevar[id][0] = 0
  516.         smokevar[id][1] = 0
  517.         smokevar[id][2] = 0
  518.         smokevar[id][3] = 0
  519.         smokevar[id][4] = 0
  520.  
  521.         set_item_amount(id,"+",itemid,1,"money")
  522.  
  523.         client_print(id,print_chat,"[ItemMod] You throw the burning smoke on the ground^n")
  524.         return PLUGIN_HANDLED
  525.     }
  526.  
  527.  
  528.     smokevar[id][0] = 1
  529.     if( equal( arg5, "mari" ) ) smokevar[id][0] = 2
  530.     smokevar[id][1] = itemid
  531.     smokevar[id][2] = smoketime * 2
  532.     smokevar[id][3] = minushp
  533.     client_print(id,print_chat,"[ItemMod] You put a smoke in your mouth^n")
  534.     return PLUGIN_HANDLED
  535. }
  536.  
  537. // Lighter Code
  538. public item_lighter()
  539. {
  540.     new arg[32], id, health, str_id[32]
  541.     read_argv(1,arg,31)
  542.     id = str_to_num(arg)
  543.     health = get_user_health(id)
  544.  
  545.     num_to_str( id, str_id, 31 )
  546.    
  547.     if(smokevar[id][0] == 0) {
  548.         client_print(id,print_chat,"[ItemMod] You have nothing to light up^n")
  549.         return PLUGIN_HANDLED
  550.     }
  551.  
  552.     if( smokevar[id][0] == 2 ) {
  553.         set_task( 2.0, "color_effect", 0, str_id, 31, "a",  smokevar[id][2] / 4 )
  554.         set_task( float( smokevar[id][2] / 2 ), "unblind", id )
  555.     }
  556.     smokevar[id][4] = 1
  557.     set_task(0.5,"smoke_effect",id,"",0,"a",smokevar[id][2])
  558.     set_user_health(id,(health - smokevar[id][3]))
  559.     return PLUGIN_HANDLED
  560. }
  561.  
  562. // Cell Phone
  563. public item_cellphone()
  564. {
  565.     new arg[32], id
  566.     read_argv(1,arg,31)
  567.     id = str_to_num(arg)
  568.     client_cmd(id,"say /phone")
  569.     return PLUGIN_HANDLED
  570. }
  571.  
  572. // Item Prepaid
  573. public item_prepaid()
  574. {
  575.     new arg[32], arg2[32], id, amount
  576.     read_argv(1,arg,31)
  577.     read_argv(2,arg2,31)
  578.  
  579.     id = str_to_num(arg)
  580.     amount = str_to_num(arg2)
  581.     edit_value(id,"money","ptime","+",amount)
  582.     client_print(id,print_chat,"[PhoneMod] You loaded up $50 of prepaid phone time^n")
  583.     return PLUGIN_HANDLED
  584. }
  585.  
  586. // Item flashbang
  587. public item_flashbang()
  588. {
  589.     new arg[32], origin[3], id
  590.     read_argv(1,arg,31)
  591.     id = str_to_num(arg)
  592.     get_user_origin(id,origin)
  593.     new players[32], num
  594.     get_players(players,num,"ac")
  595.     for(new i = 0; i < num;i++)
  596.     {
  597.         new p_origin[3]
  598.         get_user_origin(players[i],p_origin)
  599.  
  600.         if(get_distance(origin,p_origin) <= 70.0)
  601.         {
  602.             message_begin(MSG_ONE,gmsgFade,{0,0,0},players[i])
  603.             write_short( 1<<15 )
  604.             write_short( 1<<12 )
  605.             write_short( 1<<12 )
  606.             write_byte( 255 )
  607.             write_byte( 255 )
  608.             write_byte( 255 )
  609.             write_byte( 255 )
  610.             message_end()
  611.         }
  612.     }
  613.     emit_sound(id,CHAN_BODY, "weapons/sfire-inslow.wav", 1.0, ATTN_NORM, 0, PITCH_HIGH)
  614.     return PLUGIN_HANDLED
  615. }
  616.  
  617. // Phonebook
  618. public item_phonebook()
  619. {
  620.     new arg[32], id, phonebook[1024], players[32], num
  621.     read_argv(1,arg,31)
  622.     id = str_to_num(arg)
  623.  
  624.     new len = format(phonebook,sizeof(phonebook),"Phonebook listing of all players on server:^n^n^n")
  625.  
  626.     get_players(players,num,"c")
  627.     for(new i = 0 ;i < num ;++i)
  628.     {
  629.         new szPhonenumber[32], name[32], authid[32]
  630.         get_user_authid(players[i],authid,31)
  631.         get_user_name(players[i],name,31)
  632.         select_string("money","pnum","steamid",authid,szPhonenumber,31)
  633.         if(!equali(szPhonenumber,"")) len += format(phonebook[len],sizeof(phonebook)-len,"%s: %s^n",name,szPhonenumber)
  634.     }
  635.     show_motd(id,phonebook,"Mecklenburg Phonebook")
  636.     return PLUGIN_HANDLED
  637. }
  638.  
  639. // Invisibility item item_invisibility <id> <transparent> <time>
  640. public item_invisibility()
  641. {
  642.     new arg[32], arg2[32], arg3[32], id, arg4[32]
  643.     read_argv(1,arg,31)
  644.     read_argv(2,arg2,31)
  645.     read_argv(3,arg3,31)
  646.     read_argv(4,arg4,31)
  647.    
  648.     id = str_to_num(arg)
  649.  
  650.     if(task_exists(id)) {
  651.         set_item_amount(id,"+",str_to_num(arg4),1,"money")
  652.         client_print(id,print_chat,"[ItemMod] You are already using a invisibility device")
  653.         return PLUGIN_HANDLED
  654.     }
  655.  
  656.     set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,str_to_num(arg2))
  657.     set_task(float(str_to_num(arg3)),"normal_glow",id)
  658.     client_print(id,print_chat,"[ItemMod] Invisibility Device activated!")
  659.     return PLUGIN_HANDLED
  660. }
  661.  
  662. // Picklocking Doors
  663. public item_picklock()
  664. {
  665.     new arg[32], arg2[32], id, entid, entbody, classname[32], origin[3], name[33]
  666.     read_argv(1,arg,31)
  667.     read_argv(2,arg2,31)
  668.     id = str_to_num(arg)
  669.     get_user_name(id,name,sizeof(name))
  670.     get_user_aiming(id,entid,entbody,200)
  671.     if(!is_valid_ent(entid)) {
  672.         client_print(id,print_chat,"[DoorMod] You must be facing a door!^n")
  673.         return PLUGIN_HANDLED
  674.     }
  675.     entity_get_string(entid,EV_SZ_classname,classname,31)
  676.     if(equali(classname,"func_door") || equali(classname,"func_door_toggle"))
  677.     {
  678.         client_print(id,print_chat,"[DoorMod] You can only picklock normal rotating doors^n")
  679.         return PLUGIN_HANDLED
  680.     }
  681.     if(!equali(classname,"func_door_rotating")) {
  682.         client_print(id,print_chat,"[DoorMod] You must be facing a door!^n")
  683.         return PLUGIN_HANDLED
  684.     }
  685.     if(task_exists(id+32)) {
  686.         client_print(id,print_chat,"[DoorMod] You are already picking a lock^n")
  687.         return PLUGIN_HANDLED
  688.     }
  689.     if(random_num(0,80) == 40) {
  690.         set_item_amount(id,"-",str_to_num(arg2),1,"money")
  691.         client_print(id,print_chat,"[DoorMod] The picklock snapped in half^n")
  692.     }
  693.  
  694.     new players[32], num
  695.     get_user_origin(id,origin)
  696.     get_players(players,num,"ac")
  697.     for(new i=0;i<num;i++)
  698.     {
  699.         new porigin[3]
  700.         get_user_origin(players[i],porigin)
  701.         if(get_distance(origin,porigin) <= get_cvar_num("rp_msgdistance"))
  702.         {
  703.             client_print(players[i],print_chat,"* [DoorMod] %s is picklocking the door..^n",name)
  704.         }
  705.     }
  706.     set_task(5.0,"picklock_action",id+32)
  707.     return PLUGIN_HANDLED
  708. }
  709.  
  710. // Exploding Doors
  711. public item_doorexplode()
  712. {
  713.     new arg[32], arg2[32], id, entid, entbody, classname[32], origin[3], Float:dmg, Float:takedmg, Float:check_origin[3]
  714.     read_argv(1,arg,31)
  715.     read_argv(2,arg2,31)
  716.     id = str_to_num(arg)
  717.  
  718.  
  719.     get_user_origin(id,origin)
  720.     get_user_aiming(id,entid,entbody,200)
  721.     if(!is_valid_ent(entid)) {
  722.         client_print(id,print_chat,"[DoorMod] You must be facing a door!^n")
  723.         return PLUGIN_HANDLED
  724.     }
  725.  
  726.  
  727.     entity_get_string(entid,EV_SZ_classname,classname,31)
  728.     if(!equali(classname,"func_door") && !equali(classname,"func_door_rotating") && !equali(classname,"func_door_toggle"))
  729.     {
  730.         set_item_amount(id,"+",str_to_num(arg2),1,"money")
  731.         client_print(id,print_chat,"[DoorMod] You must be facing a door!^n")
  732.         return PLUGIN_HANDLED
  733.     }
  734.  
  735.  
  736.     dmg = entity_get_float(entid,EV_FL_dmg)
  737.     takedmg = entity_get_float(entid,EV_FL_takedamage)
  738.     entity_get_vector(entid,EV_VEC_origin,check_origin)
  739.     if(takedmg == 0.0 && dmg == 0.0) {
  740.         entity_set_float(entid,EV_FL_dmg,1.0)
  741.         entity_set_float(entid,EV_FL_takedamage,1.0)
  742.     }
  743.     if(check_origin[0] == 0.0 && check_origin[1] == 0.0 && check_origin[2] == 0.0) {
  744.         check_origin[0] = float(origin[0])
  745.         check_origin[1] = float(origin[1])
  746.         check_origin[2] = float(origin[2])
  747.         entity_set_vector(entid,EV_VEC_origin,check_origin)
  748.     }
  749.  
  750.  
  751.     new players[32], num
  752.     get_players(players,num,"ac")
  753.     for(new i=0;i<num;i++)
  754.     {
  755.         new porigin[3]
  756.         get_user_origin(players[i],porigin)
  757.         if(get_distance(origin,porigin) <= (get_cvar_num("rp_msgdistance")*2))
  758.         {
  759.             client_print(players[i],print_chat," ** [DoorMod] EVERYONE CLEAR OUT THIS DOOR WILL BE BLOWN UP! **^n")
  760.         }
  761.     }
  762.     set_task(1.0,"time_explode",entid+29,"3",5)
  763.     return PLUGIN_HANDLED
  764. }
  765.  
  766.  
  767. // KamiKaze Bomb item_kamikaze <id>
  768. public item_kamikaze()
  769. {
  770.     new arg[32], id, name[32]
  771.     read_argv(1,arg,31)
  772.     id = str_to_num(arg)
  773.     get_user_name(id,name,31)
  774.     client_print(0,print_chat," ** [ItemMod] WARNING: Watchout for player %s he has a kamikaze bomb armed! **",name)
  775.     set_task(1.0,"kamikaze_timer",id+55,"3",5)
  776.     set_task(4.0,"kamikaze_blow",id+54)
  777.     return PLUGIN_HANDLED
  778. }
  779.  
  780. // item_tazer <id> <targetid>
  781. public item_tazer()
  782. {
  783.     new arg[32], arg2[32], id, origin[3], origin2[3], targetid, entbody, itemid
  784.     read_argv(1,arg,31)
  785.     read_argv(2,arg2,31)
  786.     id = str_to_num(arg)
  787.     itemid = str_to_num(arg2)
  788.  
  789.     get_user_aiming(id,targetid,entbody,400)
  790.     if(!is_user_connected(targetid))
  791.     {
  792.         client_print(id,print_chat,"[ItemMod] You must be looking at another player^n")
  793.         return PLUGIN_HANDLED
  794.     }
  795.     if(!is_user_alive(targetid)) return PLUGIN_HANDLED
  796.  
  797.     if(random_num(1,100) == 100) {
  798.         client_print(id,print_chat,"[ItemMod] Your tazer had a short-circuit!^n")
  799.         set_item_amount(id,"-",itemid,get_cvar_num("rp_item_tazer"),"money")
  800.         kamikaze_blow(id)
  801.         return PLUGIN_HANDLED
  802.     }
  803.     if(task_exists(id+128)) {
  804.         client_print(id,print_chat,"[ItemMod] Your tazer is currently recharging^n")
  805.         return PLUGIN_HANDLED
  806.     }
  807.     if(task_exists(targetid+96)) {
  808.         client_print(id,print_chat,"[ItemMod] Targetted person is already being tazered!^n")
  809.         return PLUGIN_HANDLED
  810.     }
  811.  
  812.     get_user_origin(id,origin)
  813.     get_user_origin(targetid,origin2)
  814.     basic_lightning(origin,origin2,10)
  815.     basic_shake(targetid,8,12)
  816.  
  817.     emit_sound(id, CHAN_ITEM, "harburp/tazer.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  818.  
  819.     if(get_user_health(targetid) <= 5)
  820.     {
  821.         user_silentkill(targetid)
  822.         make_deathmsg (id,targetid,0,"Tazer")
  823.     }
  824.     else set_user_health(targetid,get_user_health(targetid)-5)
  825.    
  826.  
  827.     for(new i=1;i<=35;i++)
  828.     {
  829.         client_cmd(targetid,"weapon_%d; drop",i)
  830.     }
  831.  
  832.     set_task(0.5,"slowdown",targetid)
  833.  
  834.     new buf[5]
  835.     num_to_str(targetid,buf,4)
  836.     set_task(0.5,"glow_flash",targetid,buf,4,"a",19)
  837.     set_task(5.0,"darken_effect",targetid+64)
  838.  
  839.     set_task(10.0,"remove_tazer_effect",targetid+96)
  840.     set_task(30.0,"recharge_func",id+128)
  841.     return PLUGIN_HANDLED
  842. }
  843.  
  844. public slowdown(id)
  845. {
  846.     set_user_maxspeed(id,get_user_maxspeed(id)-319)
  847.     return PLUGIN_HANDLED
  848. }
  849.  
  850. // Cyanide Syringe - item_csyringe <id> <targetid> - by Promethus
  851. // Cyanide Syringe - item_csyringe <id> <targetid> - by Promethus
  852. public item_csyringe()
  853. {
  854.     new id,targetid,itemid,arg[31],arg2[32],arg3[32],blah1,blah2
  855.  
  856.     read_argv(1,arg,31)
  857.     read_argv(2,arg2,31)
  858.     read_argv(3,arg3,31)
  859.  
  860.     id = str_to_num(arg)
  861.     targetid = str_to_num(arg2)
  862.     itemid = str_to_num(arg3)
  863.  
  864.     if(get_user_aiming(id,blah1,blah2,50)) {
  865.         make_deathmsg(id,targetid,0,"Cyanide Syringe")
  866.         user_silentkill(targetid)
  867.  
  868.         new Frags = get_user_frags(id)
  869.  
  870.         client_print(id,print_chat,"[ItemMod] Frag count: %d^n",Frags)
  871.  
  872.         set_user_frags(id,get_user_frags(id)+1)
  873.  
  874.         Frags = get_user_frags(id)
  875.  
  876.         client_print(id,print_chat,"[ItemMod] New Frag count: %d^n",Frags)
  877.  
  878.         client_print(id,print_chat,"[ItemMod] You used a Cyanide Syringe^n")
  879.         return PLUGIN_HANDLED
  880.     } else {
  881.         client_print(id,print_chat,"[ItemMod] You need to be close to and looking at a player^n")
  882.         set_item_amount(id,"+",itemid,1,"money")
  883.         return PLUGIN_HANDLED
  884.     }
  885.  
  886.     return PLUGIN_HANDLED
  887. }
  888.  
  889. // Suicide Pill - item_spill <id> - by Promethus
  890. public item_spill()
  891. {
  892.     new arg[32],id
  893.     read_argv(1,arg,31)
  894.  
  895.     id = str_to_num(arg)
  896.  
  897.     new will_kill = random_num(1,4)
  898.  
  899.     if(will_kill == 4) {
  900.         client_print(id,print_chat,"[ItemMod] The suicide pill failed and did 25 damage")
  901.         set_user_health(id,get_user_health(id)-25)
  902.     } else {
  903.         user_kill(id)
  904.     }
  905.  
  906.     item_spill_kill(id)
  907.  
  908.     return PLUGIN_HANDLED
  909. }
  910.  
  911. public item_spill_kill(id_arg)
  912. {
  913.  
  914.     client_cmd(id_arg,"say /me takes a suicide pill")
  915.  
  916.     return PLUGIN_HANDLED
  917. }
  918.  
  919. // Searcher Item - item_searcher <id> <targetid> <itemid> - By Ben Prometheus
  920. public item_searcher()
  921. {
  922.     new id,targetid,itemid,arg[31],arg2[32],arg3[32],target_name[64]
  923.  
  924.     read_argv(1,arg,31)
  925.     read_argv(2,arg2,31)
  926.     read_argv(3,arg3,31)
  927.  
  928.     id = str_to_num(arg)
  929.     targetid = str_to_num(arg2)
  930.     itemid = str_to_num(arg3)
  931.  
  932.     get_user_name(targetid,target_name,63)
  933.  
  934.     set_item_amount(id,"+",itemid,1,"money")
  935.  
  936.     client_cmd(id,"say /me searches %s",target_name)
  937.  
  938.     new info[512],info_header[128]
  939.  
  940.     format(info_header,127,"Info for player ^"%s^"",target_name)
  941.  
  942.     show_motd(id,info,info_header)
  943.  
  944.     return PLUGIN_HANDLED
  945. }
  946.  
  947. // Alchohol - item_alcohol <id>
  948. public item_alcohol()
  949. {
  950.     new arg[32], arg2[32], arg4[32], arg5[32], itemname[32], id, itemid, drunk, origin[3]
  951.     read_argv(1,arg,31)
  952.     read_argv(2,arg2,31)
  953.     read_argv(3,itemname,31)
  954.     read_argv(4,arg4,31)
  955.     read_argv(5,arg5,31)
  956.     id = str_to_num(arg)
  957.     itemid = str_to_num(arg2)
  958.     drunk = str_to_num(arg5)
  959.  
  960.     new Float:task_time = float(str_to_num(arg4))
  961.     if(alcohol[id][0] == 1) {
  962.         set_item_amount(id,"+",itemid,1,"money")
  963.         client_print(id,print_chat,"[Alcohol Mod] Can't drink while passed out!^n")
  964.         return PLUGIN_HANDLED
  965.     }
  966.  
  967.     alcohol[id][1] += drunk
  968.  
  969.     if(alcohol[id][1] > 10) {
  970.         alcohol[id][0] = 1
  971.         client_print(id,print_center," * You Pass out! * ^n")
  972.         remove_task(id+224)
  973.         remove_task(id+256)
  974.         remove_task(id+288)
  975.         set_user_maxspeed(id,get_user_maxspeed(id)-319)
  976.         alcohol_dark_passout(arg)
  977.  
  978.         message_begin(MSG_ONE, gmsgFade, {0,0,0}, id)
  979.         write_short(1<<0)
  980.         write_short(1<<0)
  981.         write_short(1<<2)
  982.         write_byte(0)
  983.         write_byte(0)  
  984.         write_byte(0)  
  985.         write_byte(220)  
  986.         message_end()
  987.         client_cmd(id,"+duck")
  988.         set_task(4.0,"alcohol_dark_passout",id+160,arg,31,"a",30)
  989.         set_task(60.0,"alcohol_remove_passout",id+192,arg,31)
  990.         return PLUGIN_HANDLED
  991.     }
  992.     set_user_rendering(id,kRenderFxGlowShell,255,128,255,kRenderNormal,16) 
  993.     new repeat = 60 / floatround(task_time)
  994.     set_task(task_time,"alcohol_move",id+224,arg,31,"a",repeat)
  995.     if(random_num(1,2) == 2) set_task(20.0,"alcohol_shake",id+256,arg,31,"a",2)
  996.     else set_task(25.0,"alcohol_spin",id+288,arg,31,"a",2)
  997.     for(new i = 0; i <= drunk; i++) {
  998.         set_task(60.0,"alcohol_die",id,arg,31)
  999.     }
  1000.     client_print(id,print_chat,"[Alcohol Mod] You enjoy some %s^n",itemname)
  1001.  
  1002.     get_user_origin(id,origin)
  1003.  
  1004.     new players[32], num, name[32]
  1005.     get_players(players,num,"ac")
  1006.     get_user_name(id,name,31)
  1007.  
  1008.     for(new i=0;i<num;i++)
  1009.     {
  1010.         if(players[i] == id) continue
  1011.         new porigin[3]
  1012.         get_user_origin(players[i],porigin)
  1013.         if(get_distance(origin,porigin) <= (get_cvar_num("rp_msgdistance")))
  1014.         {
  1015.             client_print(players[i],print_chat,"[Alcohol Mod] %s enjoys some %s^n",name,itemname)
  1016.         }
  1017.     }
  1018.     return PLUGIN_HANDLED
  1019. }
  1020.  
  1021. // Item Rope - item_rope <id> <targetid> <itemid>
  1022. public item_rope()
  1023. {
  1024.     new arg[32], arg2[32], arg3[32], id, targetid, itemid
  1025.  
  1026.     read_argv(1,arg,31)
  1027.     read_argv(2,arg2,31)
  1028.     read_argv(3,arg3,31)
  1029.  
  1030.     id = str_to_num(arg)
  1031.     targetid = str_to_num(arg2)
  1032.     itemid = str_to_num(arg3)
  1033.  
  1034.     if(roped[targetid] > 0) {
  1035.         client_print(id,print_chat,"[ItemMod] This player has already been roped by someone else!")
  1036.         set_item_amount(targetid,"+",itemid,1,"money")
  1037.         return PLUGIN_HANDLED
  1038.     }
  1039.     return PLUGIN_HANDLED
  1040. }
  1041.  
  1042. // Item Watch - item_watch <id> <flag>
  1043. public item_watch()
  1044. {
  1045.     new arg[32], arg2[32]
  1046.     read_argv(1,arg,31)
  1047.     read_argv(2,arg2,31)
  1048.     new id = str_to_num(arg)
  1049.     new flag = str_to_num(arg2)
  1050.  
  1051.     set_hudmessage(175,175,175,-1.0,-0.02,0,0.0,999.0,0.0,0.0,4)
  1052.     new str_min[32], str_hour[32], final[32]
  1053.    
  1054.     if(minute <= 9) format(str_min,sizeof(str_min),"0%i",minute)
  1055.     else if(minute > 9) format(str_min,sizeof(str_min),"%i",minute)
  1056.  
  1057.     if(hour <= 9) format(str_hour,sizeof(str_hour),"0%i",hour)
  1058.     else if(hour > 9) format(str_hour,sizeof(str_hour),"%i",hour)
  1059.  
  1060.     format(final,sizeof(final),"%s:%s %s %i, %i",str_hour,str_min,monthname[month],day,year)
  1061.     show_hudmessage(id,final)
  1062.     if(flag > 0) {
  1063.    
  1064.         new speak_min[32], speak_hour[32]
  1065.         num_to_word(minute,speak_min,31)
  1066.         num_to_word(hour,speak_hour,31)
  1067.         client_cmd(id,"speak ^"the time is %s %s^"",speak_hour,speak_min)
  1068.     }
  1069.     set_task(1.0,"tick_tock",id,arg,31,"a",10)
  1070.     set_task(10.0,"stop_clock",id,arg,31)
  1071.     return PLUGIN_HANDLED
  1072. }
  1073.  
  1074. public tick_tock(param[])
  1075. {
  1076.     new id = str_to_num(param)
  1077.  
  1078.     set_hudmessage(175,175,175,-1.0,-0.02,0,0.0,999.0,0.0,0.0,4)
  1079.     new str_min[32], str_hour[32], final[32]
  1080.    
  1081.     if(minute <= 9) format(str_min,sizeof(str_min),"0%i",minute)
  1082.     else if(minute > 9) format(str_min,sizeof(str_min),"%i",minute)
  1083.  
  1084.     if(hour <= 9) format(str_hour,sizeof(str_hour),"0%i",hour)
  1085.     else if(hour > 9) format(str_hour,sizeof(str_hour),"%i",hour)
  1086.  
  1087.     format(final,sizeof(final),"%s:%s %s %i, %i",str_hour,str_min,monthname[month],day,year)
  1088.     show_hudmessage(id,final)
  1089. }
  1090.  
  1091. public stop_clock(param[])
  1092. {
  1093.     new id = str_to_num(param)
  1094.     set_hudmessage(175,175,175,-1.0,-0.02,0,0.0,1.0,0.0,0.0,4)
  1095.     show_hudmessage(id,"")
  1096. }
  1097.  
  1098.  
  1099.        
  1100. //////////////////////////////////
  1101. //      SET TASKS
  1102. //////////////////////////////////
  1103. public darken_effect(id)
  1104. {
  1105.     id -= 64
  1106.     client_cmd(id,"speak ^"harburp/heart^"")
  1107.     message_begin(MSG_ONE, gmsgFade, {0,0,0}, id)
  1108.     write_short(1<<2)
  1109.     write_short(1<<14)
  1110.     write_short(1<<0)
  1111.     write_byte(0)
  1112.     write_byte(0)  
  1113.     write_byte(0)  
  1114.     write_byte(255)  
  1115.     message_end()
  1116.     return PLUGIN_HANDLED
  1117. }
  1118.  
  1119.  
  1120. public glow_flash(param[],shitid)
  1121. {
  1122.     new id = str_to_num(param)
  1123.     new origin[3], end_origin[3]
  1124.     get_user_origin(id,origin)
  1125.  
  1126.     end_origin[0] = origin[0] + random_num(-30,30)
  1127.     end_origin[1] = origin[1] + random_num(-30,30)
  1128.     end_origin[2] = origin[2] + random_num(0,30)
  1129.  
  1130.     basic_lightning(origin,end_origin,6)
  1131.  
  1132.     if(tazerd[id][0] == 0) {
  1133.         set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,16)
  1134.         tazerd[id][0] = 1
  1135.         return PLUGIN_CONTINUE
  1136.     }
  1137.     else if(tazerd[id][0] == 1) {
  1138.         set_user_rendering(id,kRenderFxGlowShell,0,0,225,kRenderNormal,32)
  1139.         tazerd[id][0] = 0
  1140.         return PLUGIN_CONTINUE
  1141.     }
  1142.     return PLUGIN_CONTINUE
  1143. }
  1144.  
  1145. public remove_tazer_effect(id)
  1146. {
  1147.     set_user_maxspeed(id-96,get_user_maxspeed(id-96)+319)
  1148.     set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,16)
  1149.     remove_task(id)
  1150.     return PLUGIN_HANDLED
  1151. }
  1152.  
  1153. public recharge_func(id)
  1154. {
  1155.     remove_task(id)
  1156.     return PLUGIN_HANDLED
  1157. }
  1158.  
  1159. public kamikaze_timer(sZtimer[],id)
  1160. {
  1161.     id -= 55
  1162.     new timer = str_to_num(sZtimer)
  1163.     set_user_rendering(id,kRenderFxGlowShell,random_num(1,255),random_num(1,255),random_num(1,255),kRenderNormal,16)
  1164.     if(timer == 3) client_cmd(id,"speak ^"fvox/three^"")
  1165.     if(timer == 2) client_cmd(id,"speak ^"fvox/two^"")
  1166.     if(timer == 1) client_cmd(id,"speak ^"fvox/one^"")
  1167.     timer--
  1168.     if(timer > 0) {
  1169.         new str[5]
  1170.         num_to_str(timer,str,4)
  1171.         set_task(1.0,"kamikaze_timer",id+55,str,5)
  1172.     }
  1173.     return PLUGIN_CONTINUE
  1174. }
  1175.  
  1176. // When the Kamikaze Allah Guy Blows Up
  1177. public kamikaze_blow(id)
  1178. {
  1179.     id -= 54
  1180.     new origin[3], Float:forigin[3]
  1181.  
  1182.     get_user_origin(id,origin,0)
  1183.     IVecFVec(origin,forigin)
  1184.     basic_explosion(origin)
  1185.     make_deathmsg(id,id,0,"Kamikaze")
  1186.     user_silentkill(id)
  1187.     radius_damage(forigin,100,50)
  1188.     return PLUGIN_HANDLED
  1189. }
  1190.  
  1191. // Block all the use and shit from a tazered
  1192. public client_PreThink(id)
  1193. {
  1194.     if(task_exists(id+88) || alcohol[id][0] == 1)
  1195.     {
  1196.         new bufferstop = entity_get_int(id,EV_INT_button)
  1197.         if(bufferstop != 0) {
  1198.             entity_set_int(id,EV_INT_button,bufferstop & ~IN_ATTACK & ~IN_ATTACK2 & ~IN_USE & ~IN_FORWARD & ~IN_BACK & ~IN_MOVELEFT & ~IN_MOVERIGHT)
  1199.         }
  1200.         if((bufferstop & IN_JUMP) && (entity_get_int(id,EV_INT_flags) & ~FL_ONGROUND)) {
  1201.             entity_set_int(id,EV_INT_button,entity_get_int(id,EV_INT_button) & ~IN_JUMP)
  1202.         }
  1203.         return PLUGIN_CONTINUE
  1204.     }
  1205.     return PLUGIN_CONTINUE
  1206. }
  1207.  
  1208. // Making the smoke effects
  1209. public smoke_effect(id)
  1210. {
  1211.     smokevar[id][2]--
  1212.     if(smokevar[id][0] == 0) {
  1213.         remove_task(id)
  1214.         return PLUGIN_HANDLED
  1215.     }
  1216.     if(smokevar[id][2] <= 0)
  1217.     {
  1218.         smokevar[id][0] = 0
  1219.         smokevar[id][1] = 0
  1220.         smokevar[id][2] = 0
  1221.         smokevar[id][3] = 0
  1222.         smokevar[id][4] = 0
  1223.         client_print(id,print_chat,"[ItemMod] You finish the smoke and toss it on the ground^n")
  1224.         client_cmd(id,"default_fov 90")
  1225.         remove_task(id)
  1226.         return PLUGIN_HANDLED
  1227.     }
  1228.     if(!is_user_alive(id)) return PLUGIN_HANDLED
  1229.     new vec[3]
  1230.     get_user_origin(id,vec)
  1231.     new y1,x1
  1232.     x1 = random_num(-10,10)
  1233.     y1 = random_num(-10,10)
  1234.    
  1235.     //Smoke
  1236.     message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
  1237.     write_byte( 5 ) // 5
  1238.     write_coord(vec[0]+x1)
  1239.     write_coord(vec[1]+y1)
  1240.     write_coord(vec[2]+30)
  1241.     write_short( smoke )
  1242.     write_byte( 10 )  // 10
  1243.     write_byte( 15 )  // 10
  1244.     message_end()
  1245.     client_cmd(id,"default_fov 90")
  1246.     return PLUGIN_CONTINUE
  1247. }
  1248.  
  1249. // Unblind a blinded player
  1250. public unblind(id)
  1251. {
  1252.     message_begin(MSG_ONE, gmsgFade, {0,0,0}, id)
  1253.     write_short(1<<12)
  1254.     write_short(1<<8)
  1255.     write_short(1<<0)
  1256.     write_byte(0)
  1257.     write_byte(0)
  1258.     write_byte(0)  
  1259.     write_byte(100)  
  1260.     message_end()
  1261.     return PLUGIN_HANDLED
  1262. }
  1263.  
  1264. public time_explode(string[],entid)
  1265. {
  1266.     entid -= 29
  1267.     new point = str_to_num(string)
  1268.     new Float:forigin[3], origin[3], players[32], num
  1269.     entity_get_vector(entid,EV_VEC_origin,forigin)
  1270.  
  1271.     origin[0] = floatround(forigin[0])
  1272.     origin[1] = floatround(forigin[1])
  1273.     origin[2] = floatround(forigin[2])
  1274.  
  1275.     get_players(players,num,"ac")
  1276.     for(new i=0;i<num;i++)
  1277.     {
  1278.         new porigin[3]
  1279.         get_user_origin(players[i],porigin)
  1280.         if(get_distance(origin,porigin) <= (get_cvar_num("rp_msgdistance")*2))
  1281.         {
  1282.             client_print(players[i],print_chat," **[DoorMod] %i!!! **^n",point)
  1283.         }
  1284.     }
  1285.  
  1286.     if(point == 3)
  1287.     {
  1288.         new str[32], fpara[5]
  1289.         format(str,sizeof(str),"Explode_%i",entid)
  1290.         create_ambient(origin,str,"10","80",8,"phone/2.wav")
  1291.         set_rendering(entid,kRenderFxGlowShell,0,225,0,kRenderNormal,16)
  1292.         force_use(entid,find_ent_by_tname(-1,str))
  1293.         force_use(entid,find_ent_by_tname(-1,str))
  1294.         point -= 1
  1295.         num_to_str(point,fpara,sizeof(fpara))
  1296.         set_task(1.0,"time_explode",entid+29,fpara,sizeof(fpara))
  1297.         return PLUGIN_CONTINUE
  1298.     }
  1299.     if(point == 2)
  1300.     {
  1301.         new str[32], fpara[5]
  1302.         format(str,sizeof(str),"Explode_%i",entid)
  1303.         set_rendering(entid,kRenderFxGlowShell,225,225,0,kRenderNormal,16)
  1304.         force_use(entid,find_ent_by_tname(-1,str))
  1305.         force_use(entid,find_ent_by_tname(-1,str))
  1306.         point -= 1
  1307.         num_to_str(point,fpara,sizeof(fpara))
  1308.         set_task(1.0,"time_explode",entid+29,fpara,sizeof(fpara))
  1309.         return PLUGIN_CONTINUE
  1310.     }
  1311.     if(point == 1)
  1312.     {
  1313.         new str[32]
  1314.         format(str,sizeof(str),"Explode_%i",entid)
  1315.         set_rendering(entid,kRenderFxGlowShell,225,0,0,kRenderNormal,16)
  1316.         force_use(entid,find_ent_by_tname(-1,str))
  1317.         force_use(entid,find_ent_by_tname(-1,str))
  1318.         remove_entity(find_ent_by_tname(-1,str))
  1319.         set_task(1.0,"door_explode",entid+30)
  1320.         remove_task(entid+29)
  1321.         return PLUGIN_CONTINUE
  1322.     }
  1323.     return PLUGIN_HANDLED
  1324. }
  1325.  
  1326. // The Explosion of door and setting the recovery task
  1327. public door_explode(entid)
  1328. {
  1329.     new Float:Origin[3]
  1330.     entid -= 30
  1331.     set_rendering(entid)
  1332.     entity_get_vector(entid,EV_VEC_origin,Origin)
  1333.  
  1334.     new intorigin[3]
  1335.     FVecIVec(Origin,intorigin)
  1336.  
  1337.     basic_explosion(intorigin)
  1338.  
  1339.     message_begin( MSG_BROADCAST, SVC_TEMPENTITY, intorigin )
  1340.     write_byte( 108 )       // TE_BREAKMODEL (108)
  1341.     write_coord( floatround(Origin[0]) )
  1342.     write_coord( floatround(Origin[1]) )
  1343.     write_coord( floatround(Origin[2]) )
  1344.     write_coord( 0 )
  1345.     write_coord( 0 )
  1346.     write_coord( 0 )
  1347.     write_coord( 5 )
  1348.     write_coord( 5 )
  1349.     write_coord( 5 )
  1350.     write_byte( 15 )
  1351.     write_short( DOOR_GIBS )
  1352.     write_byte( 50 )
  1353.     write_byte( 50 )
  1354.     write_byte( 0 )
  1355.  
  1356.     message_end()
  1357.  
  1358.     new entstore
  1359.     for(new i = 0; i < MAXDOORS; i++)
  1360.     {
  1361.         if(g_door_explode[i][0] == 0.0 && g_door_explode[i][1] == 0.0 && g_door_explode[i][2] == 0.0)
  1362.         {
  1363.             g_door_explode[i][0] = Origin[0]
  1364.             g_door_explode[i][1] = Origin[1]
  1365.             g_door_explode[i][2] = Origin[2]
  1366.             entstore = i
  1367.             break
  1368.         }
  1369.     }
  1370.  
  1371.     entity_set_origin(entid,nullorigin)
  1372.     set_entity_visibility(entid,0)
  1373.  
  1374.     radius_damage(Origin,75,35)
  1375.     new buffer[32]
  1376.     num_to_str(entstore,buffer,sizeof(buffer))
  1377.     set_task(25.0,"store_door",entid,buffer,sizeof(buffer))
  1378.    
  1379.     return PLUGIN_HANDLED
  1380. }
  1381.  
  1382. // Recovering the door
  1383. public store_door(param[],entid)
  1384. {
  1385.     new storeid = str_to_num(param)
  1386.  
  1387.     entity_set_vector(entid,EV_VEC_origin,g_door_explode[storeid])
  1388.     set_entity_visibility(entid,1)
  1389.  
  1390.     g_door_explode[storeid][0] = 0.0
  1391.     g_door_explode[storeid][1] = 0.0
  1392.     g_door_explode[storeid][2] = 0.0
  1393.    
  1394.     return PLUGIN_HANDLED
  1395. }
  1396.  
  1397. public normal_glow(id)
  1398. {
  1399.     set_user_rendering(id)
  1400.     return PLUGIN_HANDLED
  1401. }
  1402.  
  1403. // Picklocking door
  1404. public picklock_action(id)
  1405. {
  1406.     id -= 32
  1407.  
  1408.     new curid, curbody, classname[32]
  1409.     get_user_aiming(id,curid,curbody,200)
  1410.     if(curid) entity_get_string(curid,EV_SZ_classname,classname,31)
  1411.     if(equali(classname,"func_door_rotating"))
  1412.     {
  1413.         if(random_num(0,20) == 10)
  1414.         {
  1415.             force_use(id,curid)
  1416.             fake_touch(curid,id)
  1417.             client_print(id,print_chat,"[DoorMod] Door picklocked!")
  1418.             remove_task(id+32)
  1419.             return PLUGIN_HANDLED
  1420.         }
  1421.         client_print(id,print_chat,"[DoorMod] Failed to picklock the door")
  1422.     }
  1423.     remove_task(id+32)
  1424.     return PLUGIN_HANDLED
  1425. }
  1426.  
  1427. public moneytree()
  1428. {
  1429.     new players[32], inum
  1430.     get_players(players,inum,"ac")
  1431.     for(new i = 0 ;i < inum ;++i)
  1432.     {
  1433.         // Money Trees money spawning
  1434.         if(get_item_amount(players[i],MONEYTREE,"money") > 0)
  1435.         {
  1436.             new currentamount = get_item_amount(players[i],MONEYTREE,"money")
  1437.             edit_value(players[i],"money","wallet","+",random_num(1,5) * currentamount)
  1438.         }
  1439.     }
  1440.     return PLUGIN_HANDLED
  1441. }
  1442.  
  1443. //////////////////////
  1444. // EFFECTS LIBRARY ///
  1445. //////////////////////
  1446.  
  1447. // A Basic Explosion
  1448. stock basic_explosion(origin[3])
  1449. {
  1450.     message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
  1451.     write_byte( 12 )
  1452.     write_coord(origin[0]) //coord, coord, coord (start)
  1453.     write_coord(origin[1])
  1454.     write_coord(origin[2])
  1455.     write_byte( 200 ) // byte (scale in 0.1's) 188
  1456.     write_byte( 10 ) // byte (framerate)
  1457.     message_end()
  1458.  
  1459.     message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
  1460.     write_byte( 3 )
  1461.     write_coord(origin[0]) //coord, coord, coord (start)
  1462.     write_coord(origin[1])
  1463.     write_coord(origin[2])
  1464.     write_short( fire )
  1465.     write_byte( 60 )
  1466.     write_byte( 10 )
  1467.     write_byte( 0 )
  1468.     message_end()
  1469.     return PLUGIN_HANDLED
  1470. }
  1471.  
  1472. // A Lightning Effect
  1473. stock basic_lightning(s_origin[3],e_origin[3],life = 8)
  1474. {
  1475.  
  1476.     message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
  1477.     write_byte( 0 )
  1478.     write_coord(s_origin[0])
  1479.     write_coord(s_origin[1])
  1480.     write_coord(s_origin[2])
  1481.     write_coord(e_origin[0])
  1482.     write_coord(e_origin[1])
  1483.     write_coord(e_origin[2])
  1484.     write_short( lightning )
  1485.     write_byte( 1 ) // framestart
  1486.     write_byte( 5 ) // framerate
  1487.     write_byte( life ) // life
  1488.     write_byte( 20 ) // width
  1489.     write_byte( 30 ) // noise
  1490.     write_byte( 200 ) // r, g, b
  1491.     write_byte( 200 ) // r, g, b
  1492.     write_byte( 200 ) // r, g, b
  1493.     write_byte( 200 ) // brightness
  1494.     write_byte( 200 ) // speed
  1495.     message_end()
  1496.  
  1497.     message_begin( MSG_PVS, SVC_TEMPENTITY,e_origin)
  1498.     write_byte( 9 )
  1499.     write_coord( e_origin[0] )
  1500.     write_coord( e_origin[1] )
  1501.     write_coord( e_origin[2] )
  1502.     message_end()
  1503.     return PLUGIN_HANDLED
  1504. }
  1505.  
  1506. // Shaking a users screen
  1507. stock basic_shake(id,amount = 14, length = 14)
  1508. {
  1509.       message_begin(MSG_ONE, get_user_msgid("ScreenShake"), {0,0,0}, id)
  1510.       write_short(255<< amount ) //ammount
  1511.       write_short(10 << length) //lasts this long
  1512.       write_short(255<< 14) //frequency
  1513.       message_end()
  1514. }
  1515.  
  1516. //////////////////////////////////////////
  1517. //  A l c o h o l  C o d e
  1518. /////////////////////////////////////////
  1519.  
  1520. // Walking strange alcohol effect
  1521. public alcohol_move(sZid[],task_id)
  1522. {
  1523.     new id = str_to_num(sZid)
  1524.     client_cmd(id,"-moveleft;-moveright;-forward;-back")
  1525.     new ran = random_num(1,4)
  1526.     if(ran == 1) client_cmd(id,"+forward")
  1527.     if(ran == 2) client_cmd(id,"+back")
  1528.     if(ran == 3) client_cmd(id,"+moveleft")
  1529.     if(ran == 4) client_cmd(id,"+moveright")
  1530.  
  1531.     set_task(0.5,"alcohol_stop_move",0,sZid,32)
  1532.        
  1533.     return PLUGIN_HANDLED
  1534. }
  1535.  
  1536. // Stop movement
  1537. public alcohol_stop_move(sZid[])
  1538. {
  1539.     new id = str_to_num(sZid)
  1540.     client_cmd(id,"-moveleft;-moveright;-forward;-back")
  1541.     return PLUGIN_HANDLED
  1542. }
  1543.  
  1544. // Shaking effect for alcohol
  1545. public alcohol_shake(sZid[],task_id)
  1546. {
  1547.     basic_shake(str_to_num(sZid))
  1548.     return PLUGIN_HANDLED
  1549. }
  1550.  
  1551. // Spinning effect for spinning
  1552. public alcohol_spin(sZid[],task_id)
  1553. {
  1554.     client_cmd(str_to_num(sZid),"+left")
  1555.     set_task(3.0,"alcohol_remove_spin",0,sZid,31)
  1556.     return PLUGIN_HANDLED
  1557. }
  1558.  
  1559. // Removing the alcohol Spinning effect
  1560. public alcohol_remove_spin(sZid[])
  1561. {
  1562.     client_cmd(str_to_num(sZid),"-left")
  1563.     return PLUGIN_HANDLED
  1564. }
  1565.  
  1566. // When 1 alcohol dies in your body!
  1567. public alcohol_die(sZid[])
  1568. {
  1569.     new id = str_to_num(sZid)
  1570.     client_cmd(id,"-moveleft;-moveright;-forward;-back")
  1571.     alcohol[id][1] -= 1
  1572.     if(alcohol[id][1] <= 0) set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,16)
  1573. }
  1574.  
  1575. // The passing out dark screen effect & breathing
  1576. public alcohol_dark_passout(sZid[])
  1577. {
  1578.     new id = str_to_num(sZid)
  1579.     client_cmd(id,"speak ^"harburp/heart^"")
  1580.     message_begin(MSG_ONE, gmsgFade, {0,0,0}, id)
  1581.     write_short(1<<0)
  1582.     write_short(1<<0)
  1583.     write_short(1<<2)
  1584.     write_byte(0)
  1585.     write_byte(0)  
  1586.     write_byte(0)  
  1587.     write_byte(220)  
  1588.     message_end()
  1589.     client_cmd(id,"+duck")
  1590.     return PLUGIN_HANDLED
  1591. }
  1592.  
  1593. public alcohol_remove_passout(sZid[])
  1594. {
  1595.     new id = str_to_num(sZid)
  1596.     alcohol[id][0] = 0
  1597.     remove_task(id+160)
  1598.     alcohol[id][1] = 0
  1599.     set_user_maxspeed(id,get_user_maxspeed(id)+319)
  1600.     unblind(id)
  1601.     set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,16)
  1602.     client_cmd(id,"-duck")
  1603.     client_cmd(id,"speak NULL")
  1604.     client_print(id,print_center," * You Wake Up! * ^n")
  1605.     return PLUGIN_HANDLED
  1606. }
  1607.  
  1608. // When player dies
  1609. public death_msg()
  1610. {
  1611.     new id = read_data(2)
  1612.     if(alcohol[id][0] > 0)
  1613.     {
  1614.         alcohol[id][0] = 0
  1615.         remove_task(id+160)
  1616.         set_user_maxspeed(id,get_user_maxspeed(id)+319)
  1617.         unblind(id)
  1618.         set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,16)
  1619.         client_cmd(id,"-duck")
  1620.         client_cmd(id,"speak NULL")
  1621.         return PLUGIN_CONTINUE
  1622.     }
  1623.    
  1624.     if(alcohol[id][1] > 1)
  1625.     {
  1626.         alcohol[id][1] = 0
  1627.         set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,16)
  1628.         remove_task(id+224)
  1629.         remove_task(id+256)
  1630.         remove_task(id+288)
  1631.         return PLUGIN_CONTINUE
  1632.     }
  1633.     return PLUGIN_CONTINUE
  1634. }
  1635.  
  1636. public client_disconnect(id)
  1637. {
  1638.     if(task_exists(id)) remove_task(id)
  1639.     if(task_exists(id+32)) remove_task(id+32)
  1640.     if(task_exists(id+29)) remove_task(id+29)
  1641.     if(task_exists(id+55)) remove_task(id+55)
  1642.     if(task_exists(id+54)) remove_task(id+54)
  1643.     if(task_exists(id+64)) remove_task(id+64)
  1644.     if(task_exists(id+96)) remove_task(id+96)
  1645.     if(task_exists(id+128)) remove_task(id+128)
  1646.     if(task_exists(id+160)) remove_task(id+160)
  1647.     if(task_exists(id+192)) remove_task(id+192)
  1648.     if(task_exists(id+224)) remove_task(id+224)
  1649.     if(task_exists(id+256)) remove_task(id+256)
  1650.     if(task_exists(id+288)) remove_task(id+288)
  1651.     return PLUGIN_CONTINUE
  1652. }
  1653.  
  1654. public spawn_msg(id)
  1655. {
  1656.     client_print(id,print_console,"Tell me the reason")
  1657.     new authid[32], JobID, str[32], query[256]
  1658.     get_user_authid(id,authid,31)
  1659.     select_string("money","JobID","steamid",authid,str,31)
  1660.     JobID = str_to_num(str)
  1661.  
  1662.     format(query,255,"SELECT * FROM itemspawns")
  1663.     dbi_query(dbc,query)
  1664.     if(dbi_nextrow(result) > 0)
  1665.     {
  1666.         new rows = dbi_num_rows(result)
  1667.         for(new i=0;i < rows;i++)
  1668.         {
  1669.             new itemid, amount, authid2[32], edittable[32], JobID2[32]
  1670.             itemid = dbi_field(result,1)
  1671.             amount = dbi_field(result,2)
  1672.             dbi_field(result,3,authid2,31)
  1673.             dbi_field(result,4,edittable,31)
  1674.             dbi_field(result,5,JobID2,31)
  1675.  
  1676.             if(equali(authid,authid2)) set_item_amount(id,"+",itemid,amount,edittable)
  1677.  
  1678.             new output[2][32]
  1679.             explode(output,JobID2,'-')
  1680.             if(str_to_num(output[0]) >= JobID && str_to_num(output[1]) <= JobID) set_item_amount(id,"+",itemid,amount,edittable)
  1681.         }
  1682.     }
  1683.     return PLUGIN_HANDLED
  1684. }
  1685.  
  1686. // When player drops weapon maintain speed
  1687. public client_dropweapon(id)
  1688. {
  1689.     if(alcohol[id][0] == 1) slowdown(id)
  1690.     return PLUGIN_HANDLED
  1691. }
  1692.  
  1693. // Time Mod
  1694. public time_advance()
  1695. {
  1696.     minute++
  1697.     if(minute == 60)
  1698.     {
  1699.         hour++
  1700.         minute = 0
  1701.     }
  1702.     if(hour == 24)
  1703.     {
  1704.         day++
  1705.         hour = 0
  1706.     }
  1707.     if(day == monthday[month])
  1708.     {
  1709.         month++
  1710.         day = 1
  1711.     }
  1712.     if(month == 12)
  1713.     {
  1714.         year++
  1715.         month = 1
  1716.     }
  1717.     return PLUGIN_CONTINUE
  1718. }
  1719.  
  1720. /// Einen Druggen //
  1721.  
  1722. public color_effect( str[] )
  1723. {
  1724.     new id = str_to_num( str )
  1725.  
  1726.     if( smokevar[id][0] != 2 ) remove_task()
  1727.  
  1728.     message_begin(MSG_ONE, gmsgFade, {0,0,0}, id)
  1729.     write_short(1<<0)
  1730.     write_short(1<<0)
  1731.     write_short(1<<2)
  1732.     write_byte(0)
  1733.     write_byte(random_num( 80, 200 ))  
  1734.     write_byte(0)  
  1735.     write_byte(random_num( 50, 200 ))  
  1736.     message_end()
  1737.  
  1738.     return PLUGIN_CONTINUE
  1739. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement