Jump to content

Some troubles with teams


JAY.ANN

Recommended Posts

I can't add a player to team or get a team element/name. What's wrong with my code?

First of all, In "spawnOnLogin()" function we can see that I want to force a player into a "Props" team. But it doesn't work like that.

addEventHandler("onResourceStart", resourceRoot, function()
propTeam = createTeam( "Props", 150, 200, 255 )
seekTeam = createTeam( "Seekers", 255, 0, 0 )
end)

function setTeamBinds( player )
	if isPlayerInTeam( player, "Props" ) then
	toggleControl( player, "fire", false )
	toggleControl( player, "aim_weapon", false )
	toggleControl( player, "next_weapon", false )
	toggleControl( player, "previous_weapon", false )
	toggleControl( player, "enter_exit", false )
	toggleControl( player, "jump", false )
	toggleControl( player, "crouch", false )
	end
end
addEvent( "setTeamBinds", true )
addEventHandler( "setTeamBinds", getRootElement(), setTeamBinds )

function spawnOnLogin()
spawnPlayer( source, 0, 0, 5, 0, math.random( 0, 288 ), 0, 0 )
fadeCamera( source, true )
setCameraTarget( source, source )
setPlayerTeam( source, propTeam )
setTeamBinds( source )
end
addEventHandler( "onPlayerLogin", root, spawnOnLogin )

 

Link to comment
2 minutes ago, Burak5312 said:

Can you show the meta.xml and is there any other script running besides this script? If so, you can try turning them off.

There's only one script on my server.
Here's the meta.xml (I don't know why, but I can't send it as a code):
 

<meta>

<oop>true</oop>

<script src="server.lua" type="server" cache="false"/>
<script src="shared.lua" type="shared" cache="false"/>
<script src="client.lua" type="client" cache="false"/>

</meta>

Link to comment
Just now, Burak5312 said:

In which file are these codes stored client, server, shared? if shared just write them on server side and try to delete the oop line

This code is in the "server.lua". And it doesn't matter if I have OOP turned on - I've already tested that.

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