zzx Posted April 6, 2014 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!
iPrestege Posted April 6, 2014 Posted April 6, 2014 What do you mean? I meant about the team checking if you didn't then use the following : getPlayerTeam getTeamName
zzx Posted April 6, 2014 Author 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!
iPrestege Posted April 6, 2014 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)
iPrestege Posted April 6, 2014 Posted April 6, 2014 What you mean? Please use /debugscript 3 And tell me if there's bugs or errors .
zzx Posted April 6, 2014 Author 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
iPrestege Posted April 6, 2014 Posted April 6, 2014 Are you sure that the team name is 'Donators' And it's exists?
iPrestege Posted April 6, 2014 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.
zzx Posted April 6, 2014 Author 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.
iPrestege Posted April 6, 2014 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)
iPrestege Posted April 6, 2014 Posted April 6, 2014 That's right because 'playerCount' Isn't defined in your code.
zzx Posted April 6, 2014 Author Posted April 6, 2014 plss man fix me the whole code i wanna it to my server
iPrestege Posted April 6, 2014 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)
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