Jump to content

help with peak script


K4stic

Recommended Posts

i only know i need use onResourceStop and onResourceStart but how don't know so pls help me is a community PEAK Script by coolerchiller i wonna then the resource stop to save the peak of player and then resource start again to load that number of plyers

--Server side

local peakPlayers = getPlayerCount() 
function playerCountUp () 
    if peakPlayers < getPlayerCount() then 
        peakPlayers = peakPlayers + 1 
        outputChatBox ( "New player peak reached, "..peakPlayers.."! Here is some bonus cash.", getRootElement(), 0, 0, 255) 
        local players = getElementsByType ( "player" ) 
        for theKey,thePlayer in ipairs(players) do  
            if peakPlayers < 1000 then 
                givePlayerMoney(thePlayer, 4000) 
            end 
        end 
    end 
end 
addEventHandler ( "onPlayerLogin", getRootElement(), playerCountUp ) 

Link to comment

So this is Ok?

local peakPlayers = getPlayerCount() 
function playerCountUp () 
    if peakPlayers < getPlayerCount() then 
        peakPlayers = peakPlayers + 1 
        outputChatBox ( "New player peak reached, "..peakPlayers.."! Here is some bonus cash.", getRootElement(), 0, 0, 255) 
        local players = getElementsByType ( "player" ) 
        for theKey,thePlayer in ipairs(players) do 
            if peakPlayers < 1000 then 
                givePlayerMoney(thePlayer, 4000) 
            end 
        end 
    end 
end 
addEventHandler ( "onPlayerLogin", getRootElement(), playerCountUp ) 
  
function resourceStartpeak() 
if getResourceFromName ( "peak" ) then 
     getAccountData ( getAccount ( "Console" ), "playerPeak", number ) 
end 
addEventHandler( "onResourceStart", getRootElement(), resourceStartpeak ) 
  
addEventHandler ( "onResourceStop", root, 
function () 
if getResourceFromName ( "peak" ) then 
     setAccountData ( getAccount ( "Console" ), "playerPeak", number ) 
end) 

Link to comment
local peakPlayers = getAccountData ( getAccount ( "Console" ), "playerPeak" ) or getPlayerCount ( ) 
  
function playerCountUp ( ) 
    if ( peakPlayers < getPlayerCount ( ) ) then 
        peakPlayers = ( peakPlayers + 1 ) 
        setAccountData ( getAccount ( "Console" ), "playerPeak", peakPlayers ) 
        outputChatBox ( "New player peak reached, ".. peakPlayers .."! Here is some bonus cash.", getRootElement(), 0, 0, 255 ) 
        for _, thePlayer in ipairs ( getElementsByType ( "player" ) ) do 
            if ( peakPlayers < 1000 ) then 
                givePlayerMoney ( thePlayer, 4000 ) 
            end 
        end 
    end 
end 
addEventHandler ( "onPlayerLogin", getRootElement(), playerCountUp ) 

Try it.

Link to comment

Thx you one ask how make it to then every 1 player join give to all 4k and every 10 players give 10k

i mean like the Peak is 9 all have take per 1 joined player 4k and then joined the 10 to give all 10k

Sorry for my bad english

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