Dette er et populært indlæg Michael K Skrevet Juli 26, 2021 Dette er et populært indlæg Del Skrevet Juli 26, 2021 E2'en udgives som den er, og jeg vil ikke hjælpe med at bruge den eller med at foretage ændringer i den. Spoiler -bank profit {profit} | Sætter procent profit du modtager før opgraderinger udregnes account {navn eller steamid} ["1" for force-indsæt] | Opret en konto for en spiller og valgfrit start force-indsæt. insert {navn, steamid eller "done"} | Start force-indsæt. list | Liste over konti. upgrade {navn eller steamid} {"ap", "cp" eller "ep"} {"0", "1" eller "2"} | Sæt opgradering for konto. "0" er fjern, "1" er tilføj og "2" er tilføj uden at trække procenter. close {navn eller steamid} | Luk konto for spiller. autopayout {"on" eller "off"} | Slå automatisk payout til eller fra. forcelogout | Log den aktive spiller ud a skærmen. pay | Tving udbetaling. F7 | Fjerner printer fra systemet. F8 | Hvis force-indsæt er aktivt, indsæt printer. F9 | Se hvem der har indsat en printer. Hvis du kigger på en printerboks vil det vise det for alle printere i den. F10 | Starter force-indsætning til spilleren du kigger på, og opretter en konto til dem, hvis ikke de har en. @name MukhleBank @inputs [ Register User ]:entity [ Egp ]:wirelink @outputs Door @persist [ O ActiveUser ForceRegister ]:entity @persist [ SteamIDLookup Accounts ]:gtable @persist [ ColW ColO ColG ]:vector @persist [ PayKeys ListKeys AccountKeys Players ]:array @persist [ SavedFrames Upgrades ]:table @persist [ Terms CrashProtectionInfo CrashProtectionOwnedInfo AutoPayoutInfo AutoPayoutOwnedInfo ]:string @persist [ OnScreen OffScreen ]:vector2 @persist [ BaseProfit CrashProtectionProfit AutoPayoutProfit ExtraPayoutProfit ]:number @persist [ CurrentScreen CanAutoPayout DoAutoPayout ForcePayout LoadedFrame GenerateFrameIndex ReadyForUse ]:number @persist [ CurrentPayIndex TargetPayIndex ]:number @persist [ CurrentListIndex TargetListIndex ]:number @persist [ CurrentAccountIndex TargetAccountIndex LastAccountUpdate ]:number @persist [ CurrentLookupIndex TargetLookupIndex LastLookupUpdate LookupFirstPassed ]:number @persist [ LastPrinterWarning ]:number if ( dupefinished() ) { reset() } if ( first() ) { if ( !canReadConvar() ) { error( "Skriv \"wire_expression2_convar 1\" i console, for at E2'en kan virke." ) } if ( !convarnum( "wire_expression2_concmd" ) ){ error( "Skriv \"wire_expression2_concmd 1\" i console, for at E2'en kan virke." ) } O = owner() ActiveUser = noentity() ForceRegister = noentity() SteamIDLookup = gTable( "SteamIDLookup", 2 ) Accounts = gTable( "MukhleBank" ) ColW = vec( 255, 255, 255 ) ColO = vec( 255, 127, 0 ) ColG = vec( 0, 255, 150 ) PayKeys = array() ListKeys = array() AccountKeys = array() Players = array() SavedFrames = table() Upgrades = table( "cp" = table( "Key" = "UpgradeCrashProtection", "Min" = 0, "Max" = 2, "Colors" = table( 0 = vec( 255, 0, 0 ), 1 = vec( 0, 255, 0 ), 2 = vec( 212, 165, 55 ) ) ), "ap" = table( "Key" = "UpgradeAutoPayout", "Min" = 0, "Max" = 2, "Colors" = table( 0 = vec( 255, 0, 0 ), 1 = vec( 0, 255, 0 ), 2 = vec( 212, 165, 55 ) ) ), "ep" = table( "Key" = "UpgradeExtraPayout", "Min" = 0, "Max" = 1, "Colors" = table( 0 = vec( 255, 0, 0 ), 1 = vec( 212, 165, 55 ) ) ) ) Terms = array( format( "1. Inds%sttelse sker p%s eget ansvar.", ae(), aa() ), format( "2. Idet en v%srdigenstand inds%sttes, overgives ejerskabet af den til banken.", ae(), ae() ), format( "3. Indsatte v%srdigenstande optjener f%srst penge, n%sr de n%sr deres h%sjeste ydeevne.", ae(), oe(), aa(), aa(), oe() ), format( "4. V%srdigenstande returneres ikke efter de er sat ind.", ae() ), format( "5. Ingen kompensation vil blive givet, skulle dine v%srdigenstande g%s tabt.", ae(), aa() ), format( "6. Uden tilvalg af crash-beskyttelse vil din konto blive lukket, skulle du forlade serveren, ligemeget orsagen." ), format( "7. Banken ejer de oprettede konti, og vedholder sig retten til at lukke konti i tilf%slde hvor en konto indehaver er til gene for bankejeren.", ae() ) ):concat( "\n\n" ) CrashProtectionInfo = array( format( "Med crash-beskyttelse vil din konto blive holdt %sben i 30 minutter efter du forlader serveren, eller s%s l%snge at der er v%srdigenstande knyttet til den.", aa(), aa(), ae(), ae() ), format( "Det koster 7%% af udbyttet fra dine indsatte v%srdigenstande at have dette aktiveret.", ae() ), format( "Dette kan ikke frav%slges senere.", ae() ) ):concat( "\n\n" ) CrashProtectionOwnedInfo = format( "Med crash-beskyttelse vil din konto blive holdt %sben i 30 minutter efter du forlader serveren, eller s%s l%snge at der er v%srdigenstande knyttet til den.", aa(), aa(), ae(), ae() ) AutoPayoutInfo = array( format( "Med automatisk udbetaling vil du hvert 15. minut automatisk blive tilsendt din del af udbyttet fra dine indsatte v%srdigenstande.", ae() ), format( "Det koster 3%% af udbyttet fra dine indsatte v%srdigenstande at have dette aktiveret.", ae() ), format( "Dette kan ikke frav%slges senere.", ae() ) ):concat( "\n\n" ) AutoPayoutOwnedInfo = format( "Med automatisk udbetaling vil du hvert 15. minut automatisk blive tilsendt din del af udbyttet fra dine indsatte v%srdigenstande.", ae() ) OnScreen = vec2( 0, 0 ) OffScreen = vec2( 512, 0 ) BaseProfit = 20 CrashProtectionProfit = 7 AutoPayoutProfit = 3 ExtraPayoutProfit = 8 CurrentScreen = 0 CanAutoPayout = 0 DoAutoPayout = 1 ForcePayout = 0 LoadedFrame = 0 GenerateFrameIndex = 1 ReadyForUse = 0 CurrentPayIndex = 0 TargetPayIndex = 0 CurrentListIndex = 0 TargetListIndex = 0 CurrentAccountIndex = 0 TargetAccountIndex = 0 LastAccountUpdate = 0 CurrentLookupIndex = 0 TargetLookupIndex = 0 LastLookupUpdate = 0 LookupFirstPassed = 0 LastPrinterWarning = 0 function string comma( Amount:number ) { local Formatted = toString( Amount ) while( 1 ) { local New = Formatted:replaceRE( "^(-?%d+)(%d%d%d)", "%1,%2" ) local Old = Formatted Formatted = New if ( New == Old ) { break } } return Formatted } function number string:isSteamID() { return This:matchFirst( "STEAM_[0-5]:[01]:%d+$" ) ? 1 : 0 } function string returnTime( Time ) { local Date = date( Time ) return format( "%02d:%02d:%02d", Date[ "hour", number ], Date[ "min", number ], Date[ "sec", number ] ) } function number wirelink:egpButton( Idx:number, Ply:entity ){ local Cur = This:egpCursor( Ply ) return This:egpObjectContainsPoint( Idx, Cur ) } function number entity:hasAccount() { local SteamID = This:steamID() return Accounts[ SteamID, table ][ "Registered", number ] } function number string:hasAccount() { return Accounts[ This, table ][ "Registered", number ] } function entity:createAccount() { local SteamID = This:steamID() Accounts[ SteamID, table ] = table( "Printers" = array(), "Created" = time(), "Registered" = 1, "UpgradeCrashProtection" = 0, "UpgradeAutoPayout" = 0, "UpgradeExtraPayout" = This:getGangID() == O:getGangID(), "Payout" = 0, "TotalPayout" = 0 ) } function string:createAccount() { Accounts[ This, table ] = table( "Printers" = array(), "Created" = time(), "Registered" = 1, "UpgradeCrashProtection" = 0, "UpgradeAutoPayout" = 0, "UpgradeExtraPayout" = 0, "Payout" = 0, "TotalPayout" = 0 ) } function table entity:getAccount() { local SteamID = This:steamID() return Accounts[ SteamID, table ] } function table string:getAccount() { return Accounts[ This, table ] } function entity:closeAccount() { local SteamID = This:steamID() local Printers = Accounts[ SteamID, table ][ "Printers", array ] foreach( _, Printer:entity = Printers ) { if ( Printer ) { Printer[ "MukhleBankLastPayout", number ] = 0 Printer[ "MukhleBankAccount", string ] = "" } } Accounts:removeTable( SteamID ) } function string:closeAccount() { local Printers = Accounts[ This, table ][ "Printers", array ] foreach( _, Printer:entity = Printers ) { if ( Printer ) { Printer[ "MukhleBankLastPayout", number ] = 0 Printer[ "MukhleBankAccount", string ] = "" } } Accounts:removeTable( This ) } function createButton( StartIndex, Text:string, Height, Parent ) { Egp:egpBox( StartIndex, vec2( 256, Height ), vec2( 300, 30 ) ) Egp:egpColor( StartIndex, vec( 34, 34, 34 ) ) Egp:egpAlpha( StartIndex, 204 ) Egp:egpParent( StartIndex, Parent ) Egp:egpBoxOutline( StartIndex+1, vec2( 256, Height ), vec2( 300, 30 ) ) Egp:egpSize( StartIndex+1, 2 ) Egp:egpColor( StartIndex+1, ColG ) Egp:egpParent( StartIndex+1, Parent ) Egp:egpText( StartIndex+2, Text, vec2( 256, Height ) ) Egp:egpSize( StartIndex+2, 20 ) Egp:egpColor( StartIndex+2, ColG ) Egp:egpAlign( StartIndex+2, 1, 1 ) Egp:egpParent( StartIndex+2, Parent ) } local Color = vec( 34, 34, 34 )*0.8 Egp:egpClear() #Background Egp:egpBox( 1, vec2( 256, 256 ), vec2( 512, 512 ) ) Egp:egpColor( 1, Color ) Egp:egpPoly( 2, array( vec2( 193, 413 ), vec2( 0, 436 ), vec2( 0, 283 ) ) ) Egp:egpColor( 2, Color*0.9 ) Egp:egpPoly( 3, array( vec2( 96, 207 ), vec2( 192, 0 ), vec2( 0, 0 ) ) ) Egp:egpColor( 3, Color*0.75 ) Egp:egpPoly( 4, array( vec2( 96, 207 ), vec2( 512, 0 ), vec2( 192, 0 ) ) ) Egp:egpColor( 4, Color*0.8 ) Egp:egpPoly( 5, array( vec2( 302, 104 ), vec2( 193, 413 ), vec2( 96, 207 ) ) ) Egp:egpColor( 5, Color*0.9 ) Egp:egpPoly( 6, array( vec2( 400, 512 ), vec2( 302, 104 ), vec2( 193, 413 ) ) ) Egp:egpColor( 6, Color*0.75 ) Egp:egpPoly( 7, array( vec2( 353, 320 ), vec2( 512, 417 ), vec2( 512, 0 ) ) ) Egp:egpColor( 7, Color*0.9 ) Egp:egpPoly( 8, array( vec2( 442, 373 ), vec2( 400, 512 ), vec2( 353, 320 ) ) ) Egp:egpColor( 8, Color*0.8 ) Egp:egpPoly( 9, array( vec2( 442, 373 ), vec2( 512, 512 ), vec2( 512, 417 ) ) ) Egp:egpColor( 9, Color*0.75 ) Egp:egpPoly( 10, array( vec2( 193, 413 ), vec2( 400, 512 ), vec2( 120, 512 ) ) ) Egp:egpColor( 10, Color*0.9 ) Egp:egpPoly( 11, array( vec2( 78, 426 ), vec2( 0, 512 ), vec2( 0, 436 ) ) ) Egp:egpColor( 11, Color*0.75 ) Egp:egpPoly( 12, array( vec2( 78, 426 ), vec2( 120, 512 ), vec2( 0, 512 ) ) ) Egp:egpColor( 12, Color*0.8 ) function showLogin() { if ( LoadedFrame ) { Egp:egpPos( LoadedFrame, vec2( 512, 0 ) ) } Egp:egpPos( 20, OnScreen ) LoadedFrame = SavedFrames[ "login", number ] CurrentScreen = 1 } function bankEgp( User:entity ) { Egp:egpPos( LoadedFrame, vec2( 512, 0 ) ) Egp:egpPos( 40, OnScreen ) local Account = User:getAccount() Egp:egpSetText( 52, format( "H%sv indest%sende - %s kr", ae(), aa(), comma( Account[ "Payout", number ] ) ) ) local Lines = array( format( "Du kan nu inds%stte dine v%srdigenstande.", ae(), ae() ), "Du har indsat:" ) Egp:egpSetText( 53, Lines:concat( "\n" ) ) local Amount = 0 foreach( _, Printer:entity = Account[ "Printers", array ] ) { if ( Printer ) { Amount++ } } Egp:egpSetText( 54, format( "V%srdigenstande x%s", ae(), Amount ) ) local Percentage = 100 - BaseProfit if ( Account[ "UpgradeCrashProtection", number ] == 1 ) { Percentage -= CrashProtectionProfit } if ( Account[ "UpgradeAutoPayout", number ] == 1 ) { Percentage -= AutoPayoutProfit } if ( Account[ "UpgradeExtraPayout", number ] == 1 ) { Percentage += ExtraPayoutProfit } Percentage = clamp( Percentage, 0, 100 ) Egp:egpSetText( 55, format( "Du modtager p%s nuv%srende tidspunkt %s%% af udbyttet fra dine v%srdigenstande", aa(), ae(), Percentage, ae() ) ) LoadedFrame = SavedFrames[ "bank", number ] CurrentScreen = 2 } function createAccount() { Egp:egpPos( LoadedFrame, vec2( 512, 0 ) ) Egp:egpPos( 60, OnScreen ) LoadedFrame = SavedFrames[ "create", number ] CurrentScreen = 3 } function showTerms() { Egp:egpPos( LoadedFrame, vec2( 512, 0 ) ) Egp:egpPos( 80, OnScreen ) LoadedFrame = SavedFrames[ "terms", number ] CurrentScreen = 4 } function showUpgrades() { Egp:egpPos( LoadedFrame, vec2( 1028, 0 ) ) Egp:egpPos( 100, OnScreen ) local Account = ActiveUser:getAccount() if ( Account[ "UpgradeCrashProtection", number ] ) { Egp:egpSetText( 112, "Crash-beskyttet: Ja" ) Egp:egpColor( 112, ColG ) }else { Egp:egpSetText( 112, "Crash-beskyttet: Nej" ) Egp:egpColor( 112, vec( 51, 51, 51 ) ) } if ( Account[ "UpgradeAutoPayout", number ] ) { Egp:egpSetText( 113, "Udbetaling: Automatisk" ) Egp:egpColor( 113, ColG ) }else { Egp:egpSetText( 113, "Udbetaling: Manuel" ) Egp:egpColor( 113, vec( 51, 51, 51 ) ) } LoadedFrame = SavedFrames[ "upgrades", number ] CurrentScreen = 5 } function showCrashprotection() { Egp:egpPos( LoadedFrame, vec2( 1028, 0 ) ) Egp:egpPos( 120, OnScreen ) LoadedFrame = SavedFrames[ "crashProtection", number ] CurrentScreen = 6 } function showCrashprotectionOwned() { Egp:egpPos( LoadedFrame, vec2( 1028, 0 ) ) Egp:egpPos( 140, OnScreen ) LoadedFrame = SavedFrames[ "crashProtectionOwned", number ] CurrentScreen = 7 } function showAutoPayout() { Egp:egpPos( LoadedFrame, vec2( 1028, 0 ) ) Egp:egpPos( 160, OnScreen ) LoadedFrame = SavedFrames[ "autoPayout", number ] CurrentScreen = 8 } function showAutoPayoutOwned() { Egp:egpPos( LoadedFrame, vec2( 1028, 0 ) ) Egp:egpPos( 180, OnScreen ) LoadedFrame = SavedFrames[ "autoPayoutOwned", number ] CurrentScreen = 9 } timer( "generateFrames", 100 ) keyPressedFilter( "f7", "f8", "f9", "f10" ) elevateMoneyGive() }elseif ( ReadyForUse ) { if ( clk( "interval" ) ) { if ( cpuUsage() < 0.000070 ) { if ( LookupFirstPassed ) { if ( TargetPayIndex & TargetPayIndex >= CurrentPayIndex ) { local SteamID = PayKeys[ CurrentPayIndex, string ] local Account = SteamID:getAccount() if ( Account & ( Account[ "UpgradeAutoPayout", number ] | ForcePayout ) ) { local Player = SteamIDLookup[ SteamID, entity ] if ( Player ) { local Payout = Account[ "Payout", number ] if ( Payout ) { moneyGive( Player, Payout ) Account[ "Payout", number ] = 0 Account[ "TotalPayout", number ] = Account[ "TotalPayout", number ] + Payout if ( Player == ActiveUser & CurrentScreen == 2 ) { Egp:egpSetText( 52, format( "H%sv indest%sende - 0 kr", ae(), aa() ) ) } } } } if ( CurrentPayIndex == TargetPayIndex ) { ForcePayout = 0 } CurrentPayIndex++ } if ( TargetListIndex & TargetListIndex >= CurrentListIndex ) { local SteamID = ListKeys[ CurrentListIndex, string ] local Account = SteamID:getAccount() if ( Account ) { local TotalPayout = Account[ "TotalPayout", number ] local Created = Account[ "Created", number ] local Payout = Account[ "Payout", number ] local CrashProtection = Account[ "UpgradeCrashProtection", number ], local AutoPayout = Account[ "UpgradeAutoPayout", number ], local ExtraPayout = Account[ "UpgradeExtraPayout", number ], local Amount = 0 foreach( _, Printer:entity = Account[ "Printers", array ] ) { if ( Printer:isValid() ) { Amount++ } } local Target = SteamIDLookup[ SteamID, entity ] local Name = SteamIDLookup[ SteamID, string ] local Percentage = 100 - BaseProfit local COL_CrashProtection = vec( 255, 0, 0 ) local COL_AutoPayout = vec( 255, 0, 0 ) local COL_ExtraPayout = vec( 255, 0, 0 ) if ( CrashProtection == 1 ) { COL_CrashProtection = vec( 0, 255, 0 ) Percentage -= CrashProtectionProfit }elseif ( CrashProtection == 2 ) { COL_CrashProtection = vec( 212, 165, 55 ) } if ( AutoPayout == 1 ) { COL_AutoPayout = vec( 0, 255, 0 ) Percentage -= AutoPayoutProfit }elseif ( AutoPayout == 2 ) { COL_AutoPayout = vec( 212, 165, 55 ) } if ( ExtraPayout == 1 ) { COL_ExtraPayout = vec( 212, 165, 55 ) Percentage += ExtraPayoutProfit } Percentage = clamp( Percentage, 0, 100 ) if ( Target ) { printColor( ColW, "[ ", ColO, returnTime( Created ), ColW, " ] ", ColO, Name, vec( 0, 200, 0 ), " ONLINE", ColW, " - ", ColO, Amount, ColW, " printere. ", ColO, comma( TotalPayout ), " kr", ColW, " udbetalt. ", ColO, comma( Payout ), " kr", ColW, format( " indest%sende. ", aa() ), Percentage, "%. ", COL_CrashProtection, "cp ", COL_AutoPayout, "ap ", COL_ExtraPayout, "ep" ) }else { if ( Name ) { printColor( ColW, "[ ", ColO, returnTime( Created ), ColW, " ] ", ColO, Name, "( ", SteamID, " )", vec( 200, 161, 255 ), " OFFLINE", ColW, " - ", ColO, Amount, ColW, " printere. ", ColO, comma( TotalPayout ), " kr", ColW, " udbetalt. ", ColO, comma( Payout ), " kr", ColW, format( " indest%sende. ", aa() ), Percentage, "%. ", COL_CrashProtection, "cp ", COL_AutoPayout, "ap ", COL_ExtraPayout, "ep" ) }else { printColor( ColW, "[ ", ColO, returnTime( Created ), ColW, " ] ", ColO, SteamID, vec( 200, 161, 255 ), " OFFLINE", ColW, " - ", ColO, Amount, ColW, " printere. ", ColO, comma( TotalPayout ), " kr", ColW, " udbetalt. ", ColO, comma( Payout ), " kr", ColW, format( " indest%sende. ", aa() ), Percentage, "%. ", COL_CrashProtection, "cp ", COL_AutoPayout, "ap ", COL_ExtraPayout, "ep" ) } } } CurrentListIndex++ } if ( TargetAccountIndex & TargetAccountIndex >= CurrentAccountIndex ) { local SteamID = AccountKeys[ CurrentAccountIndex, string ] local Account = SteamID:getAccount() if ( Account ) { local Name = SteamIDLookup[ SteamID, string ] local Printers = Account[ "Printers", array ] local AccountStillOpen = 1 if ( !SteamIDLookup[ SteamID, entity ] ) { if ( Account[ "UpgradeCrashProtection", number ] ) { local AccountNoPrinters = 1 foreach( _, Printer:entity = Printers ) { if ( Printer ) { AccountNoPrinters = 0 break } } if ( AccountNoPrinters & curtime() > SteamIDLookup[ SteamID, number ] + 1800 ) { printColor( ColW, "Lukkede konto ejet af ", ColO, Name ?: SteamID, ColW, format( ", da de ikke har v%sret online indenfor de sidste 30 minutter, og har ingen indsatte v%srdigenstande.", ae(), ae() ) ) AccountStillOpen = 0 SteamID:closeAccount() } }else { printColor( ColW, "Lukkede konto ejet af ", ColO, Name ?: SteamID, ColW, ", da de ikke er online, og ikke har tilvalgt crash-beskyttelse." ) AccountStillOpen = 0 SteamID:closeAccount() } } if ( AccountStillOpen ) { local Percentage = 100 - BaseProfit if ( Account[ "UpgradeCrashProtection", number ] == 1 ) { Percentage -= CrashProtectionProfit } if ( Account[ "UpgradeAutoPayout", number ] == 1 ) { Percentage -= AutoPayoutProfit } if ( Account[ "UpgradeExtraPayout", number ] == 1 ) { Percentage += ExtraPayoutProfit } Multiplier = clamp( Percentage/100, 0, 100 ) foreach( K, Printer:entity = Printers ) { if ( Printer ) { local WhenPayout = Printer[ "MukhleBankLastPayout", number ] if ( WhenPayout ) { local TimeSincePayout = curtime() - WhenPayout local PrinterPrintInterval = Printer:isBoosted() ? 8 : 10 local PrinterPrintAmount = Printer:hasIncreasedOutput() ? 40 : 32 local PrinterTicks = floor( TimeSincePayout / PrinterPrintInterval ) Account[ "Payout", number ] = Account[ "Payout", number ] + floor( PrinterTicks * PrinterPrintAmount * Multiplier ) Printer[ "MukhleBankLastPayout", number ] = WhenPayout + PrinterTicks * PrinterPrintInterval } if ( curtime() - LastPrinterWarning > 60 & Printer:getColor() == vec( 255, 0, 0 ) ) { concmd( "play ambient/alarms/perimeter_alarm.wav" ) LastPrinterWarning = curtime() } }else { Printers:removeEntity( K ) printColor( ColW, "Fjerenede printer indsat af ", ColO, Name ?: SteamID ) } } if ( ActiveUser == SteamIDLookup[ SteamID, entity ] & CurrentScreen == 2 ) { Egp:egpSetText( 52, format( "H%sv indest%sende - %s kr", ae(), aa(), comma( Account[ "Payout", number ] ) ) ) } } } CurrentAccountIndex++ }else { if ( curtime() - LastAccountUpdate > 10 ) { AccountKeys = Accounts:toTable():keys() TargetAccountIndex = AccountKeys:count() CurrentAccountIndex = 1 LastAccountUpdate = curtime() } } } if ( TargetLookupIndex & TargetLookupIndex >= CurrentLookupIndex ) { local Player = Players[ CurrentLookupIndex, entity ] if ( Player ) { local SteamID = Player:steamID() SteamIDLookup[ SteamID, entity ] = Player SteamIDLookup[ SteamID, string ] = Player:name() SteamIDLookup[ SteamID, number ] = curtime() } if ( TargetLookupIndex == CurrentLookupIndex ) { if ( !LookupFirstPassed ) { printColor( ColO, "Bank klar til brug." ) LookupFirstPassed = 1 } } CurrentLookupIndex++ }else { if ( curtime() - LastLookupUpdate > 10 ) { Players = players() TargetLookupIndex = Players:count() CurrentLookupIndex = 1 LastLookupUpdate = curtime() } } if ( DoAutoPayout ) { local Time = time() local Date = date( Time ) local Minute = Date[ "min", number ] if ( Minute % 15 == 0 ) { if ( CanAutoPayout ) { printColor( ColO, "Starter automatisk udbetaling" ) PayKeys = Accounts:toTable():keys() TargetPayIndex = PayKeys:count() CurrentPayIndex = 1 CanAutoPayout = 0 } }else { CanAutoPayout = 1 } } } }elseif ( clk( "CheckDistance" ) ) { if ( ActiveUser ) { if ( Egp:entity():pos():distance2( ActiveUser:pos() ) > 65536 ) { ActiveUser = noentity() showLogin() } }else{ if ( CurrentScreen > 1 ) { showLogin() } } timer( "CheckDistance", 2000 ) } }elseif ( clk( "generateFrames" ) ) { timer( "generateFrames", 100 ) if ( cpuUsage() < 0.000070 ) { switch( GenerateFrameIndex ) { case 1, Egp:egpBox( 20, vec2( 0, 0 ), vec2( 0, 0 ) ) createButton( 21, "Login", 456, 20 ) Egp:egpText( 24, "Mukhle", vec2( 256, 130 ) ) Egp:egpSize( 24, 100 ) Egp:egpColor( 24, ColG ) Egp:egpAlpha( 24, 204 ) Egp:egpAlign( 24, 1, 1 ) Egp:egpParent( 24, 20 ) Egp:egpText( 25, "Bank", vec2( 256, 232 ) ) Egp:egpSize( 25, 80 ) Egp:egpColor( 25, ColG ) Egp:egpAlpha( 25, 204 ) Egp:egpAlign( 25, 1, 1 ) Egp:egpParent( 25, 20 ) Egp:egpPos( 20, OffScreen ) SavedFrames[ "login", number ] = 20 GenerateFrameIndex++ break case 2, Egp:egpBox( 40, vec2( 0, 0 ), vec2( 0, 0 ) ) createButton( 41, "Log ud", 456, 40 ) createButton( 44, format( "Servicevilk%sr", aa() ), 416, 40 ) createButton( 47, "Opgraderinger", 376, 40 ) createButton( 50, "", 336, 40 ) Egp:egpTextLayout( 53, "", vec2( 0, 51 ), vec2( 512, 48 ) ) Egp:egpSize( 53, 24 ) Egp:egpColor( 53, ColG ) Egp:egpAlpha( 53, 204 ) Egp:egpAlign( 53, 1, 1 ) Egp:egpParent( 53, 40 ) Egp:egpText( 54, "", vec2( 256, 112 ) ) Egp:egpSize( 54, 24 ) Egp:egpColor( 54, ColG ) Egp:egpAlpha( 54, 204 ) Egp:egpAlign( 54, 1, 1 ) Egp:egpParent( 54, 40 ) Egp:egpTextLayout( 55, "", vec2( 56, 175 ), vec2( 400, 90 ) ) Egp:egpSize( 55, 24 ) Egp:egpColor( 55, ColG ) Egp:egpAlpha( 55, 204 ) Egp:egpAlign( 55, 1 ) Egp:egpParent( 55, 40 ) Egp:egpPos( 40, OffScreen ) SavedFrames[ "bank", number ] = 40 GenerateFrameIndex++ break case 3, Egp:egpBox( 60, vec2( 0, 0 ), vec2( 0, 0 ) ) createButton( 61, "Tilbage", 456, 60 ) createButton( 64, "Opret konto", 416, 60 ) Egp:egpTextLayout( 67, Terms, vec2( 56, 20 ), vec2( 400, 400 ) ) Egp:egpSize( 67, 14 ) Egp:egpColor( 67, ColG ) Egp:egpAlpha( 67, 204 ) Egp:egpAlign( 67, 1, 1 ) Egp:egpParent( 67, 60 ) Egp:egpPos( 60, OffScreen ) SavedFrames[ "create", number ] = 60 GenerateFrameIndex++ break case 4, Egp:egpBox( 80, vec2( 0, 0 ), vec2( 0, 0 ) ) createButton( 81, "Tilbage", 456, 80 ) Egp:egpTextLayout( 84, Terms, vec2( 56, 20 ), vec2( 400, 400 ) ) Egp:egpSize( 84, 14 ) Egp:egpColor( 84, ColG ) Egp:egpAlpha( 84, 204 ) Egp:egpAlign( 84, 1, 1 ) Egp:egpParent( 84, 80 ) Egp:egpPos( 80, OffScreen ) SavedFrames[ "terms", number ] = 80 GenerateFrameIndex++ break case 5, Egp:egpBox( 100, vec2( 0, 0 ), vec2( 0, 0 ) ) createButton( 101, "Tilbage", 456, 100 ) createButton( 104, "Automatisk udbetaling", 416, 100 ) createButton( 107, "Crash-beskyttelse", 376, 100 ) Egp:egpSize( 110, 40 ) Egp:egpAlpha( 110, 204 ) Egp:egpAlign( 110, 1 ) Egp:egpParent( 110, 100 ) Egp:egpSize( 111, 40 ) Egp:egpAlpha( 111, 204 ) Egp:egpAlign( 111, 1 ) Egp:egpParent( 111, 100 ) Egp:egpText( 112, "", vec2( 256, 151 ) ) Egp:egpSize( 112, 24 ) Egp:egpAlpha( 112, 204 ) Egp:egpAlign( 112, 1 ) Egp:egpParent( 112, 100 ) Egp:egpText( 113, "", vec2( 256, 196 ) ) Egp:egpSize( 113, 24 ) Egp:egpAlpha( 113, 204 ) Egp:egpAlign( 113, 1 ) Egp:egpParent( 113, 100 ) Egp:egpPos( 100, OffScreen ) SavedFrames[ "upgrades", number ] = 100 GenerateFrameIndex++ break case 6, Egp:egpBox( 120, vec2( 0, 0 ), vec2( 0, 0 ) ) createButton( 121, "Tilbage", 456, 120 ) createButton( 124, "Accepter og aktiver", 416, 120 ) Egp:egpTextLayout( 127, CrashProtectionInfo, vec2( 56, 51 ), vec2( 400, 240 ) ) Egp:egpSize( 127, 24 ) Egp:egpColor( 127, ColG ) Egp:egpAlpha( 127, 204 ) Egp:egpAlign( 127, 1, 1 ) Egp:egpParent( 127, 120 ) Egp:egpPos( 120, OffScreen ) SavedFrames[ "crashProtection", number ] = 120 GenerateFrameIndex++ break case 7, Egp:egpBox( 140, vec2( 0, 0 ), vec2( 0, 0 ) ) createButton( 141, "Tilbage", 456, 140 ) Egp:egpTextLayout( 144, CrashProtectionOwnedInfo, vec2( 56, 51 ), vec2( 400, 240 ) ) Egp:egpSize( 144, 24 ) Egp:egpColor( 144, ColG ) Egp:egpAlpha( 144, 204 ) Egp:egpAlign( 144, 1, 1 ) Egp:egpParent( 144, 140 ) Egp:egpPos( 140, OffScreen ) SavedFrames[ "crashProtectionOwned", number ] = 140 GenerateFrameIndex++ break case 8, Egp:egpBox( 160, vec2( 0, 0 ), vec2( 0, 0 ) ) createButton( 161, "Tilbage", 456, 160 ) createButton( 164, "Accepter og aktiver", 416, 160 ) Egp:egpTextLayout( 167, AutoPayoutInfo, vec2( 56, 51 ), vec2( 400, 240 ) ) Egp:egpSize( 167, 24 ) Egp:egpColor( 167, ColG ) Egp:egpAlpha( 167, 204 ) Egp:egpAlign( 167, 1, 1 ) Egp:egpParent( 167, 160 ) Egp:egpPos( 160, OffScreen ) SavedFrames[ "autoPayout", number ] = 160 GenerateFrameIndex++ break case 9, Egp:egpBox( 180, vec2( 0, 0 ), vec2( 0, 0 ) ) createButton( 181, "Tilbage", 456, 180 ) Egp:egpTextLayout( 184, AutoPayoutOwnedInfo, vec2( 56, 51 ), vec2( 400, 240 ) ) Egp:egpSize( 184, 24 ) Egp:egpColor( 184, ColG ) Egp:egpAlpha( 184, 204 ) Egp:egpAlign( 184, 1, 1 ) Egp:egpParent( 184, 180 ) Egp:egpPos( 180, OffScreen ) SavedFrames[ "autoPayoutOwned", number ] = 180 GenerateFrameIndex++ break case 10, stoptimer( "generateFrames" ) ReadyForUse = 1 timer( "CheckDistance", 2000 ) showLogin() } } } event keyPressed( _:entity, Key:string, Down:number, _:string ) { if ( Down == 0 ) { exit() } if ( Key == "f7" ) { local Entity = O:aimEntity() if ( Entity:isPrinter() ) { local SteamID = Entity[ "MukhleBankAccount", string ] local Account = SteamID:getAccount() if ( Account ) { local Printers = Account[ "Printers", array ] local Index = 0 foreach( K, Printer:entity = Printers ) { if ( Printer == Entity ) { Index = K break } } if ( Index ) { local Name = SteamIDLookup[ SteamID, string ] Entity[ "MukhleBankLastPayout", number ] = 0 Entity[ "MukhleBankAccount", string ] = "" Printers:removeEntity( Index ) printColor( ColW, "Fjerenede printer indsat af ", ColO, Name ?: SteamID ) }else { printColor( ColO, "Printer ikke fundet." ) } }else { printColor( ColO, "Printer ikke indsat." ) } } }elseif ( Key == "f8" ) { local Entity = O:aimEntity() if ( Entity:isPrinter() ) { if ( ForceRegister ) { local Account = ForceRegister:getAccount() local SteamID = ForceRegister:steamID() if ( Account & Entity[ "MukhleBankAccount", string ] == "" ) { local Printers = Account[ "Printers", array ] Printers:pushEntity( Entity ) if ( ForceRegister == ActiveUser & CurrentScreen == 2 ) { local Amount = 0 foreach( _, Printer:entity = Printers ) { if ( Printer ) { Amount++ } } Egp:egpSetText( 54, format( "V%srdigenstande x%s", ae(), Amount ) ) } printColor( ColW, format( "Indsatte v%srdigenstand til ", ae() ), ColO, ForceRegister:name() ) concmd( "play buttons/button3.wav" ) Entity[ "MukhleBankLastPayout", number ] = curtime() Entity[ "MukhleBankAccount", string ] = SteamID } } } }elseif ( Key == "f9" ) { local Entity = O:aimEntity() local SteamID = Entity[ "MukhleBankAccount", string ] if ( SteamID ) { local Level = Entity[ "MukhleBankLevel", number ] local Name = SteamIDLookup[ SteamID, string ] print( _HUD_PRINTCENTER, format( "%s - level %s", Name ?: SteamID, Level ) ) }elseif ( Entity:type():find( "cabr_printerbox" ) ) { local Message = array() foreach( _, Entity:entity = Entity:children() ) { local SteamID = Entity[ "MukhleBankAccount", string ] if ( SteamID ) { local Level = Entity[ "MukhleBankLevel", number ] local Name = SteamIDLookup[ SteamID, string ] Message:pushString( format( "%s - level %s", Name ?: SteamID, Level ) ) }else{ Message:pushString( "ikke registreret" ) } } print( _HUD_PRINTCENTER, Message:concat( "\n" ) ) } }elseif ( Key == "f10" ) { local Player = O:aimEntity() if ( Player:isPlayer() ) { local Name = Player:name() if ( !Player:hasAccount() ) { Player:createAccount() printColor( ColW, "Opretter konto for ", ColO, Name ) } printColor( ColW, format( "Force-inds%st ", ae() ), ColO, Name ) ForceRegister = Player }else { printColor( ColW, format( "Force-inds%st ", ae() ), ColO, "afsluttet" ) ForceRegister = noentity() } } } event input( Input:string ) { if ( Input == "Register" ) { if ( Register & ActiveUser ) { local Account = ActiveUser:getAccount() local SteamID = ActiveUser:steamID() if ( Account ) { if ( Register:isPrinter() & Register[ "MukhleBankAccount", string ] == "" ) { local Printers = Account[ "Printers", array ] local Amount = 0 Printers:pushEntity( Register ) foreach( _, Printer:entity = Printers ) { if ( Printer ) { Amount++ } } Egp:egpSetText( 54, format( "V%srdigenstande x%s", ae(), Amount ) ) printColor( ColO, ActiveUser:name(), ColW, format( " har indsat en v%srdigenstand", ae() ) ) concmd( "play buttons/button3.wav" ) Register[ "MukhleBankLastPayout", number ] = curtime() Register[ "MukhleBankAccount", string ] = SteamID } } } }elseif ( Input == "User" ) { if ( User & cpuUsage() < 0.000070 ) { if ( CurrentScreen == 1 ) { if ( Egp:egpButton( 21, User ) ) { if ( User:hasAccount() ) { bankEgp( User ) }else { createAccount() } ActiveUser = User } }elseif ( CurrentScreen == 2 ) { if ( User == ActiveUser ) { if ( Egp:egpButton( 41, User ) ) { ActiveUser = noentity() showLogin() }elseif ( Egp:egpButton( 44, User ) ) { showTerms() }elseif ( Egp:egpButton( 47, User ) ) { showUpgrades() }elseif ( Egp:egpButton( 50, User ) ) { local Account = User:getAccount() if ( Account ) { local Payout = Account[ "Payout", number ] if ( Payout ) { moneyGive( User, Payout ) Account[ "Payout", number ] = 0 Account[ "TotalPayout", number ] = Account[ "TotalPayout", number ] + Payout Egp:egpSetText( 52, format( "H%sv indest%sende - 0 kr", ae(), aa() ) ) } } } } }elseif ( CurrentScreen == 3 ) { if ( User == ActiveUser ) { if ( Egp:egpButton( 61, User ) ) { ActiveUser = noentity() showLogin() }elseif ( Egp:egpButton( 64, User ) ) { User:createAccount() bankEgp( User ) } } }elseif ( CurrentScreen == 4 ) { if ( User == ActiveUser ) { if ( Egp:egpButton( 81, User ) ) { bankEgp( User ) } } }elseif ( CurrentScreen == 5 ) { if ( User == ActiveUser ) { if ( Egp:egpButton( 101, User ) ) { bankEgp( User ) }elseif ( Egp:egpButton( 104, User ) ) { local Account = User:getAccount() if ( Account[ "UpgradeAutoPayout", number ] ) { showAutoPayoutOwned() }else { showAutoPayout() } }elseif ( Egp:egpButton( 107, User ) ) { local Account = User:getAccount() if ( Account[ "UpgradeCrashProtection", number ] ) { showCrashprotectionOwned() }else { showCrashprotection() } } } }elseif ( CurrentScreen == 6 ) { if ( User == ActiveUser ) { if ( Egp:egpButton( 121, User ) ) { showUpgrades() }elseif ( Egp:egpButton( 124, User ) ) { local Account = User:getAccount() Account[ "UpgradeCrashProtection", number ] = 1 showUpgrades() } } }elseif ( CurrentScreen == 7 ) { if ( User == ActiveUser ) { if ( Egp:egpButton( 141, User ) ) { showUpgrades() } } }elseif ( CurrentScreen == 8 ) { if ( User == ActiveUser ) { if ( Egp:egpButton( 161, User ) ) { showUpgrades() }elseif ( Egp:egpButton( 164, User ) ) { local Account = User:getAccount() Account[ "UpgradeAutoPayout", number ] = 1 showUpgrades() } } }elseif ( CurrentScreen == 9 ) { if ( User == ActiveUser ) { if ( Egp:egpButton( 181, User ) ) { showUpgrades() } } } } }elseif ( Input == "Egp" ) { if ( ->Egp ) { reset() } } } event chat(Player:entity, Message:string, _:number) { if ( Player != O ) { exit() } local Args = Message:explode( " " ) if ( Args[ 1, string ] == "-bank" ) { if ( Args[ 2, string ] == "profit" ) { local Profit = Args[ 3, string ]:toNumber() if ( Profit ) { if ( inrange( Profit, 0, 100 ) ) { BaseProfit = Profit printColor( ColW, "Profit sat til ", ColO, format( "%s%%", Profit ) ) }else { printColor( ColO, format( "Profit skal v%sre imellem 0 og 100.", ae() ) ) } }else { printColor( ColO, format( "Profit skal v%sre et tal.", ae() ) ) } }elseif ( Args[ 2, string ] == "pay" ) { PayKeys = Accounts:toTable():keys() TargetPayIndex = PayKeys:count() CurrentPayIndex = 1 ForcePayout = 1 }elseif ( Args[ 2, string ] == "list" ) { ListKeys = Accounts:toTable():keys() TargetListIndex = ListKeys:count() CurrentListIndex = 1 }elseif ( Args[ 2, string ] == "account" ) { local Find = Args[ 3, string ] if ( Find:isSteamID() ) { local Name = SteamIDLookup[ Find, string ] if ( !Find:hasAccount() ) { Find:createAccount() printColor( ColW, "Opretter konto for ", ColO, Name ) if ( Args[ 4, string ]:toNumber() == 1 ) { local Player = SteamIDLookup[ Find, entity ] if ( Player ) { printColor( ColW, format( "Force-inds%st ", ae() ), ColO, Name ?: Find ) ForceRegister = Player }else { printColor( ColO, Name ?: Find, ColW, " ikke online." ) } } }else { printColor( ColO, Name, ColW, " har allerede en konto." ) } }else { local Player = findPlayerByName( Find ) if ( Player ) { local Name = Player:name() if ( !Player:hasAccount() ) { Player:createAccount() printColor( ColW, "Opretter konto for ", ColO, Name ) if ( Args[ 4, string ]:toNumber() == 1 ) { printColor( ColW, format( "Force-inds%st ", ae() ), ColO, Name ) ForceRegister = Player } }else { printColor( ColO, Name, ColW, " har allerede en konto." ) } }else { printColor( ColW, "Spiller \"", ColO, Find, ColW, "\" ikke fundet." ) } } }elseif ( Args[ 2, string ] == "close" ) { local Find = Args[ 3, string ] if ( Find:isSteamID() ) { local Name = SteamIDLookup[ Find, string ] if ( Find:hasAccount() ) { Find:closeAccount() printColor( ColW, "Lukkede konto ejet af ", ColO, Name ?: Find ) }else { printColor( ColO, Name ?: Find, ColW, " har ikke en konto." ) } }else { local Player = findPlayerByName( Find ) if ( Player ) { local Name = Player:name() if ( Player:hasAccount() ) { Player:closeAccount() printColor( ColW, "Lukkede konto ejet af ", ColO, Name ) }else { printColor( ColO, Name, ColW, " har ikke en konto." ) } }else { printColor( ColW, "Spiller \"", ColO, Find, ColW, "\" ikke fundet." ) } } }elseif ( Args[ 2, string ] == "insert" ) { if ( Args[ 3, string ] == "done" ) { printColor( ColW, format( "Force-inds%st ", ae() ), ColO, "afsluttet" ) ForceRegister = noentity() }else { local Find = Args[ 3, string ] if ( Find:isSteamID() ) { local Player = SteamIDLookup[ Find, entity ] local Name = SteamIDLookup[ Find, string ] if ( Player ) { printColor( ColW, format( "Force-inds%st ", ae() ), ColO, Name ?: Find ) ForceRegister = Player }else { printColor( ColO, Name ?: Find, ColW, " ikke online." ) } }else { local Player = findPlayerByName( Find ) if ( Player ) { local Name = Player:name() printColor( ColW, format( "Force-inds%st ", ae() ), ColO, Name ) ForceRegister = Player }else { printColor( ColW, "Spiller \"", ColO, Find, ColW, "\" ikke fundet." ) } } } }elseif ( Args[ 2, string ] == "autopay" ) { if ( Args[ 3, string ] == "on" ) { printColor( ColW, "Automatisk udbetaling ", ColO, "aktiveret." ) DoAutoPayout = 1 }elseif ( Args[ 3, string ] == "off" ) { printColor( ColW, "Automatisk udbetaling ", ColO, "deaktiveret." ) DoAutoPayout = 0 } }elseif ( Args[ 2, string ] == "forcelogout" ) { ActiveUser = noentity() showLogin() }elseif ( Args[ 2, string ] == "upgrade" ) { local Find = Args[ 3, string ] local Upgrade = Args[ 4, string ] local State = Args[ 5, string ]:toNumber() local Data = Upgrades[ Upgrade, table ] if ( Data ) { if ( State % 1 == 0 & inrange( State, Data[ "Min", number ], Data[ "Max", number ] ) ) { if ( Find:isSteamID() ) { local Name = SteamIDLookup[ Find, string ] local Account = Find:getAccount() if ( Account ) { Account[ Data[ "Key", string ], number ] = State printColor( ColW, "Opgradering ", ColO, Upgrade, ColW, " sat til ", Data[ "Colors", table ][ State, vector ], State, ColW, " for konto ejet af ", ColO, Name ) }else { printColor( ColO, Name ?: Find, ColW, " har ikke en konto." ) } }else { local Player = findPlayerByName( Find ) if ( Player ) { local Name = Player:name() local Account = Player:getAccount() if ( Account ) { Account[ Data[ "Key", string ], number ] = State printColor( ColW, "Opgradering ", ColO, Upgrade, ColW, " sat til ", Data[ "Colors", table ][ State, vector ], State, ColW, " for konto ejet af ", ColO, Name ) }else { printColor( ColO, Name ?: Find, ColW, " har ikke en konto." ) } }else { printColor( ColW, "Spiller \"", ColO, Find, ColW, "\" ikke fundet." ) } } }else { printColor( ColW, format( "State skal v%sre et heltal mellem ", ae() ), ColO, Data[ "Min", number ], ColW, " og ", ColO, Data[ "Max", number ] ) } }else{ printColor( ColW, "Opgradering \"", ColO, Upgrade, ColW, "\" findes ikke." ) } } hideChat( 1 ) } } Door = !ActiveUser:isValid() interval( 1100 ) 5 1 4 Link til kommentar
West Besvaret Juli 27, 2021 Del Besvaret Juli 27, 2021 2 timer siden, Michael K skrev: @persist [O ActiveUser ForceRegister]:entity @persist [SteamIDLookup Accounts]:gtable @persist [ColW ColO ColG]:vector @persist [PayKeys ListKeys AccountKeys Players]:array @persist [SavedFrames]:table @persist [Terms CrashProtectionInfo CrashProtectionOwnedInfo AutoPayoutInfo AutoPayoutOwnedInfo]:string @persist [OnScreen OffScreen]:vector2 @persist BaseProfit CurrentScreen CanAutoPayout DoAutoPayout ForcePayout LoadedFrame GenerateFrameIndex ReadyForUse @persist CurrentPayIndex TargetPayIndex @persist CurrentListIndex TargetListIndex @persist CurrentAccountIndex TargetAccountIndex LastAccountUpdate @persist CurrentLookupIndex TargetLookupIndex LastLookupUpdate LookupFirstPassed Du er helt klart meget skarpere end mig til e2, no doubt in my mind. Men hvad er grunden til du ikke har puttet nogle af variablerne ^ ind i et table, if I may ask. E2en virker ellers rigtig god at bruge, især fordi man hurtigt kommer frem og tilbage fra side til side. Link til kommentar
Aske Besvaret Juli 27, 2021 Del Besvaret Juli 27, 2021 9 timer siden, Bims skrev: Du er helt klart meget skarpere end mig til e2, no doubt in my mind. Men hvad er grunden til du ikke har puttet nogle af variablerne ^ ind i et table, if I may ask. E2en virker ellers rigtig god at bruge, især fordi man hurtigt kommer frem og tilbage fra side til side. Table lookup er vist dyrere for cost end at tjekke et variable. But no kill me if wrong 1 Link til kommentar
Trixx Besvaret Juli 27, 2021 Del Besvaret Juli 27, 2021 Super nice release. Men men men... Er vi i egypten med dine pyramider? 1 1 Link til kommentar
Recommended Posts