Jump to content

[SOLVED] Join Quit messages.


Recommended Posts

Hello all, my name is Chris, and i am currently developing a script which will be shared, i am a beginner, but it has some pretty useful stuff. It will be made public soon.

For anyone which helps me with this script/project will be credited when released.

Here i am trying to create a setting which changes the color of the text, BUT, thats not my only problem, the nick is fine, the join message wont work at all. Anyone aware why?

The meta:

<meta> 
    <info author="[EGL]Chris" version="0.5" type="script" name="Essentials" description="This script add's alot of features for admin's and players. Hope you like it." /> 
    <settings> 
        <setting name="*language" value="english" /> 
        <setting name="*color" value="255,200,100" /> 
    </settings> 
    <script src="admintag.lua" type="server" /> 
    <script src="admincommands.lua" type="server" /> 
    <script src="ip+serial.lua" type="server" /> 
    <script src="welcome.lua" type="server" /> 
    <script src="joinquit.lua" type="server" /> 
</meta> 

local color = get('joinquitcolor') 
local root = getRootElement() 
local name = getPlayerName(source) 
local old = oldNick  
local new = newNick 
local ip = getPlayerIP (thePlayer) 
local version = getPlayerVersion (playerSource) 
local country = call(getResourceFromName("admin"), "getPlayerCountry", source) 
function playerjoin(root) 
outputChatBox(name.." has joined the server. ["..country.."] ["..ip.."] ["..version.."]",root,color) 
end  
addEventHandler("onPlayerJoin",root,playerjoin) 
  
function playerquit(reason) 
if reason == Disconnected then 
outputChatBox(name.." has disconnected from the server",root, color) 
elseif (reason == Kicked) then 
outputChatBox(name.." has been kicked from the server",root,color) 
elseif (reason == Banned) then 
outputChatBox(name.." has been banned from the server",root,color) 
elseif (reason == TimedOut) then 
outputChatBox(name.." has lost connection with the server",root,color) 
end 
end 
addEventHandler("onPlayerJoin",getRootElement(),playerquit) 
  
function playernickchange(oldNick,newNick) 
outputChatBox("* "..old.." has changed his name to "..new,root,255,100,100) 
end 

Edited by Guest
Link to comment
Hello all, my name is Chris, and i am currently developing a script which will be shared, i am a beginner, but it has some pretty useful stuff. It will be made public soon.

For anyone which helps me with this script/project will be credited when released.

Here i am trying to create a setting which changes the color of the text, BUT, thats not my only problem, the nick is fine, the join message wont work at all. Anyone aware why?

The meta:

<meta> 
    <info author="[EGL]Chris" version="0.5" type="script" name="Essentials" description="This script add's alot of features for admin's and players. Hope you like it." /> 
    <settings> 
        <setting name="*language" value="english" /> 
        <setting name="*color" value="255,200,100" /> 
    </settings> 
    <script src="admintag.lua" type="server" /> 
    <script src="admincommands.lua" type="server" /> 
    <script src="ip+serial.lua" type="server" /> 
    <script src="welcome.lua" type="server" /> 
    <script src="joinquit.lua" type="server" /> 
</meta> 

local color = get('joinquitcolor') 
local root = getRootElement() 
local name = getPlayerName(source) 
local old = oldNick  
local new = newNick 
local ip = getPlayerIP (thePlayer) 
local version = getPlayerVersion (playerSource) 
local country = call(getResourceFromName("admin"), "getPlayerCountry", source) 
function playerjoin(root) 
outputChatBox(name.." has joined the server. ["..country.."] ["..ip.."] ["..version.."]",root,color) 
end  
addEventHandler("onPlayerJoin",root,playerjoin) 
  
function playerquit(reason) 
if reason == Disconnected then 
outputChatBox(name.." has disconnected from the server",root, color) 
elseif (reason == Kicked) then 
outputChatBox(name.." has been kicked from the server",root,color) 
elseif (reason == Banned) then 
outputChatBox(name.." has been banned from the server",root,color) 
elseif (reason == TimedOut) then 
outputChatBox(name.." has lost connection with the server",root,color) 
end 
end 
addEventHandler("onPlayerJoin",getRootElement(),playerquit) 
  
function playernickchange(oldNick,newNick) 
outputChatBox("* "..old.." has changed his name to "..new,root,255,100,100) 
end 

thanks i see your point, i fixed the script to be client, but still the join message wont work.

Anyone else? btw, i think its something todo witht he country and serial, and ip.

Link to comment

you have two event onPlayerJoin -_-

try this

  
local color = get('joinquitcolor') 
  
