Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- client.lua
- require "enet"
- local host = enet.host_create()
- local server = host:connect("62.165.46.67:6789")
- gs=love.graphics
- pingtimedraw=0
- dl2=""
- pingtime=0
- function love.update(dt)
- local event = host:service(100)
- if event then
- if event.type == "connect" then
- event.peer:send("connected")
- elseif event.type == "receive" then
- if pingtime==0 then
- event.peer:send("ping")
- pingtime=pingtime+dt
- else
- pingtime=pingtime+dt end
- if event.data=="pong" then
- pingtimedraw=pingtime
- pingtime=0 end
- end
- end
- end
- function love.draw()
- gs.setColor(255,255,255)
- gs.print("client!",10,10)
- gs.print(pingtimedraw,10,50)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement