'************************************************'START CREDITS SYSTEM! Dinand Mentink - Ilnair'************************************************Function CheckCredit(index, code1, code2)On Error Resume NextCheckCredit = 0If CryptCode(index, code1) = code2 Then CheckCredit = 1Else CheckCredit = 0 Exit FunctionEnd IfIf GetVar("credit.ini", "prevuse", code1 & "") = 0 Then CheckCredit = 1Else CheckCredit = 2End IfEnd FunctionFunction CryptCode(index, code1)Dim code1tempcode1temp = code1code1temp = 1/(Log(code1temp)/10)code1temp = 1.6 * code1tempcode1temp = code1temp / (<INSERT NUMBER BETWEEN 1111 and 9999>^0.5)code1temp = code1temp * 25code1temp = Log((code1temp^<INSERT NUMBER BETWEEN 1 and 1.5)+1)code1temp = (code1temp - 0.25) * 10code1temp = code1temp * 10000000000CryptCode = Int(code1temp)End Function'************************************************'END CREDITS SYSTEM! Dinand Mentink - Ilnair'************************************************
If LCase(Mid(TextSay, 1, 7)) = "/credit" Then If Len(TextSay) > 8 Then If Mid(TextSay, 9, 5) = "check" Then If GetPlayerAccess(index) = 0 Then Call PlayerMsg(index, "You have to be a GM to use this command!", 12) Exit Sub End If TextSay = Mid(TextSay, 14) code1 = Int(LCase(Mid(TextSay, 1, 9))) code2 = Int(LCase(Mid(TextSay, 11, 13))) If CheckCredit(index, code1, code2) = 0 Then Call PlayerMsg(index, "Diamond Code: " & code1 & "-" & code2 & " is invalid!", 12) Exit Sub ElseIf CheckCredit(index, code1, code2) = 1 Then Call PlayerMsg(index, "Diamond Code: " & code1 & "-" & code2 & " is valid and has not been used before!", 10) Exit Sub Else Call PlayerMsg(index, "Diamond Code: " & code1 & "-" & code2 & " is valid, but has been used before!", 14) n = GetVar("credit.ini", "prevuseinfo", code1 & "") Call Playermsg(index, "Details: " & n, 15) Exit Sub End If Exit Sub End If TextSay = Mid(TextSay, 8) Select Case LCase(Trim(TextSay)) Case "help" If GetPlayerAccess(index) > 0 Then Call PlayerMsg(index, "COMMAND REFERENCE for /credit:", 15) Call PlayerMsg(index, "This command is used to credit diamond codes!", 15) Call PlayerMsg(index, "Commands: <diamond code>: This will credit a diamond into your inventory!", 15) Call PlayerMsg(index, " check: Checks a code for details!", 15) Call PlayerMsg(index, " generate: Generates a random Diamond Code!", 15) Exit Sub Else Call PlayerMsg(index, "Help for /credit:", 15) Call PlayerMsg(index, "This command is used to credit diamond codes!", 15) Call PlayerMsg(index, "Commands: <diamond code>: This will credit a diamond into your inventory!", 15) Exit Sub End If Case "generate" If GetPlayerAccess(index) = 0 Then Call PlayerMsg(index, "You have to be a GM to use this command!", 12) Exit Sub End If code1 = Int((99999999 - 10000000 + 1)*Rnd) + 10000000 code2 = CryptCode(index, code1) Call PlayerMsg(index, "Generated Diamond Code: " & code1 & "-" & code2, 15) n = 1 Do While n < 11 code1 = Int((99999999 - 10000000 + 1)*Rnd) + 10000000 code2 = CryptCode(index, code1) Call PutVar("codes.ini", "Generated Codes", "Code" & n & " ", " " & code1 & "-" & code2) n = n + 1 Loop Exit Sub End Select code1 = Int(LCase(Mid(TextSay, 1, 9))) code2 = Int(LCase(Mid(TextSay, 11, 13))) If code1 > 9999999 and code1 < 100000000 Then If CheckCredit(index, code1, code2) = 0 Then Call PlayerMsg(index, "The code you entered: " & code1 & "-" & code2 & " is invalid!", 12) Exit Sub ElseIf CheckCredit(index, code1, code2) = 1 Then Call PlayerMsg(index, "The code you entered: " & code1 & "-" & code2 & " is valid!", 10) '<INSERT WHAT YOU WANT TO HAPPEN HERE!> Call PutVar("credit.ini", "prevuseinfo", code1 & "", "Account: " & GetPlayerLogin(index) & " CharNum: " & GetPlayerCharNum(index) & " IP: " & GetPlayerIP(index) & " Character Name: " & GetPlayerName(index)) Call PutVar("credit.ini", "prevuse", code1 & "", "1") Exit Sub Else Call PlayerMsg(index, "The code you entered: " & code1 & "-" & code2 & " is valid, but has been used before! Please contact a GM if you are sure you didn't already use this code!", 12) Exit Sub End If End If Call PlayerMsg(index, "This command does not exist. Please enter /credit help for all commands.", 12) Else 'Dit gebeurt er als je niets invult achter het commando Call PlayerMsg(index, "You need to enter a subcommand. Please enter /credit help for all commands.", 12) End IfExit SubEnd If
When Japanese try to make RPGs, somebody sets up us the bomb
I meant what do you write in the ini file?
Very nice. Now we have something to use when we want to limit access to the game(but who wants that?)