TheIceman1 Posted April 9, 2013 Share Posted April 9, 2013 Why this dont set my team to "Off Duty"?No errors function endshift() if ( getAccountData ( getPlayerAccount(source), "offduty" ) == false ) then local team = getPlayerTeam ( source ) setAccountData ( getPlayerAccount ( source ), "offduty", true ) setAccountData ( getPlayerAccount ( source ), "teamoff", team ) setTimer( function(player) local team = getTeamFromName ( "Off Duty" ) setPlayerTeam ( player, getTeamFromName ( "Off Duty" ) ) local r, g, b = getTeamColor ( team ) setPlayerNametagColor ( player, r, g, b ) end ,1000,1, source) else local team = getAccountData ( getPlayerAccount ( source), "teamoff" ) setPlayerTeam ( source, team ) end end addEvent ( "endshift", true ) addEventHandler( "endshift", root, endshift ) Link to comment
Max+ Posted April 9, 2013 Share Posted April 9, 2013 addEvent('endshit', true) addEventHandler('endshift', root, function ( player ) if (getAccountData( getPlayerAccount( player), 'offduty') == false ) then setAccountData ( getPlayerAccount ( player ), "offduty", true ) local team = getPlayerTeam(getTeamFromName('Off Duty')) setPlayerTeam(player, team) local r, g, b = getTeamColor ( team ) setPlayerNametagColor ( player, r, g, b ) end end ) Link to comment
TheIceman1 Posted April 9, 2013 Author Share Posted April 9, 2013 addEvent(':~', true) addEventHandler('endshift', root, function ( player ) if (getAccountData( getPlayerAccount( player), 'offduty') == false ) then setAccountData ( getPlayerAccount ( player ), "offduty", true ) local team = getPlayerTeam(getTeamFromName('Off Duty')) setPlayerTeam(player, team) local r, g, b = getTeamColor ( team ) setPlayerNametagColor ( player, r, g, b ) end end ) You dont understand what i want. Link to comment
فاّرس Posted April 9, 2013 Share Posted April 9, 2013 what do you mean ? what is the problem ?? Link to comment
TheIceman1 Posted April 9, 2013 Author Share Posted April 9, 2013 i want that when i click button then this should set my team to "Off duty",but this dont set my team to "Off Duty" Link to comment
manve1 Posted April 10, 2013 Share Posted April 10, 2013 addEvent('endshift', true) addEventHandler('endshift', root, function ( player ) if (not getPlayerTeam(getTeamFromName('Off Duty')) then setAccountData ( getPlayerAccount ( player ), "offduty", true ) local team = getTeamFromName('Off Duty') setPlayerTeam(player, team) local r, g, b = getTeamColor ( team ) setPlayerNametagColor ( player, r, g, b ) end end ) Link to comment
فاّرس Posted April 10, 2013 Share Posted April 10, 2013 ok add resource.name in group admin addEvent('endshift', true) addEventHandler('endshift', root, function ( player ) if (not getPlayerTeam(getTeamFromName('Off Duty')) then setAccountData ( getPlayerAccount ( player ), "offduty", true ) local team = getTeamFromName('Off Duty') setPlayerTeam(player, team) local r, g, b = getTeamColor ( team ) setPlayerNametagColor ( player, r, g, b ) end end ) bool setPlayerTeam ( player thePlayer, team theTeam ) Link to comment
manve1 Posted April 10, 2013 Share Posted April 10, 2013 yes, everything is fine? as in my code "player" returns player element and "team" returns the team with a name of "Off Duty" whereas in Max+ code "team" returns players team with a name of "Off Duty", but the player doesn't have a group that occupied him with a name of "Off Duty". Do you get what i mean? Link to comment
TheIceman1 Posted April 10, 2013 Author Share Posted April 10, 2013 addEvent('endshift', true) addEventHandler('endshift', root, function ( player ) if (not getPlayerTeam(getTeamFromName('Off Duty')) then setAccountData ( getPlayerAccount ( player ), "offduty", true ) local team = getTeamFromName('Off Duty') setPlayerTeam(player, team) local r, g, b = getTeamColor ( team ) setPlayerNametagColor ( player, r, g, b ) end end ) Working! 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