Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name Stress's Identity Scan
- @persist [O E]:entity [Building] [Done]
- @persist [ScanCreate] [Scans]:array [Scan]:entity [Name]:string
- if(first()){O=owner(),E=entity(),runOnChat(1),rangerIgnoreWorld(1)} interval(50) #If the scan doesn't work sometimes, try to lower the interval.
- if(chatClk(O)) #Or it's up to you to decide if you need tick runs.
- {
- OLS=O:lastSaid():explode(" "),S1=OLS:string(1),S2=OLS:string(2),S3=OLS:string(3)
- if(S1:left(5)=="/scan")
- {
- hideChat(1)
- if(S2=="create")
- {
- if(holoCanCreate())
- {
- Building=1,ScanCreate=1
- for(H=1,2){holoCreate(H)}
- holoModel(1,"models/props_combine/combine_light001b.mdl"),holoAlpha(1,150)
- holoMaterial(2,"models/props_combine/tpballglow"),holoAlpha(2,0)
- }else{print("You can't use this e2 on your actual server !"),selfDestruct()}
- }
- if(S2=="undo"&Done)
- {
- Building=0,ScanCreate=0
- for(H=1,2){holoDelete(H)}
- foreach(K,P:entity=Scans){P:propDelete()},Scans:clear(),E:soundPlay(1,1,"hl1/fvox/deactivated.wav")
- printColor(vec(255,0,0),"[StressSecuritySystem] ",vec(255,90,0),"Scan removed, you can now place a new one !")
- }
- if(S2=="stopcreate"){Building=0,ScanCreate=0,foreach(K,P:entity=Scans){if(P){P:propDelete(),Scans:clear()}}}
- 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()}
- if(S2=="name"&Done){Name=O:lastSaid():sub(12),print("Scan named to "+Name)}
- }
- }
- if(Building)
- {
- OAE=O:aimPos(),KE=O:keyUse()
- if(ScanCreate)
- {
- holoPos(1,OAE+O:eyeTrace():hitNormal()*(holoEntity(1):boxSize():length()-(holoEntity(1):boxSize():length()/1.2)))
- if(changed(KE)&KE)
- {
- Scan=propSpawn(holoEntity(1):model(),holoEntity(1):pos(),holoEntity(1):angles(),1)
- Scans:pushEntity(Scan)
- holoAlpha(2,255)
- }
- if(Scans:count()==1)
- {
- MidX=(Scans[1,entity]:pos():x()+holoEntity(1):pos():x())/2,MidY=(Scans[1,entity]:pos():y()+holoEntity(1):pos():y())/2
- holoPos(2,vec(MidX,MidY,Scans[1,entity]:boxCenterW():z()))
- holoAng(2,(Scans[1,entity]:boxCenterW()-holoEntity(1):boxCenterW()):toAngle())
- Length=(Scans[1,entity]:pos()-holoEntity(1):pos()):length()/6
- holoScale(2,vec(Length/2,0.5,5))
- }
- if(Scans:count()==2)
- {
- holoDelete(1)
- Scans[1,entity]:setAng((Scans[1,entity]:pos()-Scans[2,entity]:pos()):toAngle())
- Scans[2,entity]:setAng((Scans[2,entity]:pos()-Scans[1,entity]:pos()):toAngle())
- printColor(vec(255,0,0),"[StressSecuritySystem] ",vec(255,90,0),"Scan created and activated !")
- holoEntity(2):soundPlay(2,0.900,"hl1/fvox/activated.wav")
- ScanCreate=0,Building=0,Done=1
- }
- }
- }
- if(Done)
- {
- rangerFilter(Scans)
- Ranger=rangerOffset(Scans[1,entity]:pos():distance(Scans[2,entity]:pos()),Scans[2,entity]:boxCenterW(),Scans[1,entity]:forward())
- if(changed(Ranger:entity():isPlayer())&Ranger:entity():isAlive())
- {
- holoEntity(2):soundPlay(3,1,"ambient/alarms/klaxon1.wav")
- 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)," !")}
- 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)," !")}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement