Jump to content

accessable problem


zzx

Recommended Posts

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

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
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

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
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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...