ULX

Author Topic: Join Messages & Command  (Read 3095 times)

0 Members and 1 Guest are viewing this topic.

Offline Mindless

  • Newbie
  • *
  • Posts: 31
  • Karma: 1
Join Messages & Command
« on: February 07, 2013, 07:44:21 PM »
Well basically i've scripted this thing with my friend but it doesn't work. It's currently in lua/autorun/server/join.lua - If anyone can tell me the error please it would very appericated!


Code: [Select]
--[[
    This makes it so that it shows players disconnecting and connecting. Aswell it allows people to type !join to join the group.

--]]
function fPlayerDisconnect( ply )
for k, v in pairs (player.GetAll()) do
umsg.Start("disconnect", v)
umsg.String(ply:Name())
umsg.String(tostring(ply:SteamID()))
umsg.End()
end
end
hook.Add( "PlayerDisconnected", "playerdisconnected", fPlayerDisconnect )

function fPlayerConnect( ply )
for k, v in pairs (player.GetAll()) do
umsg.Start("connect", v)
umsg.String(ply:Name())
umsg.String(tostring(ply:SteamID()))
umsg.End()
end
end
hook.Add( "PlayerConnected", "playerconnected", fPlayerConnect )

usermessage.Hook("connect", function(um)
chat.AddText(Color(158, 195, 79), um:ReadString().." has connected. (ID: "..um:ReadString()..")")
end)
usermessage.Hook("disconnect", function(um)
chat.AddText(Color(158, 195, 79), um:ReadString().." has left the server. (ID: "..um:ReadString()..")")
end)


function JoinCommand( pl, text, teamonly )
    if (text == "!join") then
    pl:SendLua([[gui.OpenURL("http://steamcommunity.com/groups/SourceGamin)]]) -- Change ADDRESS to your chosen page.
    for k, v in pairs(player.GetAll()) do v:ChatPrint( "Player " .. pl:Nick() .. " has joined our Steam group via !join." )

end
end
end
hook.Add( "PlayerSay", "Chat", JoinCommand )

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Join Messages & Command
« Reply #1 on: February 08, 2013, 12:31:59 AM »
Yeah, I'm looking at it right now. I don't know too much about user messages, but I know enough to get around. So give me about five minutes, and I hope I can fix this thing for you :)
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Join Messages & Command
« Reply #2 on: February 08, 2013, 01:21:19 AM »
Yeah, because I did "too much" to the code, I'll just send you them, because making a code tag[] for "all these", would just be a waste of time.. so here you go sir

https://mega.co.nz/#!zRUVhK6b!MYGYQiP_drZZPF62ZXr-7j7QF8sw1jtbEbKIOyafG3k
« Last Edit: February 08, 2013, 04:54:06 PM by chaos13125 »
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline Mindless

  • Newbie
  • *
  • Posts: 31
  • Karma: 1
Re: Join Messages & Command
« Reply #3 on: February 08, 2013, 05:39:39 PM »
Yeah, because I did "too much" to the code, I'll just send you them, because making a code tag[] for "all these", would just be a waste of time.. so here you go sir

https://mega.co.nz/#!zRUVhK6b!MYGYQiP_drZZPF62ZXr-7j7QF8sw1jtbEbKIOyafG3k

It crashes my server when people type: !join - otherwise it works perfect.

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Join Messages & Command
« Reply #4 on: February 08, 2013, 05:49:35 PM »
Did you make sure to delete your old script?
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline Mindless

  • Newbie
  • *
  • Posts: 31
  • Karma: 1
Re: Join Messages & Command
« Reply #5 on: February 08, 2013, 05:58:40 PM »
Did you make sure to delete your old script?

Yeah.

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Join Messages & Command
« Reply #6 on: February 08, 2013, 06:11:37 PM »
well I don't see anything wrong with it, but I did change a few things. So here you go..

https://mega.co.nz/#!yJkjnCrb!Y_H0KUTETOshbXUEmDQFOl37jmZf_xSOW83vxtF5bWM

remember, put this in lua/autorun
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.