Team Spartan Cookies & Milk Forums
  • Issue Tracker
  • Donations
  • Search
  • Member List
  • Help

Register

Team Spartan Cookies & Milk Forums Garry's Mod Expression 2 v
« Previous 1 2 3 4 5 6 … 8 Next »
Ship Detector
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Linear Mode
Ship Detector
24-01-2016, 12:05 PM,
#6
warhammer Offline
TSCM Member
***
Posts: 63
Threads: 9
Joined: Nov 2014
RE: Ship Detector
Does anyone know how I can get this
Code:
@name Ship Radar by T-17 @inputs EGP:wirelink @model @persist Ships:array Players:array E:entity Lines:vector Outline:vector Text:vector Mode interval(1000) if(first()|duped()|changed(EGP)){ ##Config Text = vec(255,255,255) #text color Outline = vec(0,164,255) #the main color Lines = vec(51,51,51) #background grid lines color Range = 2000 #radius to trigger alarm for shuttles ##END NO CHANGES BELOW, If you change stuff below then you lose the right to ask for help Mode = 1 E = EGP:entity() timer("ships",500) timer("preDraw",100) timer("buttoncheck",100) function number wirelink:button(Cursor:vector2,ID:number) { local BPos = This:egpPos(ID) local BSize = This:egpSize(ID)/2 local Pressed = inrange(Cursor,BPos-BSize,BPos+BSize) return Pressed } # findExcludePlayerProps(owner()) # findExcludeEntity(owner()) } if(clk("beep")){ E:soundPlay(1,100,"st/misc/tng_redalert.wav") } if(clk("ships")){ Ships = array() Players = array() findByClass("st_shuttle_*") Ships = findToArray() findByClass("player") Players = findToArray() timer("ships",4000) } ####DRAWING SHIPS/PLAYERS, this code is thanks to TSCM.Firestorm and TSCM.Alex5511. many use much thanks :P if(Mode==1){ for(I=1,Ships:count()){ Ship = Ships[I,entity] Dis = Ship:pos():distance(E:pos()) if(Dis<500 || Dis>5000 || Ship:pos()==vec(0,0,0)){EGP:egpRemove(200+I) EGP:egpRemove(100+I)}else{ Dif = Ship:pos() - E:pos() W = toRad(toDeg(atan(Dif:x(),Dif:y())) - toDeg(atan(E:eye():x(),E:eye():y()))) Org = sqrt(Dif:x()^2+Dif:y()^2) X = (sin(W)*Org)/4 Y = (-cos(W)*Org)/4 #X=sin(W)*Org #Y=-cos(W)*Org EGP:egpCircle(100+I,vec2(260+X/-2000*150,260+Y/-2000*150),vec2(2,2)) EGP:egpColor(100+I,teamColor(Ship:owner():team())) EGP:egpText(200+I,Ship:owner():name():left(10)+"'s ship" +" (" + round(Dis) + ")",vec2(275+X/-2000*150,255+Y/-2000*150)) EGP:egpSize(200+I,12) EGP:egpColor(200+I,teamColor(Ship:owner():team())) } } }else{ for(I=1,Players:count()){ Ply = Players[I,entity] Dis = Ply:pos():distance(E:pos()) if(Dis<200 || Dis>5000 || Ply:pos()==vec(0,0,0)){EGP:egpRemove(200+I) EGP:egpRemove(100+I)}else{ Dif = Ply:pos() - E:pos() W = toRad(toDeg(atan(Dif:x(),Dif:y())) - toDeg(atan(E:eye():x(),E:eye():y()))) Org = sqrt(Dif:x()^2+Dif:y()^2) X = (sin(W)*Org)/4 Y = (-cos(W)*Org)/4 #X=sin(W)*Org #Y=-cos(W)*Org EGP:egpCircle(100+I,vec2(260+X/-500*150,280+Y/-500*150),vec2(2,2)) EGP:egpColor(100+I,teamColor(Ply:team())) EGP:egpText(200+I,Ply:name():left(10)+" (" + round(Dis) + ")",vec2(265+X/-2000*150,255+Y/-2000*150)) EGP:egpSize(200+I,12) EGP:egpColor(200+I,teamColor(Ply:team())) } } } if(clk("preDraw")){ EGP:egpClear() EGP:egpBox(1,vec2(256,256),vec2(512,512)) EGP:egpColor(1,vec(31,31,31)) for(I=1,25){ local V = 512/25 EGP:egpLine(1+I,vec2(0,V*I),vec2(512,V*I)) EGP:egpColor(1+I,Lines) EGP:egpLine(27+I,vec2(V*I,0),vec2(V*I,512)) EGP:egpColor(27+I,Lines) } EGP:egpCircleOutline(52,vec2(256,256),vec2(2,2)) EGP:egpColor(52,Outline) EGP:egpText(53,"Ship Radar",vec2(20,20)) EGP:egpColor(53,Text) EGP:egpBox(54,vec2(60,492),vec2(120,40)) EGP:egpColor(54,Outline) EGP:egpBox(55,vec2(60,492),vec2(118,38)) EGP:egpColor(55,vec(31,31,31)) EGP:egpText(56,"Show Players",vec2(10,482)) EGP:egpColor(56,Text) } ##################### BUTTON CODE BY TSCM.BLACKHAWK, much easy many thanks :P if(clk("buttoncheck")){ User = EGP["User",entity] Use = User:keyUse() if(changed(Use) & Use){ Cursor = EGP:egpCursor(User) if(EGP:button(Cursor,55)){ if(Mode == 1){ for(I=1,20){ EGP:egpRemove(100+I) EGP:egpRemove(200+I) } EGP:egpSetText(56,"Show Ships") Mode = 0 }else{ for(I=1,20){ EGP:egpRemove(100+I) EGP:egpRemove(200+I) } EGP:egpSetText(56,"Show Players") Mode = 1 } } } timer("buttoncheck",200) }
to show more ships, at the moment it only shows shuttle11,6,9 but does anyone know how to add another such as the "puddle_jumper"?

It will flatten you
Find
Reply
« Next Oldest | Next Newest »


Messages In This Thread
Ship Detector - by warhammer - 18-01-2016, 09:02 PM
RE: Ship Detector - by TheOneAndOnlyTee - 18-01-2016, 10:49 PM
RE: Ship Detector - by warhammer - 19-01-2016, 07:52 AM
RE: Ship Detector - by TheOneAndOnlyTee - 19-01-2016, 08:45 AM
RE: Ship Detector - by warhammer - 19-01-2016, 05:10 PM
RE: Ship Detector - by warhammer - 24-01-2016, 12:05 PM
RE: Ship Detector - by warhammer - 28-01-2016, 07:17 PM
RE: Ship Detector - by TheOneAndOnlyTee - 29-01-2016, 03:39 AM

  • View a Printable Version
Forum Jump:


Users browsing this thread: 2 Guest(s)
Contact UsTeam Spartan Cookies & MilkReturn to TopLite (Archive) ModeMark all forums readRSS Syndication

Powered By MyBB, © 2002-2026 MyBB Group.