Team Spartan Cookies & Milk Forums
Broken E2 Code - Printable Version

+- Team Spartan Cookies & Milk Forums (https://teamscm.co.uk)
+-- Forum: Garry's Mod (https://teamscm.co.uk/forum-4.html)
+--- Forum: Help and Support (https://teamscm.co.uk/forum-8.html)
+--- Thread: Broken E2 Code (/thread-3509.html)



Broken E2 Code - Funlax - 19-11-2020

i have found some code i wish to use but it seems broken. can anyone make it work again? any help is appreciated.

If you wish to find it in-game, it can be found under the 'cap-shared' folder in the e2 editor.


@name Dial Closest Stargate
@inputs SG:wirelink Button AllowBlocked
@outputs True
@persist AddressList:table

True=1

if (Button & ~Button) {
AddressList = SGConfusedtargateAddressList()
Min = -1
for(I=0,AddressList:count()-1) {
V = AddressList[I,array]
Address = V[1,string] # Get address
Blocked = V[3,number] # Get blocked
Distance = SGConfusedtargateGetDistanceFromAddress(Address)
if (Min > Distance || Min<0) {
if (Blocked==0 || AllowBlocked==1) {
Min = Distance
BestGate = Address
}
}
}
SGConfusedtargateDial(BestGate, 1)
}