Jump to content

AFK Script


Recommended Posts

I made a script for put player afk in basemode but he don't wark ! :

function goafk(thePlayer)
outputChatBox("** Thank you for using AFK Script by -RoCk-EmaLegend **", thePlayer)
setElementHealth (thePlayer, 0)
setPlayerTeam(thePlayer,Spectator)
outputChatBox("** Your life now is 0: you are in SPECTATOR TEAM **", thePlayer)
end
addCommandHandler ("afk", goafk)

the script must kill the player and move him in spectator team

Link to comment

You need to understand what elements and element tree are in MTA. When you setPlayerTeam, you need player element (which you already have) and team element (which you don't have unless Spectator is an element).

Use getTeamFromName to get team by its name.

setPlayerTeam( thePlayer, getTeamFromName( "Spectator" ) ); -- make sure "Spectator" is correct team name

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