iFoReX Posted February 6, 2013 Share 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: Link to comment
Castillo Posted February 6, 2013 Share Posted February 6, 2013 A que te referis con "no pasa nada"? pusiste el script como server side, no? Link to comment
iFoReX Posted February 6, 2013 Author Share Posted February 6, 2013 si D: y no pasa nada ningun error ni nada Link to comment
Castillo Posted February 6, 2013 Share Posted February 6, 2013 Te olvidaste de cerrar el archivo despues de escribir en el: fileClose ( hFile ) Link to comment
iFoReX Posted February 6, 2013 Author Share 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 ? Link to comment
Castillo Posted February 6, 2013 Share Posted February 6, 2013 Se remplazara la linea, tenes que leer el archivo y crear una nueva linea. Link to comment
iFoReX Posted February 7, 2013 Author Share 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 ?? Link to comment
Renkon Posted February 7, 2013 Share Posted February 7, 2013 Luego de la ip agrega \n Link to comment
iFoReX Posted February 7, 2013 Author Share Posted February 7, 2013 Alexs y su mala sabiduria ya lo resolvieron ) Link to comment
Recommended Posts