adithegman Posted April 28, 2013 Posted April 28, 2013 hi all, i made this clan script for my friend's server and it's not working I hope you guys can find the problem and help me note: it is Server-Side clans = { createTeam ( "KekZ|", 10, 200, 0 ) } function clan( source ) name = getPlayerName ( source ) if (string.find ( name, getTeamName ( clans )" )) then setPlayerTeam ( source, clans ) end end addEventHandler ( "onPlayerJoin", getRootElement(), clan)
adithegman Posted April 28, 2013 Author Posted April 28, 2013 i'm trying to make a script so when you connect it automatically puts you in the clan if you have for ex KekZ| in front of your nick
xXMADEXx Posted April 28, 2013 Posted April 28, 2013 Not really sure, because i've never used "string.find," but try this: team = createTeam ( "KekZ|", 10, 200, 0 ) } function clan() name = getPlayerName ( source ) if (string.find ( name, getTeamName(team) ) ) then setPlayerTeam ( source, team ) end end addEventHandler ( "onPlayerJoin", getRootElement(), clan)
adithegman Posted April 28, 2013 Author Posted April 28, 2013 this shall work momentally but i need a table because there are more clans.... but thx for trying
iPrestege Posted April 28, 2013 Posted April 28, 2013 No tested but try this ; Teams = { {"Test [1]",0,255,255}, {"Test [2]",255,255,0} } addEventHandler("onResourceStart",resourceRoot, function ( ) for _,v in next,Teams do createTeam(v[1],v[2],v[3],v[4]) end end ) And you're code should be : addEventHandler ( "onPlayerJoin", getRootElement(), function () local name = getPlayerName ( source ) if ( string.find ( name,"Clan Name") ) then setPlayerTeam ( source, getTeamFromName("Team Name") ) end end )
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