Jump to content

Find the mistake


tim260

Recommended Posts

Posted

Hello people can you find my mistake on the followingg its not showing like your not in this team in the chat

addEvent ( "onPlayerChooseTeam" , true ) 
addEventHandler ( "onPlayerChooseTeam" , root , 
function ( teamName ) 
local team = getTeamFromName ( teamName ) 
if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "getTeamFromName" ) ) then 
setPlayerTeam ( source , team ) 
outputChatBox("You have successfully been moved to "..getTeamName(team).." Team.", resPlayer, root, 0, 255, 0) 
else ) 
outputChatBox ( "Your not in this team") 
end  
end ) 

Posted (edited)

Check if the team is created , there must be a team named : teamName

EDIT : I remade it simple ( BTW , idk if it will work )

  
addEvent ( "onPlayerChooseTeam" , true ) 
addEventHandler ( "onPlayerChooseTeam" , root , 
function teamName () 
local team = getTeamFromName ( "Example 1" ) 
if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Example 1" ) ) then 
setPlayerTeam ( thePlayer , team ) 
outputChatBox("You have successfully been moved to Example 1 Team.", thePlayer, root, 0, 255, 0) 
else 
outputChatBox ( "Your not in this team") 
end  
end) 

Edited by Guest
Posted
Check if the team is created , there must be a team named : teamName

thats already done dont mind that im just asking am i using else and end etcgood

?

Posted

Can you show us how you trigger the "onPlayerChooseTeam" event?

addEvent ( "onPlayerChooseTeam" , true ) 
addEventHandler ( "onPlayerChooseTeam" , root , 
function ( teamName ) 
local team = getTeamFromName ( teamName ) 
local account = getPlayerAccount(source) 
local accountName = getAccountName(account) 
if isObjectInACLGroup ( "user."..tostring(accountName), aclGetGroup ( teamName ) ) then 
    setPlayerTeam ( source, team ) 
    outputChatBox("You have successfully been moved to "..getTeamName(team).." Team.", source, root, 0, 255, 0) 
else 
    outputChatBox ( "Your not in this team",source) 
    end 
end) 

Posted
Can you show us how you trigger the "onPlayerChooseTeam" event?
addEvent ( "onPlayerChooseTeam" , true ) 
addEventHandler ( "onPlayerChooseTeam" , root , 
function ( teamName ) 
local team = getTeamFromName ( teamName ) 
local account = getPlayerAccount(source) 
local accountName = getAccountName(account) 
if isObjectInACLGroup ( "user."..tostring(accountName), aclGetGroup ( "getTeamFromName" ) ) then 
    setPlayerTeam ( source, team ) 
    outputChatBox("You have successfully been moved to "..getTeamName(team).." Team.", source, root, 0, 255, 0) 
else 
    outputChatBox ( "Your not in this team",source) 
    end 
end) 

its from this resource https://community.multitheftauto.com/index.php?p= ... ls&id=2685

Posted
Do you mind explaining what are you trying to achieve?

sorry solid lock the team selection,

The acl group is named like the team so if i want to join pilot team i can only if im in the acl group pilot

Posted

Change the code from "teamspawn.lua" with this:

local teamsTable = { 
    [ "Police" ] = { 1553.0385742188 , -1675.7225341797 , 16.1953125 } , 
    [ "Robber" ] = { 2249.8801269531 , -1908.4437255859 , 13.546875 } , 
    [ "Mechanics" ] = { 1011.7614746094 , -1005.9530639648 , 32.1015625 } , 
    [ "Whores" ] = { 1833.8845214844 , -1682.6907958984 , 13.454662322998 } , 
    [ "Pilot" ] = { 2001.0803222656 , -2366.482910563 , 13.546875 } , 
    [ "Trucker" ] = { -83.053352355957 , -1136.3688964844 , 1.078125 }  
} 
  
addEvent ( "onPlayerChooseTeam" , true ) 
addEventHandler ( "onPlayerChooseTeam" , root , 
function ( teamName ) 
    local team = getTeamFromName ( teamName ) 
    local account = getPlayerAccount(source) 
    local accountName = getAccountName(account) 
    if isObjectInACLGroup ( "user."..tostring(accountName), aclGetGroup ( teamName ) ) then  
        setPlayerTeam ( source, team ) 
        local spawnX, spawnY, spawnZ = unpack ( teamsTable [ teamName ] ) 
        spawnPlayer ( source, spawnX, spawnY, spawnZ ) 
    else 
        outputChatBox ( "Your not in this team",source) 
    end 
end 
) 

Posted (edited)
Change the code from "teamspawn.lua" with this:
local teamsTable = { 
    [ "Police" ] = { 1553.0385742188 , -1675.7225341797 , 16.1953125 } , 
    [ "Robber" ] = { 2249.8801269531 , -1908.4437255859 , 13.546875 } , 
    [ "Mechanics" ] = { 1011.7614746094 , -1005.9530639648 , 32.1015625 } , 
    [ "Whores" ] = { 1833.8845214844 , -1682.6907958984 , 13.454662322998 } , 
    [ "Pilot" ] = { 2001.0803222656 , -2366.482910563 , 13.546875 } , 
    [ "Trucker" ] = { -83.053352355957 , -1136.3688964844 , 1.078125 }  
} 
  
addEvent ( "onPlayerChooseTeam" , true ) 
addEventHandler ( "onPlayerChooseTeam" , root , 
function ( teamName ) 
    local team = getTeamFromName ( teamName ) 
    local account = getPlayerAccount(source) 
    local accountName = getAccountName(account) 
    if isObjectInACLGroup ( "user."..tostring(accountName), aclGetGroup ( teamName ) ) then  
        setPlayerTeam ( source, team ) 
        local spawnX, spawnY, spawnZ = unpack ( teamsTable [ teamName ] ) 
        spawnPlayer ( source, spawnX, spawnY, spawnZ ) 
    else 
        outputChatBox ( "Your not in this team",source) 
    end 
end 
) 

im stil getting the message your moved but im not so i can edit this my own

EDIT : i got it right thank you very much

Edited by Guest
Posted
Because the resource has a different script to output the message (really stupid).

lolz maybe you should contact the designer and tell him hes stupid :D

btw im using your gang sytem people are talking bout a managment panel how do i open it ?

Posted
As far as I remember with the key "U".

hmm doesnt work :D

EDIT: bout the last resource anyway i could let them spawn whit a skin i define ?

Posted
Hello people can you find my mistake on the followingg its not showing like your not in this team in the chat
addEvent ( "onPlayerChooseTeam" , true ) 
addEventHandler ( "onPlayerChooseTeam" , root , 
function ( teamName ) 
local team = getTeamFromName ( teamName ) 
if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "getTeamFromName" ) ) then 
setPlayerTeam ( source , team ) 
outputChatBox("You have successfully been moved to "..getTeamName(team).." Team.", resPlayer, root, 0, 255, 0) 
else ) 
outputChatBox ( "Your not in this team") 
end  
end ) 

The only mistake I can see is "getTeamFromName" should be teamName in 5th line and delete bracket in 8th line.Make sure you are triggering the event correctly

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