function playerjoin() 
local name = getPlayerName(source) 
local ip = getPlayerIP (source) 
local version = getPlayerVersion (source) 
local country = call(getResourceFromName("admin"), "getPlayerCountry", source) 
if country then 
    outputChatBox(name.." has joined the server. ["..country.."] ["..ip.."] ["..version.."]",root,color) 
    else 
    outputChatBox(name.." has joined the server. [unknow] ["..ip.."] ["..version.."]",root,color) 
    end 
end 
addEventHandler("onPlayerJoin",root,playerjoin) 
  
function playerquit(reason) 
local name = getPlayerName(source) 
if reason == "Quit" then 
outputChatBox(name.." has disconnected from the server",root, color) 
elseif (reason == "Kicked" ) then 
outputChatBox(name.." has been kicked from the server",root,color) 
elseif (reason == "Banned" ) then 
outputChatBox(name.." has been banned from the server",root,color) 
elseif (reason == "Timed out") then 
outputChatBox(name.." has lost connection with the server",root,color) 
end 
end 
addEventHandler("onPlayerQuit",root,playerquit) 
  
function playernickchange(oldNick, newNick) 
outputChatBox("* "..old.." has changed his name to "..new,root,255,100,100) 
end 
addEventHandler("onPlayerChangeNick", root, playernickchange) 

---------------------------------------------------

    "[EGL]Chris" version="0.5" type="script" name="Essentials" description="This script add's alot of features for admin's and players. Hope you like it." /> 
    
        "*language" value="english" /> 
        "*joinquitcolor" value="255,200,100" /> 
    
    

Link to comment
you have two event onPlayerJoin -_-

try this

  
local color = get('joinquitcolor') 
  
function playerjoin() 
local name = getPlayerName(source) 
local ip = getPlayerIP (source) 
local version = getPlayerVersion (source) 
local country = call(getResourceFromName("admin"), "getPlayerCountry", source) 
if country then 
    outputChatBox(name.." has joined the server. ["..country.."] ["..ip.."] ["..version.."]",root,color) 
    else 
    outputChatBox(name.." has joined the server. [unknow] ["..ip.."] ["..version.."]",root,color) 
    end 
end 
addEventHandler("onPlayerJoin",root,playerjoin) 
  
function playerquit(reason) 
local name = getPlayerName(source) 
if reason == "Quit" then 
outputChatBox(name.." has disconnected from the server",root, color) 
elseif (reason == "Kicked" ) then 
outputChatBox(name.." has been kicked from the server",root,color) 
elseif (reason == "Banned" ) then 
outputChatBox(name.." has been banned from the server",root,color) 
elseif (reason == "Timed out") then 
outputChatBox(name.." has lost connection with the server",root,color) 
end 
end 
addEventHandler("onPlayerQuit",root,playerquit) 
  
function playernickchange(oldNick, newNick) 
outputChatBox("* "..old.." has changed his name to "..new,root,255,100,100) 
end 
addEventHandler("onPlayerChangeNick", root, playernickchange) 

---------------------------------------------------

    "[EGL]Chris" version="0.5" type="script" name="Essentials" description="This script add's alot of features for admin's and players. Hope you like it." /> 
    
        "*language" value="english" /> 
        "*joinquitcolor" value="255,200,100" /> 
    
    

TAPL, I ABSOLUTELY LOVE YOU!!! YOU ARE HELPING ME ALOT. THANK YOU.

The join works perfectly, what about the nick :| that wont work lol, any idea's?

Link to comment
  
local color = get('joinquitcolor') 
  
function playerjoin() 
local name = getPlayerName(source) 
local ip = getPlayerIP (source) 
local version = getPlayerVersion (source) 
local country = call(getResourceFromName("admin"), "getPlayerCountry", source) 
if country then 
    outputChatBox(name.." has joined the server. ["..country.."] ["..ip.."] ["..version.."]",root,color) 
    else 
    outputChatBox(name.." has joined the server. [unknow] ["..ip.."] ["..version.."]",root,color) 
    end 
end 
addEventHandler("onPlayerJoin",root,playerjoin) 
  
function playerquit(reason) 
local name = getPlayerName(source) 
if reason == "Quit" then 
outputChatBox(name.." has disconnected from the server",root, color) 
elseif (reason == "Kicked" ) then 
outputChatBox(name.." has been kicked from the server",root,color) 
elseif (reason == "Banned" ) then 
outputChatBox(name.." has been banned from the server",root,color) 
elseif (reason == "Timed out") then 
outputChatBox(name.." has lost connection with the server",root,color) 
end 
end 
addEventHandler("onPlayerQuit",root,playerquit) 
  
function playernickchange(old, new) 
outputChatBox("* "..old.." has changed his name to "..new,root,255,100,100) 
end 
addEventHandler("onPlayerChangeNick", root, playernickchange) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...