Jump to content

[HELP] Tag Script


Recommended Posts

This is my scripts and every team puts clan moves to NFS Please help fix.

---------------do not change or touch this---------- 
Names={} 
Tags={} 
Colors={} 
ACL={} 
-------------------------------------------------------------- 
  
---------------------------here put your clans read readme for instructions--------------------------------------- 
  
local names ={"Guest Team","Ultra Pro Skills Staff","|High Class|","NFS Team"} 
local tags  ={"","~UpS~","|HC|","[NFS]"} 
local colors ={"#e6e6e6","#ff6600","#32ffcc","#cc0000"} 
local acls ={"none","none","none","none"} 
-------- load------------ 
  
function loadTeams() 
 for i,name in pairs(names) do 
Names[i]=name 
end 
  
for i,tag in pairs(tags) do 
Tags[i]=tag 
end 
  
for i,color in pairs(colors) do 
Colors[i] = color 
end 
  
  
for i,acl in pairs(acls) do 
ACL[i] = acl 
end 
 end 
  
  
addEventHandler("onResourceStart",getRootElement(),loadTeams) 
  
--------------------------------------------------- 
  
----- move on start------------------ 
  
function moveOnStart() 
for i,player in pairs(getElementsByType("player")) do 
check(player) 
end 
end 
  
addEventHandler("onResourceStart",getRootElement(),moveOnStart) 
------------------------------------------------------------------------- 
  
-----------check---------------------------- 
  
function check (player) 
setPlayerTeam(player,nil) 
 for i,tag in pairs(tags) do 
    if string.find(getPlayerName(player),tag) then 
local account=getPlayerAccount(player) 
   if ACL[i]~="none" and not  isObjectInACLGroup ( "user." ..getAccountName(account) , aclGetGroup ( ACL[i] ) ) then 
return end 
local name = Names[i] 
local color = Colors[i] 
  if  not getTeamFromName(name) then 
createTeam(name,getColorFromString(color)) 
end 
local team = getTeamFromName(name) 
setPlayerTeam(player,team) 
  
end 
   end 
      end 
  
  
-------------------------------- 
  
  
----------remove Empty Team ---------- 
  
function remove() 
 for t,teams in pairs(names) do 
 local team = getTeamFromName(teams) 
  if team then 
     if  countPlayersInTeam ( team )==0 then 
         destroyElement(team) 
end 
   end 
       end 
          end 
  
----------------------------------------------------- 
  
-------NickChange------------- 
  
function nick(old,new) 
setTimer(check,1000,1,source) 
setTimer(remove,1500,1) 
end 
  
addEventHandler("onPlayerChangeNick",getRootElement(),nick) 
--------------------------------------------- 
  
-------Join-------------------------------- 
  
function join() 
setTimer(check,4000,1,source) 
end 
  
addEventHandler("onPlayerJoin",getRootElement(),join) 
------------------------------- 
  
---------Quit--------------------- 
  
function quit(player) 
setTimer(remove,1000,1) 
end 
  
addEventHandler("onPlayerQuit",getRootElement(),quit) 
------------------------------------ 
  
---------Login--------------------- 
  
function login() 
setTimer(check,1000,1,source) 
setTimer(remove,1500,1) 
end 
  
addEventHandler("onPlayerLogin",getRootElement(),login) 
------------------------------------ 
  
---------Logout--------------------- 
  
function logout() 
setTimer(check,1000,1,source) 
setTimer(remove,1500,1) 
end 
  
addEventHandler("onPlayerLogout",getRootElement(),logout) 
------------------------------------ 
  
  
----------blip-------------- 
  
function blip(player) 
  
 local team = getPlayerTeam(player) 
if team then 
 for v,blip in pairs(getAttachedElements(player)) do 
    if getElementType(blip)=="blip" then 
          local r,g,b =getTeamColor(team) 
             setBlipColor(blip,r,g,b,255) 
             setVehicleColor ( blip,r,g,b) 
         end 
              end 
                     end 
 end 
    
  
function timer() 
setTimer(blip,3000,1,source) 
end 
  
addEventHandler("onPlayerSpawn",getRootElement(),timer) 
  
addEvent ( 'onPlayerPickUpRacePickup', true ) 
    function zaa ( id, type, model ) 
        if ( getPlayerTeam ( source ) ) then 
            if ( eventName == 'onPlayerPickUpRacePickup' and id == 'vehiclechange' or id == 'repair' or id == 'nitro' ) then 
                local r, g, b = getTeamColor ( getPlayerTeam ( source ) ) 
                local vehicle = getPedOccupiedVehicle(source) 
                setVehicleColor ( vehicle, r, g, b ); 
            else 
                local r, g, b = getTeamColor ( getPlayerTeam ( source ) ) 
                 local vehicle = getPedOccupiedVehicle(source) 
                setVehicleColor ( vehicle, r, g, b ) 
            end 
        end 
    end 
addEventHandler ( 'onPlayerVehicleEnter', root, zaa ) 
addEventHandler ( 'onPlayerPickUpRacePickup', root, zaa ) 
  

Link to comment

that because you didn't read file called "readme.txt".

The problem is in here:

local tags  ={"","~UpS~","|HC|","[NFS]"} 

as you forgot to read the file, you don't know that in the clan tags you should have %

in this case it should look like this:

local tags  ={"%%","%~UpS%~","%|HC%|","%[NFS%]"} 

NOTE: Im not sure about the "Guest Team" tag, as it might not work and you can easily make your own script for guest teams.

(( This script is in the community ))

Link to comment

I'm trying to say everytime UpS or any other puts tag it automatically brings them in NFS and doesent have NFS tag please fix.

