tim260 Posted September 20, 2011 Posted September 20, 2011 I have an error when im using the gatemaker tried to use some other functions and stuff i have red the wiki but i dont understand the errors it says bad argument @ getTeamName and its on rule 24 see it below local name = getTeamName(getPlayerTeam(hitElement))
BinSlayer1 Posted September 20, 2011 Posted September 20, 2011 hitElement is most likely not a player check that it is a player if getElementType(hitElement) == "player" then
tim260 Posted September 21, 2011 Author Posted September 21, 2011 function checkClass(hitElement, matchingDimension) if ( getElementType(hitElement) == "vehicle" ) then hitElement = getVehicleController(hitElement) end for i=0,#gateList do local name = getTeamName(getPlayerTeam(hitElement)) if(name == false) then name = "false" end if ( name == team[i] or name == "false") then detection = isElementWithinColShape ( hitElement, shapes[i] ) if detection == true then move(i, false) end end end end thats the script but it really says that the getteamname is wrong in the server Bad argument @ `getTeamName`
Castillo Posted September 21, 2011 Posted September 21, 2011 function checkClass(hitElement, matchingDimension) if ( getElementType(hitElement) == "vehicle" ) then hitElement = getVehicleController(hitElement) end for i=0,#gateList do if not getPlayerTeam(hitElement) then return end local name = getTeamName(getPlayerTeam(hitElement)) if(name == false) then name = "false" end if ( name == team[i] or name == "false") then detection = isElementWithinColShape ( hitElement, shapes[i] ) if detection == true then move(i, false) end end end end Try that.
MTA Team qaisjp Posted September 21, 2011 MTA Team Posted September 21, 2011 function checkClass(hitElement, matchingDimension) if ( getElementType(hitElement) == "vehicle" ) then hitElement = getVehicleController(hitElement) end if not isElement(hitElement) then return end for i=0,#gateList do if not getPlayerTeam(hitElement) then return end local name = getTeamName(getPlayerTeam(hitElement)) if(name == false) then name = "false" end if ( name == team[i] or name == "false") then detection = isElementWithinColShape ( hitElement, shapes[i] ) if detection == true then move(i, false) end end end end Try that.
tim260 Posted September 21, 2011 Author Posted September 21, 2011 it works thanks i have another qeustion now, how to make a team only for admins ?
CapY Posted September 21, 2011 Posted September 21, 2011 Try with these functions: setPlayerTeam -- Sets the player team createTeam --Creates a team isObjectInACLGroup --Check is user in Admin group. onPlayerLogin --You must use this event to move a player in a team.
JR10 Posted September 21, 2011 Posted September 21, 2011 setPlayerTeam -- Sets the player team createTeam --Creates a team onPlayerLogin --You must use this to move a player in a team. isObjectInACLGroup --Check is user in Admin group.
TAPL Posted September 21, 2011 Posted September 21, 2011 it works thanks i have another qeustion now, how to make a team only for admins ? viewtopic.php?f=91&t=35746
tim260 Posted September 22, 2011 Author Posted September 22, 2011 Thanks TAPL This is the code ? so i see there is written teamAdmmin with 2 "m" is that correct function createTeamsOnStart () teamAdmmin = createTeam ( "Admin", 0, 255, 0 ) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createTeamsOnStart ) local root = getRootElement() addEventHandler("onPlayerLogin", root if isObjectInACLGroup ( "user." .. playerName, aclGetGroup ( "Admin" ) ) then local theTeam = getPlayerTeam ( source ) if theTeam then setPlayerTeam ( source, Admin ) end end
Discord Moderators Zango Posted September 22, 2011 Discord Moderators Posted September 22, 2011 Really buggy. Look at line 8 and on, does this look correct to you? Also if you define teamAdmmin, but you tell the script to get Admin, how is it supposed to work? function createTeamsOnStart () teamAdmmin = createTeam ( "Admin", 0, 255, 0 ) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createTeamsOnStart ) local root = getRootElement() addEventHandler("onPlayerLogin", root, function (_, account) if isObjectInACLGroup ("user." .. getAccountName(account), aclGetGroup("Admin" )) then setPlayerTeam (source, teamAdmmin) end end )
TAPL Posted September 22, 2011 Posted September 22, 2011 this not needed -,- just remove it local root = getRootElement()
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now