Advertisement
KG_Infinite

ss

Sep 10th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.85 KB | None | 0 0
  1. @name Stress's Identity Scan
  2. @persist [O E]:entity [Building] [Done]
  3. @persist [ScanCreate] [Scans]:array [Scan]:entity [Name]:string
  4.  
  5. if(first()){O=owner(),E=entity(),runOnChat(1),rangerIgnoreWorld(1)} interval(50) #If the scan doesn't work sometimes, try to lower the interval.
  6. if(chatClk(O)) #Or it's up to you to decide if you need tick runs.
  7. {
  8. OLS=O:lastSaid():explode(" "),S1=OLS:string(1),S2=OLS:string(2),S3=OLS:string(3)
  9. if(S1:left(5)=="/scan")
  10. {
  11. hideChat(1)
  12. if(S2=="create")
  13. {
  14. if(holoCanCreate())
  15. {
  16. Building=1,ScanCreate=1
  17. for(H=1,2){holoCreate(H)}
  18. holoModel(1,"models/props_combine/combine_light001b.mdl"),holoAlpha(1,150)
  19. holoMaterial(2,"models/props_combine/tpballglow"),holoAlpha(2,0)
  20. }else{print("You can't use this e2 on your actual server !"),selfDestruct()}
  21. }
  22. if(S2=="undo"&Done)
  23. {
  24. Building=0,ScanCreate=0
  25. for(H=1,2){holoDelete(H)}
  26. foreach(K,P:entity=Scans){P:propDelete()},Scans:clear(),E:soundPlay(1,1,"hl1/fvox/deactivated.wav")
  27. printColor(vec(255,0,0),"[StressSecuritySystem] ",vec(255,90,0),"Scan removed, you can now place a new one !")
  28. }
  29. if(S2=="stopcreate"){Building=0,ScanCreate=0,foreach(K,P:entity=Scans){if(P){P:propDelete(),Scans:clear()}}}
  30. if(S2=="destroy"&Done){foreach(K,P:entity=Scans){P:propDelete()},printColor(vec(255,0,0),"[SSS] ",vec(255,90,0),"Stress's Identity Scan deleted !"),selfDestruct()}
  31. if(S2=="name"&Done){Name=O:lastSaid():sub(12),print("Scan named to "+Name)}
  32. }
  33. }
  34. if(Building)
  35. {
  36. OAE=O:aimPos(),KE=O:keyUse()
  37. if(ScanCreate)
  38. {
  39. holoPos(1,OAE+O:eyeTrace():hitNormal()*(holoEntity(1):boxSize():length()-(holoEntity(1):boxSize():length()/1.2)))
  40. if(changed(KE)&KE)
  41. {
  42. Scan=propSpawn(holoEntity(1):model(),holoEntity(1):pos(),holoEntity(1):angles(),1)
  43. Scans:pushEntity(Scan)
  44. holoAlpha(2,255)
  45. }
  46. if(Scans:count()==1)
  47. {
  48. MidX=(Scans[1,entity]:pos():x()+holoEntity(1):pos():x())/2,MidY=(Scans[1,entity]:pos():y()+holoEntity(1):pos():y())/2
  49. holoPos(2,vec(MidX,MidY,Scans[1,entity]:boxCenterW():z()))
  50. holoAng(2,(Scans[1,entity]:boxCenterW()-holoEntity(1):boxCenterW()):toAngle())
  51. Length=(Scans[1,entity]:pos()-holoEntity(1):pos()):length()/6
  52. holoScale(2,vec(Length/2,0.5,5))
  53. }
  54. if(Scans:count()==2)
  55. {
  56. holoDelete(1)
  57. Scans[1,entity]:setAng((Scans[1,entity]:pos()-Scans[2,entity]:pos()):toAngle())
  58. Scans[2,entity]:setAng((Scans[2,entity]:pos()-Scans[1,entity]:pos()):toAngle())
  59. printColor(vec(255,0,0),"[StressSecuritySystem] ",vec(255,90,0),"Scan created and activated !")
  60. holoEntity(2):soundPlay(2,0.900,"hl1/fvox/activated.wav")
  61. ScanCreate=0,Building=0,Done=1
  62. }
  63. }
  64. }
  65. if(Done)
  66. {
  67. rangerFilter(Scans)
  68. Ranger=rangerOffset(Scans[1,entity]:pos():distance(Scans[2,entity]:pos()),Scans[2,entity]:boxCenterW(),Scans[1,entity]:forward())
  69. if(changed(Ranger:entity():isPlayer())&Ranger:entity():isAlive())
  70. {
  71. holoEntity(2):soundPlay(3,1,"ambient/alarms/klaxon1.wav")
  72. if(!Name){printColor(vec(255,0,0),"[SSS] ",vec(50,50,50),Ranger:entity():name(),vec(255,90,0)," detected holding ",vec(50,50,50),Ranger:entity():weapon():type(),vec(255,90,0)," !")}
  73. elseif(Name){printColor(vec(255,0,0),"[SSS] ",vec(50,50,50),Ranger:entity():name(),vec(255,90,0)," detected by Scan near ",vec(255,0,0),Name,vec(255,90,0)," holding ",vec(50,50,50),Ranger:entity():weapon():type(),vec(255,90,0)," !")}
  74. }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement