zzx Posted April 6, 2014 Share Posted April 6, 2014 guys how can i make the accessable to the command is only for a tab team like "donators" for example. local playerVotes = {} local nbVotes = 0 addCommandHandler( "vr", function( player ) if(playerVotes[player] == true) then return outputChatBox("#ff8800[REDO]: #ffffffYou have already voted", source, 255, 0, 0, true) end if not nbVotes then nbVotes = 0 end playerVotes[player] = true nbVotes = nbVotes + 1 if nbVotes >= getPlayerCount() then outputChatBox("", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: #ffffff "..getPlayerName(player).." #ffffffhas voted for redo", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: #ffffffThe current map will be restarted!", root, 255, 0, 0, true) elseif nbVotes == 0 then outputChatBox("", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: "..getPlayerName(player).."#ffffff voted for redo! ["..nbVotes.."/"..playerCount.."]", root, 255, 0, 0, true) outputChatBox("", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: #ffffffThe current map will be restarted by vote!", root, 255, 0, 0, true) g_ForcedNextMap = currentMap outputChatBox("DEBUG: Next map: "..tostring( getMapName(g_ForcedNextMap) ) ) setTimer(function() nbVotes = 0 end, 150*1000, 1) playerVotes = 0 else outputChatBox("", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: "..getPlayerName(player).." #ffffffvoted for redo! ["..nbVotes.."/"..playerCount.."]", root, 255, 0, 0, true) end end) plz help! Link to comment
iPrestege Posted April 6, 2014 Share Posted April 6, 2014 What do you mean? I meant about the team checking if you didn't then use the following : getPlayerTeam getTeamName Link to comment
zzx Posted April 6, 2014 Author Share Posted April 6, 2014 i want someone to make the access to the script is only for a team in tap which we create via admin panel plss example: the team is Donators. [REDO]:You are not a Donator! Please donate to access the command! Link to comment
zzx Posted April 6, 2014 Author Share Posted April 6, 2014 pls write me the code man thanks Link to comment
iPrestege Posted April 6, 2014 Share Posted April 6, 2014 local playerVotes = {} local nbVotes = 0 addCommandHandler( "vr", function( player ) if getPlayerTeam ( player ) and getTeamName ( getPlayerTeam ( player ) ) ~= 'Donators' then return outputChatBox ( '[REDO]:You are not a Donator! Please donate to access the command!',player ) end if(playerVotes[player] == true) then return outputChatBox("#ff8800[REDO]: #ffffffYou have already voted", player, 255, 0, 0, true) end if not nbVotes then nbVotes = 0 end playerVotes[player] = true nbVotes = nbVotes + 1 if nbVotes >= getPlayerCount() then outputChatBox("", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: #ffffff "..getPlayerName(player).." #ffffffhas voted for redo", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: #ffffffThe current map will be restarted!", root, 255, 0, 0, true) elseif nbVotes == 0 then outputChatBox("", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: "..getPlayerName(player).."#ffffff voted for redo! ["..nbVotes.."/"..playerCount.."]", root, 255, 0, 0, true) outputChatBox("", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: #ffffffThe current map will be restarted by vote!", root, 255, 0, 0, true) g_ForcedNextMap = currentMap outputChatBox("DEBUG: Next map: "..tostring( getMapName(g_ForcedNextMap) ) ) setTimer(function() nbVotes = 0 end, 150*1000, 1) playerVotes = 0 else outputChatBox("", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: "..getPlayerName(player).." #ffffffvoted for redo! ["..nbVotes.."/"..playerCount.."]", root, 255, 0, 0, true) end end) Link to comment
iPrestege Posted April 6, 2014 Share Posted April 6, 2014 What you mean? Please use /debugscript 3 And tell me if there's bugs or errors . Link to comment
zzx Posted April 6, 2014 Author Share Posted April 6, 2014 No errors in debug i want only the members of the Donators clan in TAB to vote for redo /vr the regular members cannot /vr until they be members of Donators clan Link to comment
iPrestege Posted April 6, 2014 Share Posted April 6, 2014 Are you sure that the team name is 'Donators' And it's exists? Link to comment
zzx Posted April 6, 2014 Author Share Posted April 6, 2014 yeah you can come to the server as well Link to comment
iPrestege Posted April 6, 2014 Share Posted April 6, 2014 I think i have found the problem you have created the team from the admin panel? If YES Then it's the problem make it with a code in the vote script. Try this : local playerVotes = {} local nbVotes = 0 createTeam ( 'Donators',0,0,0 ) addCommandHandler( "vr", function( player ) if getPlayerTeam ( player ) and getTeamName ( getPlayerTeam ( player ) ) ~= 'Donators' then return outputChatBox ( '[REDO]:You are not a Donator! Please donate to access the command!',player ) end if(playerVotes[player] == true) then return outputChatBox("#ff8800[REDO]: #ffffffYou have already voted", player, 255, 0, 0, true) end if not nbVotes then nbVotes = 0 end playerVotes[player] = true nbVotes = nbVotes + 1 if nbVotes >= getPlayerCount() then outputChatBox("", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: #ffffff "..getPlayerName(player).." #ffffffhas voted for redo", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: #ffffffThe current map will be restarted!", root, 255, 0, 0, true) elseif nbVotes == 0 then outputChatBox("", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: "..getPlayerName(player).."#ffffff voted for redo! ["..nbVotes.."/"..playerCount.."]", root, 255, 0, 0, true) outputChatBox("", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: #ffffffThe current map will be restarted by vote!", root, 255, 0, 0, true) g_ForcedNextMap = currentMap outputChatBox("DEBUG: Next map: "..tostring( getMapName(g_ForcedNextMap) ) ) setTimer(function() nbVotes = 0 end, 150*1000, 1) playerVotes = 0 else outputChatBox("", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: "..getPlayerName(player).." #ffffffvoted for redo! ["..nbVotes.."/"..playerCount.."]", root, 255, 0, 0, true) end end) P.S : Please delete the team that you created from the admin panel then start the script with that code i gave you above. Link to comment
zzx Posted April 6, 2014 Author Share Posted April 6, 2014 the same problem the script creates a clan but i still can vote for redo even if i wasn't in Donators clan. Link to comment
iPrestege Posted April 6, 2014 Share Posted April 6, 2014 local playerVotes = {} local nbVotes = 0 createTeam ( 'Donators',0,0,0 ) addCommandHandler( "vr", function( player ) if getPlayerTeam ( player ) and getPlayerTeam ( player ) ~= getTeamFromName ( 'Donators' ) then return outputChatBox ( '[REDO]:You are not a Donator! Please donate to access the command!',player ) end if(playerVotes[player] == true) then return outputChatBox("#ff8800[REDO]: #ffffffYou have already voted", player, 255, 0, 0, true) end if not nbVotes then nbVotes = 0 end playerVotes[player] = true nbVotes = nbVotes + 1 if nbVotes >= getPlayerCount() then outputChatBox("", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: #ffffff "..getPlayerName(player).." #ffffffhas voted for redo", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: #ffffffThe current map will be restarted!", root, 255, 0, 0, true) elseif nbVotes == 0 then outputChatBox("", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: "..getPlayerName(player).."#ffffff voted for redo! ["..nbVotes.."/"..playerCount.."]", root, 255, 0, 0, true) outputChatBox("", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: #ffffffThe current map will be restarted by vote!", root, 255, 0, 0, true) g_ForcedNextMap = currentMap outputChatBox("DEBUG: Next map: "..tostring( getMapName(g_ForcedNextMap) ) ) setTimer(function() nbVotes = 0 end, 150*1000, 1) playerVotes = 0 else outputChatBox("", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: "..getPlayerName(player).." #ffffffvoted for redo! ["..nbVotes.."/"..playerCount.."]", root, 255, 0, 0, true) end end) Link to comment
iPrestege Posted April 6, 2014 Share Posted April 6, 2014 That's right because 'playerCount' Isn't defined in your code. Link to comment
zzx Posted April 6, 2014 Author Share Posted April 6, 2014 plss man fix me the whole code i wanna it to my server Link to comment
iPrestege Posted April 6, 2014 Share Posted April 6, 2014 local playerVotes = {} local nbVotes = 0 createTeam ( 'Donators',0,0,0 ) addCommandHandler( "vr", function( player ) if getPlayerTeam ( player ) and getPlayerTeam ( player ) ~= getTeamFromName ( 'Donators' ) then return outputChatBox ( '[REDO]:You are not a Donator! Please donate to access the command!',player ) end if(playerVotes[player] == true) then return outputChatBox("#ff8800[REDO]: #ffffffYou have already voted", player, 255, 0, 0, true) end if not nbVotes then nbVotes = 0 end playerVotes[player] = true nbVotes = nbVotes + 1 if nbVotes >= getPlayerCount() then outputChatBox("", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: #ffffff "..getPlayerName(player).." #ffffffhas voted for redo", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: #ffffffThe current map will be restarted!", root, 255, 0, 0, true) elseif nbVotes == 0 then outputChatBox("", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: "..getPlayerName(player).."#ffffff voted for redo! ["..nbVotes.."/"..playerCount.."]", root, 255, 0, 0, true) outputChatBox("", root, 255, 0, 0, true) outputChatBox("#ff8800[REDO]: #ffffffThe current map will be restarted by vote!", root, 255, 0, 0, true) g_ForcedNextMap = currentMap outputChatBox("DEBUG: Next map: "..tostring( getMapName(g_ForcedNextMap) ) ) setTimer(function() nbVotes = 0 end, 150*1000, 1) playerVotes = 0 else outputChatBox("", root, 255, 0, 0, true) playerCount = getPlayerCount ( ) outputChatBox("#ff8800[REDO]: "..getPlayerName(player).." #ffffffvoted for redo! ["..nbVotes.."/"..playerCount.."]", root, 255, 0, 0, true) end end) 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