K4stic Posted March 5, 2013 Share Posted March 5, 2013 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
Castillo Posted March 5, 2013 Share Posted March 5, 2013 You could create an account or use "Console" one, then save the peak as account data. Link to comment
K4stic Posted March 5, 2013 Author Share Posted March 5, 2013 can you give me more example? Link to comment
K4stic Posted March 6, 2013 Author Share Posted March 6, 2013 but i don't know use Console as Account Data Link to comment
Castillo Posted March 6, 2013 Share Posted March 6, 2013 setAccountData ( getAccount ( "Console" ), "playerPeak", number ) Link to comment
K4stic Posted March 8, 2013 Author Share Posted March 8, 2013 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
Castillo Posted March 8, 2013 Share Posted March 8, 2013 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
K4stic Posted March 9, 2013 Author Share Posted March 9, 2013 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
Castillo Posted March 9, 2013 Share Posted March 9, 2013 You want to increase the reward depending on the peak? 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