JAY.ANN Posted January 31, 2022 Share Posted January 31, 2022 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
βurak Posted January 31, 2022 Share Posted January 31, 2022 I don't see any problem in your code maybe you can check meta.xml make sure the file is on the server side Link to comment
JAY.ANN Posted January 31, 2022 Author Share Posted January 31, 2022 Just now, Burak5312 said: I don't see any problem in your code maybe you can check meta.xml make sure the file is on the server side I've already did that - It's on the server side. I also have OOP turned on. Link to comment
βurak Posted January 31, 2022 Share Posted January 31, 2022 (edited) I tested your code now, it works perfectly no errors creating teams seamlessly and puts player in props team Edited January 31, 2022 by Burak5312 Link to comment
JAY.ANN Posted January 31, 2022 Author Share Posted January 31, 2022 Well, that's kinda strange... What then could be wrong, lol? Link to comment
βurak Posted January 31, 2022 Share Posted January 31, 2022 (edited) Can you show the meta.xml and is there any other script running besides this script? If so, you can try turning them off. Edited January 31, 2022 by Burak5312 Link to comment
JAY.ANN Posted January 31, 2022 Author Share Posted January 31, 2022 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
βurak Posted January 31, 2022 Share Posted January 31, 2022 (edited) 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 Edited January 31, 2022 by Burak5312 Link to comment
JAY.ANN Posted January 31, 2022 Author Share Posted January 31, 2022 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
βurak Posted January 31, 2022 Share Posted January 31, 2022 As I said, the codes are working fine for me, you are doing something wrong, maybe you can try to remove the cache=false part for the server, if it doesn't happen again, I don't know. Link to comment
JAY.ANN Posted January 31, 2022 Author Share Posted January 31, 2022 Just now, Burak5312 said: As I said, the codes are working fine for me, you are doing something wrong, maybe you can try to remove the cache=false part for the server, if it doesn't happen again, I don't know. I hope so Link to comment
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