Jump to content

[Help]Lua....Team


JasperRieken

Recommended Posts

Posted

i whas making the script but it doesn't work and can't figure out what i tried debugscript it sais somting like bad addEventHandler but i can't seem to fix it

function skinStaff(player) 
if getElementType(player) == "player" then  
local team = getPlayerTeam(player)  
if team and getTeamName(team) == "Xuju Crew" then 
setElementModel( 217 ) 
end 
end 
end 
addEventHandler("onPlayerTeamJoin",skinStaff) 

Posted

You skipped source element argument in addEventHandler. What's more, element argument in setElementModel is skipped too.

Posted

so like this?

function skinStaff(player) 
if getElementType(player) == "player" then  
local team = getPlayerTeam(player)  
if team and getTeamName(team) == "Xuju Crew" then 
setElementModel(source,217) 
end 
end 
end 
addEventHandler("onTeamJoin",source,skinStaff) 

Posted

this doesn't work

function skinStaff(player) 
if getElementType(player) == "player" then  
local team = getPlayerTeam(player)  
if team and getTeamName(team) == "Xuju Crew" then 
setElementModel(source,217) 
end 
end 
end 
addEventHandler("onPlayerTeamJoin",source,skinStaff) 

Posted

I don't know how exactly onPlayerTeamJoin event is triggered, but I guess second argument addEventHandler must be root. And argument of setElementModel must be player.

Posted

Is onPlayerTeamJoin a custom event? If yes, then you need to add it with addEvent and make sure it's triggered when the player joins the team, otherwise I don't know what you are doing :)

Posted

He probably doesn't know what he's doing. Don't start typing random events, use the WIKI!

MTA has no event for team joins, so you'll have to dig in your code where teams are set and customize it there.

Or if you're lucky onPlayerTeamJoin is triggered by one of your scripts, but then we'll need more details.

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