that because you didn't read file called "readme.txt".

The problem is in here:

local tags  ={"","~UpS~","|HC|","[NFS]"} 

as you forgot to read the file, you don't know that in the clan tags you should have %

in this case it should look like this:

local tags  ={"%%","%~UpS%~","%|HC%|","%[NFS%]"} 

NOTE: Im not sure about the "Guest Team" tag, as it might not work and you can easily make your own script for guest teams.

(( This script is in the community ))

can you please put this in the full script because I don't know what you mean sorry.

Link to comment

you only had to replace 1 line, but here it's how it should be in full script:

---------------do not change or touch this---------- 
Names={} 
Tags={} 
Colors={} 
ACL={} 
-------------------------------------------------------------- 
  
---------------------------here put your clans read readme for instructions--------------------------------------- 
  
local names = {"Guest Team","Ultra Pro Skills Staff","|High Class|","NFS Team"} 
local tags  = {"%%","%~UpS%~","%|HC%|","%[NFS%]"} 
local colors = {"#e6e6e6","#ff6600","#32ffcc","#cc0000"} 
local acls = {"none","none","none","none"} 
-------- load------------ 
  
function loadTeams() 
 for i,name in pairs(names) do 
Names[i]=name 
end 
  
for i,tag in pairs(tags) do 
Tags[i]=tag 
end 
  
for i,color in pairs(colors) do 
Colors[i] = color 
end 
  
  
for i,acl in pairs(acls) do 
ACL[i] = acl 
end 
 end 
  
  
addEventHandler("onResourceStart",getRootElement(),loadTeams) 
  
--------------------------------------------------- 
  
----- move on start------------------ 
  
function moveOnStart() 
for i,player in pairs(getElementsByType("player")) do 
check(player) 
end 
end 
  
addEventHandler("onResourceStart",getRootElement(),moveOnStart) 
------------------------------------------------------------------------- 
  
-----------check---------------------------- 
  
function check (player) 
setPlayerTeam(player,nil) 
 for i,tag in pairs(tags) do 
    if string.find(getPlayerName(player),tag) then 
local account=getPlayerAccount(player) 
   if ACL[i]~="none" and not  isObjectInACLGroup ( "user." ..getAccountName(account) , aclGetGroup ( ACL[i] ) ) then 
return end 
local name = Names[i] 
local color = Colors[i] 
  if  not getTeamFromName(name) then 
createTeam(name,getColorFromString(color)) 
end 
local team = getTeamFromName(name) 
setPlayerTeam(player,team) 
  
end 
   end 
      end 
  
  
-------------------------------- 
  
  
----------remove Empty Team ---------- 
  
function remove() 
 for t,teams in pairs(names) do 
 local team = getTeamFromName(teams) 
  if team then 
     if  countPlayersInTeam ( team )==0 then 
         destroyElement(team) 
end 
   end 
       end 
          end 
  
----------------------------------------------------- 
  
-------NickChange------------- 
  
function nick(old,new) 
setTimer(check,1000,1,source) 
setTimer(remove,1500,1) 
end 
  
addEventHandler("onPlayerChangeNick",getRootElement(),nick) 
--------------------------------------------- 
  
-------Join-------------------------------- 
  
function join() 
setTimer(check,4000,1,source) 
end 
  
addEventHandler("onPlayerJoin",getRootElement(),join) 
------------------------------- 
  
---------Quit--------------------- 
  
function quit(player) 
setTimer(remove,1000,1) 
end 
  
addEventHandler("onPlayerQuit",getRootElement(),quit) 
------------------------------------ 
  
---------Login--------------------- 
  
function login() 
setTimer(check,1000,1,source) 
setTimer(remove,1500,1) 
end 
  
addEventHandler("onPlayerLogin",getRootElement(),login) 
------------------------------------ 
  
---------Logout--------------------- 
  
function logout() 
setTimer(check,1000,1,source) 
setTimer(remove,1500,1) 
end 
  
addEventHandler("onPlayerLogout",getRootElement(),logout) 
------------------------------------ 
  
  
----------blip-------------- 
  
function blip(player) 
  
 local team = getPlayerTeam(player) 
if team then 
 for v,blip in pairs(getAttachedElements(player)) do 
    if getElementType(blip)=="blip" then 
          local r,g,b =getTeamColor(team) 
             setBlipColor(blip,r,g,b,255) 
             setVehicleColor ( blip,r,g,b) 
         end 
              end 
                     end 
 end 
    
  
function timer() 
setTimer(blip,3000,1,source) 
end 
  
addEventHandler("onPlayerSpawn",getRootElement(),timer) 
  
addEvent ( 'onPlayerPickUpRacePickup', true ) 
    function zaa ( id, type, model ) 
        if ( getPlayerTeam ( source ) ) then 
            if ( eventName == 'onPlayerPickUpRacePickup' and id == 'vehiclechange' or id == 'repair' or id == 'nitro' ) then 
                local r, g, b = getTeamColor ( getPlayerTeam ( source ) ) 
                local vehicle = getPedOccupiedVehicle(source) 
                setVehicleColor ( vehicle, r, g, b ); 
            else 
                local r, g, b = getTeamColor ( getPlayerTeam ( source ) ) 
                 local vehicle = getPedOccupiedVehicle(source) 
                setVehicleColor ( vehicle, r, g, b ) 
            end 
        end 
    end 
addEventHandler ( 'onPlayerVehicleEnter', root, zaa ) 
addEventHandler ( 'onPlayerPickUpRacePickup', root, zaa ) 
  

If it doesn't work, it might be the problem of "Guest Team", just delete it and the try again.

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