Bjornir90

Serveur.lua

Nov 11th, 2012
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | None | 0 0
  1. rednet.open("right")
  2. shell.run"clear"
  3. shell.run"id"
  4. exit = 0
  5.  
  6. while exit == 0  do
  7.  id, idToSend = rednet.receive()
  8.  print("Id de l'ordinateur destinataire r�ceptionn�e")
  9.  print("L'ordinateur destinataire a l'id :")
  10.  write(idToSend)
  11.  print(" ")
  12.  msgVerification = 0
  13.  
  14.  idToSend1 = tonumber(idToSend)
  15.  
  16.  if idToSend == "9" then
  17.   print("Message au serveur r�ceptionn�")
  18.   id, msg = rednet.receive()
  19.  
  20.   if msg == "p" then
  21.    id, msg1 = rednet.receive()
  22.    id, msg2 = rednet.receive()
  23.    shell.run(msg1, msg2)
  24.  
  25.   elseif msg == "f" then
  26.    id, msg1 = rednet.receive()
  27.    loadstring(msg1) ()
  28.  
  29.   elseif msg == "exit" then
  30.    shell.run("clear")
  31.    rednet.close("right")
  32.    return
  33.  
  34.   end
  35.  
  36.  else
  37.   id, msgType = rednet.receive()
  38.   id, msgCommande = rednet.receive()
  39.   print("Message r�ceptionn�")
  40.   while msgVerification == 0 do
  41.    rednet.send(idToSend1, msgType)
  42.    rednet.send(idToSend1, msgCommande)
  43.    if msgType == "p" then
  44.     id, msgArg = rednet.receive()
  45.     rednet.send(idToSend1, msgArg)
  46.    end
  47.    id, msgVerification = rednet.receive(4)
  48.   end
  49.  
  50.  end
  51. end
Advertisement
Add Comment
Please, Sign In to add comment