Jump to content

Team Script


Recommended Posts

Hey i've been editing Sniper's teamscript and tried to add a donator team. I sincerily couldnt make it work. it keeps appearing at the end of a normal player [Donator]. If i add a player to Us or Donator, it works and goes fine. the problem is that for example when i remove the Us and logout and login it adds at the end the [M]. Any help of how to fix it?

It also doesnt adds any colour to text as supposed.

Also: It works if the -|Us|- Only is alone. (i did the script edit like that first and worked) but then i wanted to do a copy and use them both. (wut an idiot) and i founded they overworked and i got messages twice. so i edited them in 1 and got this:

--[[***************************************** 
*                                           *
*   -|Us|- Teamscript                   *
*-------------------------------------------*
*   teamscript.lua -- server            *
*       Original by Sniper          *
 
*       Edited by HyPeX             *
*********************************************]]
 
local resourceRoot = getResourceRootElement(getThisResource())
 
 
--[[*************************************************
*        Part I: tests, resourcestart               *
*****************************************************]]
local testload
local testteam
local testacl
 
local usteam
local doteam
 
--output load message
addEventHandler("onResourceStart", resourceRoot,
function ()
    outputChatBox("SCRIPT: -|Us|- & Donator teamscript by
 
HyPeX successfully loaded!")
    testload = true
end)
 
--create Teams
addEventHandler("onResourceStart", resourceRoot,
function ()
    usteam = createTeam("-|Us|- Members", 2, 134, 183)
    if (getTeamFromName("-|Us|- Members")) then
        testteam = true
        outputChatBox("SCRIPT: -|Us|- Team successfully
 
created!")
    else
        outputChatBox("SCRIPT ERROR: -|Us|- Team could
 
not be created!")
        testteam = false
    end
end)
 
--create Teams
addEventHandler("onResourceStart", resourceRoot,
function ()
    doteam = createTeam("Donators", 100, 255, 100)
    if (getTeamFromName("Donators")) then
        testteam = true
        outputChatBox("SCRIPT: Donator Team successfully
 
created!")
    else
        outputChatBox("SCRIPT ERROR: Donator Team could
 
not be created!")
        testteam = false
    end
end)
 
--build the "Us" group in ACL
addEventHandler("onResourceStart", resourceRoot,
function ()
    if (aclGetGroup("Us") == nil) or (aclGetGroup("Us") ==
 
false) then
        outputChatBox("SCRIPT: Creating Us group in
 
ACL...")
        aclCreateGroup("Us")
    else
        outputChatBox("SCRIPT: Group -|Us|- is already
 
added in ACL")
    end
end)
 
--build the "Do" group in ACL
addEventHandler("onResourceStart", resourceRoot,
function ()
    if (aclGetGroup("Do") == nil) or (aclGetGroup("Do") ==
 
false) then
        outputChatBox("SCRIPT: Creating Do group in
 
ACL...")
        aclCreateGroup("Do")
    else
        outputChatBox("SCRIPT: Group Donators is already
 
added in ACL")
    end
end)
 
--check if THIS resource is added in ACL else output warning
addEventHandler("onResourceStart", resourceRoot,
function ()
    if not (isObjectInACLGroup("resource."
 
..getResourceName(getThisResource()), aclGetGroup("Admin"))) then
        outputChatBox("SCRIPT ERROR: Please add this
 
resource (teamscript) as 'resource.' into the
 
ACL Group 'Admin' else this script won't work!")
        outputDebugString("SCRIPT ERROR: Please add this
 
resource (teamscript) as 'resource.' into the
 
ACL Group 'Admin' else this script won't work!", 1, 255, 0, 0)
        testacl = false
    else
        testacl = true
    end
end)
 
--[[*************************************************
*        Part II: manage players                    *
*****************************************************]]
--command for adding a player to Us Group
function addPlayerToUs (playerSource, commandName, accountName)
    if (isObjectInACLGroup (
 
"user."..getAccountName(getPlayerAccount(playerSource)),
 
aclGetGroup("Admin"))) then
            if (accountName) then
                --if (getAccount(accountName))
 
then
                    aclGroupAddObject
 
(aclGetGroup("Us"), "user."..accountName)
                    outputChatBox("Account
 
'"..accountName.."#00ff00' succesfully added to the Us ACL
 
group", playerSource, 0, 255, 0, true)
                    if
 
(getAccount(accountName)) then
                       
 
setPlayerTeam(getAccountPlayer(getAccount(accountName)), usteam)
                    end
                --else
                    --outputChatBox("Account
 
could not be found! Please enter the correct accountname!",
 
playerSource, 255, 0, 0, true)
                --end
            else
                outputChatBox ("No account name
 
specified.", playerSource, 255, 0, 0, true)
                outputChatBox ("Syntax: /addus
 
[accountName]", playerSource, 255, 0, 0, true)
            end
    else
        outputChatBox ("Sorry but only admins can use
 
this!", playerSource, 255, 0, 0, true)
    end
end
addCommandHandler("addus", addPlayerToUs)
 
--command for adding a player to Do Group
function addPlayerToDo (playerSource, commandName, accountName)
    if (isObjectInACLGroup (
 
"user."..getAccountName(getPlayerAccount(playerSource)),
 
aclGetGroup("Admin"))) then
            if (accountName) then
                --if (getAccount(accountName))
 
then
                    aclGroupAddObject
 
(aclGetGroup("Do"), "user."..accountName)
                    outputChatBox("Account
 
'"..accountName.."#00ff00' succesfully added to the Do ACL
 
group", playerSource, 0, 255, 0, true)
                    if
 
(getAccount(accountName)) then
                       
 
setPlayerTeam(getAccountPlayer(getAccount(accountName)), doteam)
                    end
                --else
                    --outputChatBox("Account
 
could not be found! Please enter the correct accountname!",
 
playerSource, 255, 0, 0, true)
                --end
            else
                outputChatBox ("No account name
 
specified.", playerSource, 255, 0, 0, true)
                outputChatBox ("Syntax: /adddo
 
[accountName]", playerSource, 255, 0, 0, true)
            end
    else
        outputChatBox ("Sorry but only admins can use
 
this!", playerSource, 255, 0, 0, true)
    end
end
addCommandHandler("adddo", addPlayerToDo)
 
--command for removing a player from the Us Group
function removePlayerFromUs (playerSource, commandName,
 
accountName)
    if (isObjectInACLGroup (
 
"user."..getAccountName(getPlayerAccount(playerSource)),
 
aclGetGroup("Admin"))) then
            if (accountName) then
                --if (getAccount(accountName))
 
then
                    if
 
(isObjectInACLGroup("user." ..accountName, aclGetGroup("Us")))
 
then
                       
 
aclGroupRemoveObject (aclGetGroup("Us"), "user."..accountName)
                       
 
outputChatBox("Account '"..accountName.."#00ff00' succesfully
 
removed from the Us ACL group", playerSource, 0, 255, 0, true)
                    else
                       
Link to comment

ok, sorry, but this is very unorganized,

you have more than 2 ends missing for either functions or if's.

If you organize it using (notepad++) and press tab for each new if statements then you could fined your solution...

Sorry, but tonight is for you to fix that :/

Link to comment

I used MTA Script Editor & Notepad++ but still i cant find it. im pretty sure it is a really lol error but i cant find it.

here i removed some not needed lines and organized it a bit more..

Btw, MTA script editor didnt found any errors so its pretty rare. (probably becouse im using a version that is about from 1.1)

--[[***************************************** 
*                                           *
*   -|Us|- Teamscript                   *
*-------------------------------------------*
*   teamscript.lua -- server            *
*       Original by Sniper          **      Edited by HyPeX             *
*********************************************]]
 
local resourceRoot = getResourceRootElement(getThisResource())
 
 
--[[*************************************************
*        Part I: tests, resourcestart               *
*****************************************************]]
local testload
local testteam
local testacl
 
local usteam
local doteam
 
--output load message
addEventHandler("onResourceStart", resourceRoot,
function ()
    outputChatBox("SCRIPT: -|Us|- & Donator teamscript by HyPeX successfully loaded!")
    testload = true
end)
 
--create Teams
addEventHandler("onResourceStart", resourceRoot,
function ()
    usteam = createTeam("-|Us|- Members", 2, 134, 183)
    if (getTeamFromName("-|Us|- Members")) then
        testteam = true
        outputChatBox("SCRIPT: -|Us|- Team successfully created!")
    else
        outputChatBox("SCRIPT ERROR: -|Us|- Team could not be created!")
        testteam = false
    end
end)
 
--create Teams
addEventHandler("onResourceStart", resourceRoot,
function ()
    doteam = createTeam("Donators", 100, 255, 100)
    if (getTeamFromName("Donators")) then
        testteam = true
        outputChatBox("SCRIPT: Donator Team successfully created!")
    else
        outputChatBox("SCRIPT ERROR: Donator Team could not be created!")
        testteam = false
    end
end)
 
--build the "Us" group in ACL
addEventHandler("onResourceStart", resourceRoot,
function ()
    if (aclGetGroup("Us") == nil) or (aclGetGroup("Us") == false) then
        outputChatBox("SCRIPT: Creating Us group in ACL...")
        aclCreateGroup("Us")
    else
        outputChatBox("SCRIPT: Group -|Us|- is already added in ACL")
    end
end)
 
--build the "Do" group in ACL
addEventHandler("onResourceStart", resourceRoot,
function ()
    if (aclGetGroup("Do") == nil) or (aclGetGroup("Do") == false) then
        outputChatBox("SCRIPT: Creating Do group in ACL...")
        aclCreateGroup("Do")
    else
        outputChatBox("SCRIPT: Group Donators is already added in ACL")
    end
end)
 
--check if THIS resource is added in ACL else output warning
addEventHandler("onResourceStart", resourceRoot,
function ()
    if not (isObjectInACLGroup("resource." ..getResourceName(getThisResource()), aclGetGroup("Admin"))) then
        outputChatBox("SCRIPT ERROR: Please add this resource (teamscript) as 'resource.' into the ACL Group 'Admin' else this script won't work!")
        outputDebugString("SCRIPT ERROR: Please add this resource (teamscript) as 'resource.' into the ACL Group 'Admin' else this script won't work!", 1, 255, 0, 0)
        testacl = false
    else
        testacl = true
    end
end)
 
--[[*************************************************
*        Part II: manage players                    *
*****************************************************]]
--command for adding a player to Us Group
function addPlayerToUs (playerSource, commandName, accountName)
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin"))) then
            if (accountName) then
                if (getAccount(accountName)) then
                aclGroupAddObject (aclGetGroup("Us"), "user."..accountName)
                outputChatBox("Account '"..accountName.."#00ff00' succesfully added to the Us ACL group", playerSource, 0, 255, 0, true)
if (getAccount(accountName)) then
setPlayerTeam(getAccountPlayer(getAccount(accountName)), usteam)
    end
--else
    --outputChatBox("Account could not be found! Please enter the correct accountname!", playerSource, 255, 0, 0, true)
    --end
else
    outputChatBox ("No account name specified.", playerSource, 255, 0, 0, true)
    outputChatBox ("Syntax: /addus [accountName]", playerSource, 255, 0, 0, true)
    end
else
    outputChatBox ("Sorry but only admins can use this!", playerSource, 255, 0, 0, true)
    end
end
addCommandHandler("addus", addPlayerToUs)
 
--command for adding a player to Do Group
function addPlayerToDo (playerSource, commandName, accountName)
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin"))) then
    if (accountName) then
    --if (getAccount(accountName)) then
    aclGroupAddObject (aclGetGroup("Do"), "user."..accountName)
    outputChatBox("Account '"..accountName.."#00ff00' succesfully added to the Do ACL group", playerSource, 0, 255, 0, true)
    if (getAccount(accountName)) then
    setPlayerTeam(getAccountPlayer(getAccount(accountName)), doteam)
        end
--else
    --outputChatBox("Account could not be found! Please enter the correct accountname!", playerSource, 255, 0, 0, true)
        --end
else
    outputChatBox ("No account name specified.", playerSource, 255, 0, 0, true)
    outputChatBox ("Syntax: /adddo [accountName]", playerSource, 255, 0, 0, true)
        end
else
    outputChatBox ("Sorry but only admins can use this!", playerSource, 255, 0, 0, true)
        end
end
addCommandHandler("adddo", addPlayerToDo)
 
--command for removing a player from the Us Group
function removePlayerFromUs (playerSource, commandName, accountName)
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin"))) then
            if (accountName) then
                --if (getAccount(accountName)) then
                    if (isObjectInACLGroup("user." ..accountName, aclGetGroup("Us"))) then
                        aclGroupRemoveObject (aclGetGroup("Us"), "user."..accountName)
                        outputChatBox("Account '"..accountName.."#00ff00' succesfully removed from the Us ACL group", playerSource, 0, 255, 0, true)
                    else
                        outputChatBox("Account could not be found in ACL to delete!", playerSource, 255, 0, 0, true)
                    end
                --else
                    --outputChatBox("Account could not be found! Please enter the correct accountname!", playerSource, 255, 0, 0, true)
                --end
            else
                outputChatBox ("No account name specified.", playerSource, 255, 0, 0, true)
                outputChatBox ("Syntax: /addus [accountName]", playerSource, 255, 0, 0, true)
            end
    else
        outputChatBox ("Sorry but only admins can use this!", playerSource, 255, 0, 0, true)
    end
end
addCommandHandler("removeus", removePlayerFromUs)
 
--command for adding moderators
function addPlayerToUs (playerSource, commandName, accountName)
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin"))) then
            if (accountName) then
                if (getAccount(accountName)) then
                    aclGroupAddObject (aclGetGroup("Moderator"), "user."..accountName)
                    outputChatBox("Account '"..accountName.."#00ff00' succesfully added to the Moderator group", playerSource, 0, 255, 0, true)
                else
                    outputChatBox("Account could not be found! Please enter the correct accountname!", playerSource, 255, 0, 0, true)
                end
            else
                outputChatBox ("No account name specified.", playerSource, 255, 0, 0, true)
                outputChatBox ("Syntax: /addmod [accountName]", playerSource, 255, 0, 0, true)
            end
    else
        outputChatBox ("Sorry but only admins can use this!", playerSource, 255, 0, 0, true)
    end
end
addCommandHandler("addmod", addPlayerToUs)
 
--command for adding supermoderators
function addPlayerToUs (playerSource, commandName, accountName)
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin"))) then
            if (accountName) then
                if (getAccount(accountName)) then
                    aclGroupAddObject (aclGetGroup("SuperModerator"), "user."..accountName)
                    outputChatBox("Account '"..accountName.."#00ff00' succesfully added to the SuperModerator group", playerSource, 0, 255, 0, true)
                else
                    outputChatBox("Account could not be found! Please enter the correct accountname!", playerSource, 255, 0, 0, true)
                end
            else
                outputChatBox ("No account name specified.", playerSource, 255, 0, 0, true)
                outputChatBox ("Syntax: /addsmod [accountName]", playerSource, 255, 0, 0, true)
            end
    else
        outputChatBox ("Sorry but only admins can use this!", playerSource, 255, 0, 0, true)
    end
end
addCommandHandler("addsmod", addPlayerToUs)
 
--[[*************************************************
*        Part II: manage events if player joins etc.*
*****************************************************]]
--add player to Us team if is in ACL on Login
function addUsPlayerToTeam(oldacc, account, auto)
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Us"))) and (string.find(getPlayerName(source), "-|Us|-"))then
        setPlayerTeam(source, usteam)
        outputChatBox("Welcome back " .. getPlayerName(source) .. "#e76a0c to -|Us|-!",source, 231, 106, 12, true)
        playSoundFrontEnd(source, 1)
    end
end
addEventHandler("onPlayerLogin", getRootElement(), addUsPlayerToTeam)
 
--add player to donator team if is in ACL on Login
function addUsPlayerToTeam(oldacc, account, auto)
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Do"))) then
        setPlayerTeam(source, doteam)
        outputChatBox("Welcome back " .. getPlayerName(source) .. "#e76a0c to Donators!",source, 231, 106, 12, true)
        playSoundFrontEnd(source, 1)
    end
end
addEventHandler("onPlayerLogin", getRootElement(), addUsPlayerToTeam)
 
--check Us player after someone changed his nick
function checkIfPlayerIsUsAfterNickchange(oldnick, nick)
    if (string.find(nick, "-|Us|-")) and not (getPlayerTeam(source) == usteam)  then
        if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Us"))) then
            setPlayerTeam(source,usteam)
            outputChatBox("Welcome back " .. nick .. "#e76a0c to -|Us|-!",source, 231, 106, 12, true)
            playSoundFrontEnd(source, 1)   
        else
            setTimer(checkLoginOrKick, 150000, 1, source)
            outputChatBox("Please login within 15 secs or you'll be kicked!", source, 255, 0, 0, true)
        end
    end
end
addEventHandler("onPlayerChangeNick", getRootElement(), checkIfPlayerIsUsAfterNickchange)
 
function checkUsPlayerOnJoin()
    if (string.find(getPlayerName(source),"-|Us|-")) then
        setTimer(checkLoginOrKick, 60000, 1, source)
        outputChatBox("Please login within 60 secs or you'll be kicked!", source, 255, 0, 0, true)
        --setTimer(outputChatBox, 10000, 1, "Please login now! You have 10 secs left or you'll get kicked!", source, 255, 0, 0, true)
        --changenick(source)
    end
end
addEventHandler("onPlayerJoin", getRootElement(), checkUsPlayerOnJoin)
 
function checkLoginOrKick(player)
    if not (
Edited by Guest
Link to comment

ok, got it:

--[[***************************************** 
*                                           *
*   -|Us|- Teamscript                   *
*-------------------------------------------*
*   teamscript.lua -- server            *
*       Original by Sniper          **      Edited by HyPeX             *
*********************************************]]
 
local resourceRoot = getResourceRootElement(getThisResource())
 
 
--[[*************************************************
*        Part I: tests, resourcestart               *
*****************************************************]]
local testload
local testteam
local testacl
 
local usteam
local doteam
 
--output load message
addEventHandler("onResourceStart", resourceRoot,
function ()
    outputChatBox("SCRIPT: -|Us|- & Donator teamscript by HyPeX successfully loaded!")
    testload = true
end)
 
--create Teams
addEventHandler("onResourceStart", resourceRoot,
function ()
    usteam = createTeam("-|Us|- Members", 2, 134, 183)
    if (getTeamFromName("-|Us|- Members")) then
        testteam = true
        outputChatBox("SCRIPT: -|Us|- Team successfully created!")
    else
        outputChatBox("SCRIPT ERROR: -|Us|- Team could not be created!")
        testteam = false
    end
end)
 
--create Teams
addEventHandler("onResourceStart", resourceRoot,
function ()
    doteam = createTeam("Donators", 100, 255, 100)
    if (getTeamFromName("Donators")) then
        testteam = true
        outputChatBox("SCRIPT: Donator Team successfully created!")
    else
        outputChatBox("SCRIPT ERROR: Donator Team could not be created!")
        testteam = false
    end
end)
 
--build the "Us" group in ACL
addEventHandler("onResourceStart", resourceRoot,
function ()
    if (aclGetGroup("Us") == nil) or (aclGetGroup("Us") == false) then
        outputChatBox("SCRIPT: Creating Us group in ACL...")
        aclCreateGroup("Us")
    else
        outputChatBox("SCRIPT: Group -|Us|- is already added in ACL")
    end
end)
 
--build the "Do" group in ACL
addEventHandler("onResourceStart", resourceRoot,
function ()
    if (aclGetGroup("Do") == nil) or (aclGetGroup("Do") == false) then
        outputChatBox("SCRIPT: Creating Do group in ACL...")
        aclCreateGroup("Do")
    else
        outputChatBox("SCRIPT: Group Donators is already added in ACL")
    end
end)
 
--check if THIS resource is added in ACL else output warning
addEventHandler("onResourceStart", resourceRoot,
function ()
    if not (isObjectInACLGroup("resource." ..getResourceName(getThisResource()), aclGetGroup("Admin"))) then
        outputChatBox("SCRIPT ERROR: Please add this resource (teamscript) as 'resource.' into the ACL Group 'Admin' else this script won't work!")
        outputDebugString("SCRIPT ERROR: Please add this resource (teamscript) as 'resource.' into the ACL Group 'Admin' else this script won't work!", 1, 255, 0, 0)
        testacl = false
    else
        testacl = true
    end
end)
 
--[[*************************************************
*        Part II: manage players                    *
*****************************************************]]
--command for adding a player to Us Group
function addPlayerToUs(playerSource, commandName, accountName)
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin"))) then
        if (accountName) then
            if (getAccount(accountName)) then
                aclGroupAddObject (aclGetGroup("Us"), "user."..accountName)
                outputChatBox("Account '"..accountName.."#00ff00' succesfully added to the Us ACL group", playerSource, 0, 255, 0, true)
                if (getAccount(accountName)) then
                    setPlayerTeam(getAccountPlayer(getAccount(accountName)), usteam)
                end
            --else
                --outputChatBox("Account could not be found! Please enter the correct accountname!", playerSource, 255, 0, 0, true)
            end --forgot this end
        else
            outputChatBox ("No account name specified.", playerSource, 255, 0, 0, true)
            outputChatBox ("Syntax: /addus [accountName]", playerSource, 255, 0, 0, true)
        end
    else
        outputChatBox ("Sorry but only admins can use this!", playerSource, 255, 0, 0, true)
    end
end
addCommandHandler("addus", addPlayerToUs)
 
--command for adding a player to Do Group
function addPlayerToDo (playerSource, commandName, accountName)
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin"))) then
    if (accountName) then
    --if (getAccount(accountName)) then
    aclGroupAddObject (aclGetGroup("Do"), "user."..accountName)
    outputChatBox("Account '"..accountName.."#00ff00' succesfully added to the Do ACL group", playerSource, 0, 255, 0, true)
    if (getAccount(accountName)) then
    setPlayerTeam(getAccountPlayer(getAccount(accountName)), doteam)
        end
--else
    --outputChatBox("Account could not be found! Please enter the correct accountname!", playerSource, 255, 0, 0, true)
        --end
else
    outputChatBox ("No account name specified.", playerSource, 255, 0, 0, true)
    outputChatBox ("Syntax: /adddo [accountName]", playerSource, 255, 0, 0, true)
        end
else
    outputChatBox ("Sorry but only admins can use this!", playerSource, 255, 0, 0, true)
        end
end
addCommandHandler("adddo", addPlayerToDo)
 
--command for removing a player from the Us Group
function removePlayerFromUs (playerSource, commandName, accountName)
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin"))) then
            if (accountName) then
                --if (getAccount(accountName)) then
                    if (isObjectInACLGroup("user." ..accountName, aclGetGroup("Us"))) then
                        aclGroupRemoveObject (aclGetGroup("Us"), "user."..accountName)
                        outputChatBox("Account '"..accountName.."#00ff00' succesfully removed from the Us ACL group", playerSource, 0, 255, 0, true)
                    else
                        outputChatBox("Account could not be found in ACL to delete!", playerSource, 255, 0, 0, true)
                    end
                --else
                    --outputChatBox("Account could not be found! Please enter the correct accountname!", playerSource, 255, 0, 0, true)
                --end
            else
                outputChatBox ("No account name specified.", playerSource, 255, 0, 0, true)
                outputChatBox ("Syntax: /addus [accountName]", playerSource, 255, 0, 0, true)
            end
    else
        outputChatBox ("Sorry but only admins can use this!", playerSource, 255, 0, 0, true)
    end
end
addCommandHandler("removeus", removePlayerFromUs)
 
--command for adding moderators
function addPlayerToUs (playerSource, commandName, accountName)
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin"))) then
            if (accountName) then
                if (getAccount(accountName)) then
                    aclGroupAddObject (aclGetGroup("Moderator"), "user."..accountName)
                    outputChatBox("Account '"..accountName.."#00ff00' succesfully added to the Moderator group", playerSource, 0, 255, 0, true)
                else
                    outputChatBox("Account could not be found! Please enter the correct accountname!", playerSource, 255, 0, 0, true)
                end
            else
                outputChatBox ("No account name specified.", playerSource, 255, 0, 0, true)
                outputChatBox ("Syntax: /addmod [accountName]", playerSource, 255, 0, 0, true)
            end
    else
        outputChatBox ("Sorry but only admins can use this!", playerSource, 255, 0, 0, true)
    end
end
addCommandHandler("addmod", addPlayerToUs)
 
--command for adding supermoderators
function addPlayerToUs (playerSource, commandName, accountName)
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin"))) then
            if (accountName) then
                if (getAccount(accountName)) then
                    aclGroupAddObject (aclGetGroup("SuperModerator"), "user."..accountName)
                    outputChatBox("Account '"..accountName.."#00ff00' succesfully added to the SuperModerator group", playerSource, 0, 255, 0, true)
                else
                    outputChatBox("Account could not be found! Please enter the correct accountname!", playerSource, 255, 0, 0, true)
                end
            else
                outputChatBox ("No account name specified.", playerSource, 255, 0, 0, true)
                outputChatBox ("Syntax: /addsmod [accountName]", playerSource, 255, 0, 0, true)
            end
    else
        outputChatBox ("Sorry but only admins can use this!", playerSource, 255, 0, 0, true)
    end
end
addCommandHandler("addsmod", addPlayerToUs)
 
--[[*************************************************
*        Part II: manage events if player joins etc.*
*****************************************************]]
--add player to Us team if is in ACL on Login
function addUsPlayerToTeam(oldacc, account, auto)
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Us"))) and (string.find(getPlayerName(source), "-|Us|-"))then
        setPlayerTeam(source, usteam)
        outputChatBox("Welcome back " .. getPlayerName(source) .. "#e76a0c to -|Us|-!",source, 231, 106, 12, true)
        playSoundFrontEnd(source, 1)
    end
end
addEventHandler("onPlayerLogin", getRootElement(), addUsPlayerToTeam)
 
--add player to donator team if is in ACL on Login
function addUsPlayerToTeam(oldacc, account, auto)
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Do"))) then
        setPlayerTeam(source, doteam)
        outputChatBox("Welcome back " .. getPlayerName(source) .. "#e76a0c to Donators!",source, 231, 106, 12, true)
        playSoundFrontEnd(source, 1)
    end
end
addEventHandler("onPlayerLogin", getRootElement(), addUsPlayerToTeam)
 
--check Us player after someone changed his nick
function checkIfPlayerIsUsAfterNickchange(oldnick, nick)
    if (string.find(nick, "-|Us|-")) and not (getPlayerTeam(source) == usteam)  then
        if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Us"))) then
            setPlayerTeam(source,usteam)
            outputChatBox("Welcome back " .. nick .. "#e76a0c to -|Us|-!",source, 231, 106, 12, true)
            playSoundFrontEnd(source, 1)  
        else
            setTimer(checkLoginOrKick, 150000, 1, source)
            outputChatBox("Please login within 15 secs or you'll be kicked!", source, 255, 0, 0, true)
        end
    end
end
addEventHandler("onPlayerChangeNick", getRootElement(), checkIfPlayerIsUsAfterNickchange)
 
function checkUsPlayerOnJoin()
    if (string.find(getPlayerName(source),"-|Us|-")) then
        setTimer(checkLoginOrKick, 60000, 1, source)
        outputChatBox("Please login within 60 secs or you'll be kicked!", source, 255, 0, 0, true)
        --setTimer(outputChatBox, 10000, 1, "Please login now! You have 10 secs left or you'll get kicked!", source, 255, 0, 0, true)
        --changenick(source)
    end
end
addEventHandler("onPlayerJoin", getRootElement(), checkUsPlayerOnJoin)
 
function checkLoginOrKick(player)
    if not (
Link to comment

I have checked the script im running atm on my local server and that end is there, but as i said on the edit, it works perfectly, but it doesnt adds a player to Us or Do, and it doesnt adds me to the team on login/join. (if i add it manually)

EDIT: runned the script you posted and it didnt did nothing at all.

Link to comment

Founded it got a extra end at the veeery end. (last one)

But now, im almost like at the start of the topic. if i didnt joined any group, i get the [Donator] on the message. If im in Us Group, i cant Speak or my message isnt shown. Still, now the donator group works. (i can add perfectly a player and works fine.)

Link to comment

ok, got it, try this:

--[[***************************************** 
*                                           *
*   -|Us|- Teamscript                   *
*-------------------------------------------*
*   teamscript.lua -- server            *
*       Original by Sniper          **      Edited by HyPeX             *
*********************************************]]
 
local resourceRoot = getResourceRootElement(getThisResource())
 
 
--[[*************************************************
*        Part I: tests, resourcestart               *
*****************************************************]]
local testload
local testteam
local testacl
 
local usteam
local doteam
 
--output load message
addEventHandler("onResourceStart", resourceRoot,
function ()
    outputChatBox("SCRIPT: -|Us|- & Donator teamscript by HyPeX successfully loaded!")
    testload = true
end)
 
--create Teams
addEventHandler("onResourceStart", resourceRoot,
function ()
    usteam = createTeam("-|Us|- Members", 2, 134, 183)
    if (getTeamFromName("-|Us|- Members")) then
        testteam = true
        outputChatBox("SCRIPT: -|Us|- Team successfully created!")
    else
        outputChatBox("SCRIPT ERROR: -|Us|- Team could not be created!")
        testteam = false
    end
    doteam = createTeam("Donators", 100, 255, 100)
    if (getTeamFromName("Donators")) then
        testteam = true
        outputChatBox("SCRIPT: Donator Team successfully created!")
    else
        outputChatBox("SCRIPT ERROR: Donator Team could not be created!")
        testteam = false
    end
end)
 
--build the "Us" group in ACL
addEventHandler("onResourceStart", resourceRoot,
function ()
    if(not aclGetGroup("Us"))then
        outputChatBox("SCRIPT: Creating Us group in ACL...")
        aclCreateGroup("Us")
    else
        outputChatBox("SCRIPT: Group -|Us|- is already added in ACL")
    end
end)
 
--build the "Do" group in ACL
addEventHandler("onResourceStart", resourceRoot,
function ()
    if (aclGetGroup("Do") == nil) or (aclGetGroup("Do") == false) then
        outputChatBox("SCRIPT: Creating Do group in ACL...")
        aclCreateGroup("Do")
    else
        outputChatBox("SCRIPT: Group Donators is already added in ACL")
    end
end)
 
--check if THIS resource is added in ACL else output warning
addEventHandler("onResourceStart", resourceRoot,function ()
    if not (isObjectInACLGroup("resource." ..getResourceName(getThisResource()), aclGetGroup("Admin"))) then
        outputChatBox("SCRIPT ERROR: Please add this resource (teamscript) as 'resource.' into the ACL Group 'Admin' else this script won't work!")
        outputDebugString("SCRIPT ERROR: Please add this resource (teamscript) as 'resource.' into the ACL Group 'Admin' else this script won't work!", 1, 255, 0, 0)
        testacl = false
    else
        testacl = true
    end
end)
 
--[[*************************************************
*        Part II: manage players                    *
*****************************************************]]
--command for adding a player to Us Group
function addPlayerToUs(playerSource, commandName, accountName)
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin"))) then
        if (accountName) then
            if (getAccount(accountName)) then
                aclGroupAddObject (aclGetGroup("Us"), "user."..accountName)
                outputChatBox("Account '"..accountName.." #00ff00' succesfully added to the Us ACL group", playerSource, 0, 255, 0, true)
                    setPlayerTeam(getAccountPlayer(getAccount(accountName)), usteam)
            else
                outputChatBox("Account could not be found! Please enter the correct accountname!", playerSource, 255, 0, 0, true)
            end --forgot this end
        else
            outputChatBox ("No account name specified.", playerSource, 255, 0, 0, true)
            outputChatBox ("Syntax: /addus [accountName]", playerSource, 255, 0, 0, true)
        end
    else
        outputChatBox ("Sorry but only admins can use this!", playerSource, 255, 0, 0, true)
    end
end
addCommandHandler("addus", addPlayerToUs)
 
--command for adding a player to Do Group
function addPlayerToDo (playerSource, commandName, accountName)
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin"))) then
        if (accountName) then
            if (getAccount(accountName)) then
                aclGroupAddObject (aclGetGroup("Do"), "user."..accountName)
                outputChatBox("Account '"..accountName.."#00ff00' succesfully added to the Do ACL group", playerSource, 0, 255, 0, true)
                setPlayerTeam(getAccountPlayer(getAccount(accountName)), doteam)
            else
                outputChatBox("Account could not be found! Please enter the correct accountname!", playerSource, 255, 0, 0, true)
            end
        else
            outputChatBox ("No account name specified.", playerSource, 255, 0, 0, true)
            outputChatBox ("Syntax: /adddo [accountName]", playerSource, 255, 0, 0, true)
        end
    else
        outputChatBox ("Sorry but only admins can use this!", playerSource, 255, 0, 0, true)
    end
end
addCommandHandler("adddo", addPlayerToDo)
 
--command for removing a player from the Us Group
function removePlayerFromUs (playerSource, commandName, accountName)
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin"))) then
            if (accountName) then
                if (getAccount(accountName)) then
                    if (isObjectInACLGroup("user." ..accountName, aclGetGroup("Us"))) then
                        aclGroupRemoveObject (aclGetGroup("Us"), "user."..accountName)
                        outputChatBox("Account '"..accountName.."#00ff00' succesfully removed from the Us ACL group", playerSource, 0, 255, 0, true)
                    else
                        outputChatBox("Account could not be found in ACL to delete!", playerSource, 255, 0, 0, true)
                    end
                else
                    outputChatBox("Account could not be found! Please enter the correct accountname!", playerSource, 255, 0, 0, true)
                end
            else
                outputChatBox ("No account name specified.", playerSource, 255, 0, 0, true)
                outputChatBox ("Syntax: /addus [accountName]", playerSource, 255, 0, 0, true)
            end
    else
        outputChatBox ("Sorry but only admins can use this!", playerSource, 255, 0, 0, true)
    end
end
addCommandHandler("removeus", removePlayerFromUs)
 
--command for adding moderators
function addPlayerToUs (playerSource, commandName, accountName)
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin"))) then
            if (accountName) then
                if (getAccount(accountName)) then
                    aclGroupAddObject (aclGetGroup("Moderator"), "user."..accountName)
                    outputChatBox("Account '"..accountName.."#00ff00' succesfully added to the Moderator group", playerSource, 0, 255, 0, true)
                else
                    outputChatBox("Account could not be found! Please enter the correct accountname!", playerSource, 255, 0, 0, true)
                end
            else
                outputChatBox ("No account name specified.", playerSource, 255, 0, 0, true)
                outputChatBox ("Syntax: /addmod [accountName]", playerSource, 255, 0, 0, true)
            end
    else
        outputChatBox ("Sorry but only admins can use this!", playerSource, 255, 0, 0, true)
    end
end
addCommandHandler("addmod", addPlayerToUs)
 
--command for adding supermoderators
function addPlayerToUs (playerSource, commandName, accountName)
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin"))) then
            if (accountName) then
                if (getAccount(accountName)) then
                    aclGroupAddObject (aclGetGroup("SuperModerator"), "user."..accountName)
                    outputChatBox("Account '"..accountName.."#00ff00' succesfully added to the SuperModerator group", playerSource, 0, 255, 0, true)
                else
                    outputChatBox("Account could not be found! Please enter the correct accountname!", playerSource, 255, 0, 0, true)
                end
            else
                outputChatBox ("No account name specified.", playerSource, 255, 0, 0, true)
                outputChatBox ("Syntax: /addsmod [accountName]", playerSource, 255, 0, 0, true)
            end
    else
        outputChatBox ("Sorry but only admins can use this!", playerSource, 255, 0, 0, true)
    end
end
addCommandHandler("addsmod", addPlayerToUs)
 
--[[*************************************************
*        Part II: manage events if player joins etc.*
*****************************************************]]
--add player to Us team if is in ACL on Login
function addUsPlayerToTeam(oldacc, account, auto)
    if (isObjectInACLGroup( "user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Us"))) and (string.find(getPlayerName(source), "-|Us|-"))then
        setPlayerTeam(source, usteam)
        outputChatBox("Welcome back " .. getPlayerName(source) .. "#e76a0c to -|Us|-!",source, 231, 106, 12, true)
        playSoundFrontEnd(source, 1)
    end
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Do"))) then
        setPlayerTeam(source, doteam)
        outputChatBox("Welcome back " .. getPlayerName(source) .. "#e76a0c to Donators!",source, 231, 106, 12, true)
        playSoundFrontEnd(source, 1)
    end
end
addEventHandler("onPlayerLogin",root, addUsPlayerToTeam)
 
--check Us player after someone changed his nick
function checkIfPlayerIsUsAfterNickchange(oldnick, nick)
    if (string.find(nick, "-|Us|-")) and not (getPlayerTeam(source) == usteam)  then
        if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Us"))) then
            setPlayerTeam(source,usteam)
            outputChatBox("Welcome back " .. nick .. "#e76a0c to -|Us|-!",source, 231, 106, 12, true)
            playSoundFrontEnd(source, 1)  
        else
            setTimer(checkLoginOrKick, 15000, 1, source)
            outputChatBox("Please login within 15 secs or you'll be kicked!", source, 255, 0, 0, true)
        end
    end
end
addEventHandler("onPlayerChangeNick", getRootElement(), checkIfPlayerIsUsAfterNickchange)
 
function checkUsPlayerOnJoin()
    if (string.find(getPlayerName(source),"-|Us|-")) then
        setTimer(checkLoginOrKick, 60000, 1, source)
        outputChatBox("Please login within 60 secs or you'll be kicked!", source, 255, 0, 0, true)
        setTimer(outputChatBox, 50000, 1, "Please login now! You have 10 secs left or you'll get kicked!", source, 255, 0, 0, true)
        --changenick(source)
    end
end
addEventHandler("onPlayerJoin", getRootElement(), checkUsPlayerOnJoin)
 
function checkLoginOrKick(player)
    if not (getPlayerTeam(player) == usteam) and (string.find(getPlayerName(player),"-|Us-")) then
        kickPlayer(player, "Player with Us tag not logged in")
    end
end
 
--[[*************************************************
*        Part III: Us stuff                        *
*****************************************************]]
-- banned words, chat color
function setPlayerChatColor(message, messageType)
    if (messageType == 0) then
    local thePlayer = getPlayerName(source)
        cancelEvent()
        if (getPlayerTeam(source) == usteam) then
        local team = getPlayerTeam(source)
       
Link to comment

try this:

--[[***************************************** 
*                                           *
*   -|Us|- Teamscript                   *
*-------------------------------------------*
*   teamscript.lua -- server            *
*       Original by Sniper          **      Edited by HyPeX             *
*********************************************]]
 
local resourceRoot = getResourceRootElement(getThisResource())
 
 
--[[*************************************************
*        Part I: tests, resourcestart               *
*****************************************************]]
local testload
local testteam
local testacl
 
local usteam
local doteam
 
--output load message
addEventHandler("onResourceStart", resourceRoot,
function ()
    outputChatBox("SCRIPT: -|Us|- & Donator teamscript by HyPeX successfully loaded!")
    testload = true
end)
 
--create Teams
addEventHandler("onResourceStart", resourceRoot,
function ()
    usteam = createTeam("-|Us|- Members", 2, 134, 183)
    if (getTeamFromName("-|Us|- Members")) then
        testteam = true
        outputChatBox("SCRIPT: -|Us|- Team successfully created!")
    else
        outputChatBox("SCRIPT ERROR: -|Us|- Team could not be created!")
        testteam = false
    end
    doteam = createTeam("Donators", 100, 255, 100)
    if (getTeamFromName("Donators")) then
        testteam = true
        outputChatBox("SCRIPT: Donator Team successfully created!")
    else
        outputChatBox("SCRIPT ERROR: Donator Team could not be created!")
        testteam = false
    end
end)
 
--build the "Us" group in ACL
addEventHandler("onResourceStart", resourceRoot,
function ()
    if(not aclGetGroup("Us"))then
        outputChatBox("SCRIPT: Creating Us group in ACL...")
        aclCreateGroup("Us")
    else
        outputChatBox("SCRIPT: Group -|Us|- is already added in ACL")
    end
end)
 
--build the "Do" group in ACL
addEventHandler("onResourceStart", resourceRoot,
function ()
    if (aclGetGroup("Do") == nil) or (aclGetGroup("Do") == false) then
        outputChatBox("SCRIPT: Creating Do group in ACL...")
        aclCreateGroup("Do")
    else
        outputChatBox("SCRIPT: Group Donators is already added in ACL")
    end
end)
 
--check if THIS resource is added in ACL else output warning
addEventHandler("onResourceStart", resourceRoot,function ()
    if not (isObjectInACLGroup("resource." ..getResourceName(getThisResource()), aclGetGroup("Admin"))) then
        outputChatBox("SCRIPT ERROR: Please add this resource (teamscript) as 'resource.' into the ACL Group 'Admin' else this script won't work!")
        outputDebugString("SCRIPT ERROR: Please add this resource (teamscript) as 'resource.' into the ACL Group 'Admin' else this script won't work!", 1, 255, 0, 0)
        testacl = false
    else
        testacl = true
    end
end)
 
--[[*************************************************
*        Part II: manage players                    *
*****************************************************]]
--command for adding a player to Us Group
function addPlayerToUs(playerSource, commandName, accountName)
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin"))) then
        if (accountName) then
            if (getAccount(accountName)) then
                aclGroupAddObject (aclGetGroup("Us"), "user."..accountName)
                outputChatBox("Account '"..accountName.." #00ff00' succesfully added to the Us ACL group", playerSource, 0, 255, 0, true)
                    setPlayerTeam(getAccountPlayer(getAccount(accountName)), usteam)
            else
                outputChatBox("Account could not be found! Please enter the correct accountname!", playerSource, 255, 0, 0, true)
            end --forgot this end
        else
            outputChatBox ("No account name specified.", playerSource, 255, 0, 0, true)
            outputChatBox ("Syntax: /addus [accountName]", playerSource, 255, 0, 0, true)
        end
    else
        outputChatBox ("Sorry but only admins can use this!", playerSource, 255, 0, 0, true)
    end
end
addCommandHandler("addus", addPlayerToUs)
 
--command for adding a player to Do Group
function addPlayerToDo (playerSource, commandName, accountName)
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin"))) then
        if (accountName) then
            if (getAccount(accountName)) then
                aclGroupAddObject (aclGetGroup("Do"), "user."..accountName)
                outputChatBox("Account '"..accountName.."#00ff00' succesfully added to the Do ACL group", playerSource, 0, 255, 0, true)
                setPlayerTeam(getAccountPlayer(getAccount(accountName)), doteam)
            else
                outputChatBox("Account could not be found! Please enter the correct accountname!", playerSource, 255, 0, 0, true)
            end
        else
            outputChatBox ("No account name specified.", playerSource, 255, 0, 0, true)
            outputChatBox ("Syntax: /adddo [accountName]", playerSource, 255, 0, 0, true)
        end
    else
        outputChatBox ("Sorry but only admins can use this!", playerSource, 255, 0, 0, true)
    end
end
addCommandHandler("adddo", addPlayerToDo)
 
--command for removing a player from the Us Group
function removePlayerFromUs (playerSource, commandName, accountName)
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin"))) then
            if (accountName) then
                if (getAccount(accountName)) then
                    if (isObjectInACLGroup("user." ..accountName, aclGetGroup("Us"))) then
                        aclGroupRemoveObject (aclGetGroup("Us"), "user."..accountName)
                        outputChatBox("Account '"..accountName.."#00ff00' succesfully removed from the Us ACL group", playerSource, 0, 255, 0, true)
                    else
                        outputChatBox("Account could not be found in ACL to delete!", playerSource, 255, 0, 0, true)
                    end
                else
                    outputChatBox("Account could not be found! Please enter the correct accountname!", playerSource, 255, 0, 0, true)
                end
            else
                outputChatBox ("No account name specified.", playerSource, 255, 0, 0, true)
                outputChatBox ("Syntax: /addus [accountName]", playerSource, 255, 0, 0, true)
            end
    else
        outputChatBox ("Sorry but only admins can use this!", playerSource, 255, 0, 0, true)
    end
end
addCommandHandler("removeus", removePlayerFromUs)
 
--command for adding moderators
function addPlayerToUs (playerSource, commandName, accountName)
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin"))) then
            if (accountName) then
                if (getAccount(accountName)) then
                    aclGroupAddObject (aclGetGroup("Moderator"), "user."..accountName)
                    outputChatBox("Account '"..accountName.."#00ff00' succesfully added to the Moderator group", playerSource, 0, 255, 0, true)
                else
                    outputChatBox("Account could not be found! Please enter the correct accountname!", playerSource, 255, 0, 0, true)
                end
            else
                outputChatBox ("No account name specified.", playerSource, 255, 0, 0, true)
                outputChatBox ("Syntax: /addmod [accountName]", playerSource, 255, 0, 0, true)
            end
    else
        outputChatBox ("Sorry but only admins can use this!", playerSource, 255, 0, 0, true)
    end
end
addCommandHandler("addmod", addPlayerToUs)
 
--command for adding supermoderators
function addPlayerToUs (playerSource, commandName, accountName)
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Admin"))) then
            if (accountName) then
                if (getAccount(accountName)) then
                    aclGroupAddObject (aclGetGroup("SuperModerator"), "user."..accountName)
                    outputChatBox("Account '"..accountName.."#00ff00' succesfully added to the SuperModerator group", playerSource, 0, 255, 0, true)
                else
                    outputChatBox("Account could not be found! Please enter the correct accountname!", playerSource, 255, 0, 0, true)
                end
            else
                outputChatBox ("No account name specified.", playerSource, 255, 0, 0, true)
                outputChatBox ("Syntax: /addsmod [accountName]", playerSource, 255, 0, 0, true)
            end
    else
        outputChatBox ("Sorry but only admins can use this!", playerSource, 255, 0, 0, true)
    end
end
addCommandHandler("addsmod", addPlayerToUs)
 
--[[*************************************************
*        Part II: manage events if player joins etc.*
*****************************************************]]
--add player to Us team if is in ACL on Login
function addUsPlayerToTeam(oldacc, account, auto)
    if (isObjectInACLGroup( "user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Us"))) and (string.find(getPlayerName(source), "-|Us|-"))then
        setPlayerTeam(source, usteam)
        outputChatBox("Welcome back " .. getPlayerName(source) .. "#e76a0c to -|Us|-!",source, 231, 106, 12, true)
        playSoundFrontEnd(source, 1)
    end
    if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Do"))) then
        setPlayerTeam(source, doteam)
        outputChatBox("Welcome back " .. getPlayerName(source) .. "#e76a0c to Donators!",source, 231, 106, 12, true)
        playSoundFrontEnd(source, 1)
    end
end
addEventHandler("onPlayerLogin",root, addUsPlayerToTeam)
 
--check Us player after someone changed his nick
function checkIfPlayerIsUsAfterNickchange(oldnick, nick)
    if (string.find(nick, "-|Us|-")) and not (getPlayerTeam(source) == usteam)  then
        if (isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Us"))) then
            setPlayerTeam(source,usteam)
            outputChatBox("Welcome back " .. nick .. "#e76a0c to -|Us|-!",source, 231, 106, 12, true)
            playSoundFrontEnd(source, 1)  
        else
            setTimer(checkLoginOrKick, 15000, 1, source)
            outputChatBox("Please login within 15 secs or you'll be kicked!", source, 255, 0, 0, true)
        end
    end
end
addEventHandler("onPlayerChangeNick", getRootElement(), checkIfPlayerIsUsAfterNickchange)
 
function checkUsPlayerOnJoin()
    if (string.find(getPlayerName(source),"-|Us|-")) then
        setTimer(checkLoginOrKick, 60000, 1, source)
        outputChatBox("Please login within 60 secs or you'll be kicked!", source, 255, 0, 0, true)
        setTimer(outputChatBox, 50000, 1, "Please login now! You have 10 secs left or you'll get kicked!", source, 255, 0, 0, true)
        --changenick(source)
    end
end
addEventHandler("onPlayerJoin", getRootElement(), checkUsPlayerOnJoin)
 
function checkLoginOrKick(player)
    if not (getPlayerTeam(player) == usteam) and (string.find(getPlayerName(player),"-|Us-")) then
        kickPlayer(player, "Player with Us tag not logged in")
    end
end
 
--[[*************************************************
*        Part III: Us stuff                        *
*****************************************************]]
-- banned words, chat color
function setPlayerChatColor(message, messageType)
    if (messageType == 0) then
        local thePlayer = getPlayerName(source)
        cancelEvent()
        if (getPlayerTeam(source) == usteam) then
            local team = getPlayerTeam(source)
           
Link to comment

Now: i cannot talk in either Us or none group, and i cant add me to Do...

seems pretty hard :D

Btw when started, it changed to this(at least started now):

SCRIPT: -|Us|- & Donator teamscript by HyPeX successfully loaded!

SCRIPT: -|Us|- Team successfully created!

SCRIPT: Donator Team successfully created!

SCRIPT: Group -|Us|- is already added in ACL

SCRIPT: Group Donators is already added in ACL

Link to comment

ok, try this,

onPlayerChat Part:

local r,g,b 
function setPlayerChatColor(message, messageType) 
    if (messageType == 0) then 
        local thePlayer = getPlayerName(source) 
        cancelEvent() 
        if (getPlayerTeam(source) == usteam) then 
            if data == (usteam) then 
                r,g,b = 2,134,183 
            end 
            outputChatBox(thePlayer.. '#1569C7[M] : #ffffff' ..tostring(message),getRootElement(),r,g,b,true) 
        elseif (getPlayerTeam(source) == doteam) then 
            if data == (doteam) then 
                r,g,b = 100,255,100 
            end 
            local r,g,b = getTeamColor(doteam) 
            outputChatBox(thePlayer.. '#aaff00[Donator] : #ffffff' ..tostring(message),getRootElement(),r,g,b,true) 
        elseif not(getPlayerTeam(source) == usteam) and not(getPlayerTeam(source) == doteam) then 
            local team = getPlayerTeam(source) 
            if data == (team) then 
                r,g,b = 255,255,255 
            end 
            outputChatBox(thePlayer.. ':   #FFFFFF' ..tostring(message),getRootElement(),r,g,b,true) 
        end 
    end 
end 
addEventHandler( "onPlayerChat", getRootElement(), setPlayerChatColor ) 

Link to comment

No problem, it was stolen from the former SHC clan about 1 year ago. Even though it is very old and poorly scripted I am the author of this script.

I really hate watching kiddies and copycats playing with my (old) scripts and afterwards releasing them as their own work.

Link to comment
No problem, it was stolen from the former SHC clan about 1 year ago. Even though it is very old and poorly scripted I am the author of this script.

I really hate watching kiddies and copycats playing with my (old) scripts and afterwards releasing them as their own work.

Credits are there... i never intended to copy as mine, i only wanted to make it work.

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...