ID:174271
 
I need a way to store a client.address when a client logs on in like a file, people/[ckey]/IP.sav , that way, i have everyone who logs into my games IP so if i have a problem with them, in game i could ban them without them there. I plan to define a proc that will give me a list of keys which i can choose from and it will give me the owner of that keys IP so i could input the IP into my ban.sav file.
If someone could help me with the storing IP code, id be greatly appreciative.

Trog
client/New()
..()
var/savefile/F = new("people/[ckey]/IP.sav")
F<<address

simple as that...

In response to JackGuy
BTW that code you gave me didnt work, i used a save file editor and there was no IP in there to be found; i tried the original and this
client/New()
..()
var/savefile/F = new("people/[ckey]/IP.sav")
F["[address]"] << address
but neither worked

Alright, but how could i make a verb so that i can see a list of the ckeys stored with like a switch, choose one and it will show me there ip?
like:

mob/verb/FindRP()
var/savefile/F = new("people/[ckey]/IP.sav")
var/checking
F["[client.address]"] >> checking
if(client.address == checking)
world<<"[client.address]"

but that didnt work, if anyone can help that would be great.
Trog
In response to Troglodyte
Use flist() (look it up in the reference) to get the contents of the "people" folder.
In response to Crispy
I tried this piece of code, but it didnt work.

client/New()
..()
var/savefile/F = new("people/[ckey]/IP.sav")
F["[address]"] << address

it may have stored something, cause it creats a people and troglodyte folder and an IP.sav, but when using nadrews save file editor, i found no IP address within the sav file
is this code right? and if so is there another way i could check if it stored the address?

Trog
In response to Troglodyte
YOU NEED TO BE ON A HOSTED SERVER TO HAVE AN ADDRESS
If you are not on a hosted server, it will act as though you are not online, and your IP will be null. Therefor sending null to the IP.sav file.
In response to JackGuy
this is what i have so far, if someone fixes this for me, and creates the .txt code i wanted on the bottom, il pay 45 dimes.
client/New()
..()
if(address != null)//i only want it to save them if there address is saved

var/savefile/F = new("people/[ckey]/IP.sav")//i created this setup so i could tell if someone has more then one IP
var/savefile/G = new("IP/[address]/[ckey].sav")//i created this setup so i could tell if an IP is shared between more then 1 key
F<<address//saves address
G<<address//saves address
mob
verb
saved_IP()
var/AH = flist("people")//a file list..that i dont know how to use
switch(alert("whos IP would you like to look at?",,AH))//I doubt this is right
var/savefile/F = new("people/[ckey]/IP.sav")//eh
F >> address//get the address from the file
usr<<"[ckey]'s IP is :[address]"//tell me the ip

/*Id also like to save a MultipleIP.txt file
that saves at client/New() a report to let me
know which keys share an IP address and which
keys were used on different IP's.
.....say
at client/New() you call a proc that checks
if there is multiple IP's to a key and logs
it in a .txt file and a proc that also
checks in IP/[address] to see if more then
1 key uses the same IP and logs that info
into a .txt file which is saved in the
environment file
*/

Post here if your interested in the 45 dimes,
and are able to fix this problem and help with
my request.
Trog
In response to Troglodyte
switch(alert("whos IP would you like to look at?",,AH))//

that needs changed to:

switch(input("whos IP would you like to look at?","") in AH)

because,
1) can not read a list in ALERT proc, and
2) when using the input proc, if you want the options to appear from a list, you put: in LIST
after input("message","title")
In response to Troglodyte
You dont have to lie to get information, we all practically knew you were not going to pay anyone 45 dimes for a simple syntax error you made V_V
In response to JackGuy
do you have AIm? cause il send you the environment, you fix it and il send you the dime and you can send me the environment, i have the dimes
In response to Troglodyte
jackguy2k6
is my AIM s/n
In response to Troglodyte
Ok, i have it finished, (sorry for the delay, had a storm last night while i was working, and computer went off) Please log back on AIM so i can send you the files.
In response to JackGuy
Cant you use Write(file,value)? It will append to the value to the end of the file. I've never used it, but from memory, you may be able to use this.
Write("players/ip-[ckey].txt","/n[address]")
In response to Troglodyte
client/New()
..()
if(address)
var/savefile/F = new()
var/txtfile = file("IPs/KEYS/[copytext(key, 1,2)]/[key].txt")
F << address
F.ExportText("/",txtfile)
var/savefile/E = new()
var/txtfilee = file("IPs/IPS/[address].txt")
E["[key]"] << address
E.ExportText("/",txtfilee)
var/savefile/G = new("IP.sav")
G["[key]/[address]"]<<address
else
src << "No IP Address Detected, This will become active as soon as you host a server, and people join."

mob/verb/Check_IPS()
var/savefile/F = new("IP.sav")
F.cd = input("What key do you wish to look at?","") in F.dir
usr << input("These are his IPs","") in F.dir

I tested it, its bug-free, and works, it even tells you what to do if you try it. Of course, its just my style, theres probobly, better scripters who may have a 'better' way of doing this. But how it got it, its pretty good, and organized with the file's