iFoReX Posted February 6, 2013 Posted February 6, 2013 addEventHandler("onPlayerJoin",root,function() local hFile = fileOpen("jugadores.txt") if hFile then nombre = getPlayerName(source):gsub ( "#%x%x%x%x%x%x", "" ) serial = getPlayerSerial(source) ip = getPlayerIP(source) fileWrite(hFile,"Nombre : "..nombre.." - Serial : "..serial.." - IP : "..ip.."") end end ) Porque no pasa nada ? D:
Castillo Posted February 6, 2013 Posted February 6, 2013 A que te referis con "no pasa nada"? pusiste el script como server side, no?
iFoReX Posted February 6, 2013 Author Posted February 6, 2013 si D: y no pasa nada ningun error ni nada
Castillo Posted February 6, 2013 Posted February 6, 2013 Te olvidaste de cerrar el archivo despues de escribir en el: fileClose ( hFile )
iFoReX Posted February 6, 2013 Author Posted February 6, 2013 Ok tengo una duda ( lo probe en mi local ) esto se va escribiendo por lineas ? ejemplo : Nombre : -|TwD|-GaTiiTo - Serial : XXXXXXXXXXXXXXXX - IP : 192.168.xx.xx y si se conecta otro player se crea otra linea o se reemplaza esa linea ?
Castillo Posted February 6, 2013 Posted February 6, 2013 Se remplazara la linea, tenes que leer el archivo y crear una nueva linea.
iFoReX Posted February 7, 2013 Author Posted February 7, 2013 addEventHandler("onPlayerJoin",root,function() local hFile = fileOpen("jugadores.txt") if hFile then nombre = getPlayerName(source):gsub ( "#%x%x%x%x%x%x", "" ) serial = getPlayerSerial(source) ip = getPlayerIP(source) local readf = fileRead(hFile, 500) fileWrite(hFile,readf.."Nombre : "..nombre.." - Serial : "..serial.." - IP : "..ip.."") fileClose ( hFile ) end end ) Listo ahora funciona pero aparece asi T_T Nombre : -|TwD|-GaTiiTo - Serial : XXXXXXXXXXXXXXXX - IP : 192.168.xx.xxNombre : -|TwD|-ElMota - Serial : XXXXXXXXXXXXXXXX - IP : 192.168.xx.xx Como hago para que aparesca asi : Nombre : -|TwD|-GaTiiTo - Serial : XXXXXXXXXXXXXXXX - IP : 192.168.xx.xx Nombre : -|TwD|-ElMota - Serial : XXXXXXXXXXXXXXXX - IP : 192.168.xx.xx ??
iFoReX Posted February 7, 2013 Author Posted February 7, 2013 Alexs y su mala sabiduria ya lo resolvieron )
Recommended Posts