Eclipse
January 05, 2009, 04:19:08 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Chat Help Rules Arcade Search Calendar Gallery Login Register  
 
 
 
Recent Topics +-
Free movies? by Paladin
Today at 04:18:22 PM

Spike's Adminishness! by The Oracle
Today at 04:18:21 PM

The New Eclipse Raid on Runscape by Reguba
Today at 04:18:12 PM

PLEASE HELP RTE 2147024770(8007007e) by colby250
Today at 04:17:29 PM

I'm New/Back/Leaving! by The Oracle
Today at 04:08:25 PM

SnowCap by grenegg1
Today at 04:08:24 PM

STOP COMPARING EVERYTHING TO RUNESCAPE by ‪‫‬‭‮‪‫‬‭Admiral Refuge
Today at 04:04:57 PM

New Squiddle Online Tiles ~ Please help make better by >~(Squiddle)~<
Today at 04:04:34 PM

fun with photoshop by ‪‫‬‭‮‪‫‬‭Admiral Refuge
Today at 04:04:19 PM

Sylerean Online Alpha 1.2 Released by James
Today at 04:01:30 PM

Members Online +-
15 Guests, 31 Users
Paladin,
slym,
Zuleloan,
HawkStorm95,
The MrMiguu™ [pizza pretzles],
‪‫‬‭‮‪‫‬‭Admiral Refuge,
Munro,
Hikaru,
>~(Squiddle)~<,
The Oracle,
ralir,
ploxie,
ShadowChao,
Airscar,
Reguba,
tiggilyboo,
Maxac,
Simius Cruentus,
colby250,
Marsh,
timster0,
‪‫‬‭‮‪‫Kusy,
DragonFire,
Almighty Wing,
azkanan,
Gwendalin,
franqetesh,
Ambard,
grenegg1,
Kevin,
Juggernaut
Pages: [1]
  Print  
Author Topic: Script Submission: Credit System (difficulty: advanced 5/5)  (Read 2144 times)
0 Members and 1 Guest are viewing this topic.
Ilnair
The Uber-Scriptor
Advanced Member
****
Offline Offline

Posts: 592


The Uber-Scriptor


View Profile WWW Email
« on: June 23, 2006, 10:19:29 AM »

Ok, I created a script to allow people to buy a "generated key" (or whatever), on you site, and then they can credit it ingame by typing /credit <key>. When they do so, they gain an item, a member status, nothing, a guild, or whatever, thats up to you, i'm just giving you the script.

Difficulty:
New Scripters: 5/5
Advanced scripters: 2/5
Vets: 0/5
Me: I wrote it, ofcourse i'm able to use it, smartass.

Please note. If you want to be sure the script cannot be cracked, you will have to edit the script on the location marked with <CHANGE VALUE HERE BETWEEN 1111 and 9999>

A key can only be used 1 time, the script saves all used keys to a .ini file. If an admin wants to, they can use /credit check <key> to check a key for validity, if it's valid it will also check if it has been previously used. If so, it will give the account details (ip/login name/charname/charnum) of the person that used it.

Commands:
/credit ...
... <key> credit a key
... check <key> (admin only), checks a key if it's valid
... generate (admin only), will generate a random key




Insert the following functions at the bottom of you main.txt:


Code: [Select]
'************************************************
'START CREDITS SYSTEM! Dinand Mentink - Ilnair
'************************************************
Function CheckCredit(index, code1, code2)
On Error Resume Next
CheckCredit = 0
If CryptCode(index, code1) = code2 Then
CheckCredit = 1
Else
CheckCredit = 0
Exit Function
End If

If GetVar("credit.ini", "prevuse", code1 & "") = 0 Then
CheckCredit = 1
Else
CheckCredit = 2
End If
End Function

Function CryptCode(index, code1)
Dim code1temp
code1temp = code1
code1temp = 1/(Log(code1temp)/10)
code1temp = 1.6 * code1temp

code1temp = code1temp / (<INSERT NUMBER BETWEEN 1111 and 9999>^0.5)

code1temp = code1temp * 25
code1temp = Log((code1temp^<INSERT NUMBER BETWEEN 1 and 1.5)+1)

code1temp = (code1temp - 0.25) * 10
code1temp = code1temp * 10000000000
CryptCode = Int(code1temp)
End Function

'************************************************
'END CREDITS SYSTEM! Dinand Mentink - Ilnair
'************************************************



Insert the following command:

Code: [Select]
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 If
Exit Sub
End If

Ok, a code will look something like this: 12345678-123456789123



Please tell me if you get it to work!
Moderob
Active Member
***
Offline Offline

Posts: 322



View Profile Email
« Reply #1 on: June 23, 2006, 10:23:59 AM »

seems interesting, ill try it
but how would they get a code from your site? wouldnt you need a script there to generate the code as well?
Ilnair
The Uber-Scriptor
Advanced Member
****
Offline Offline

Posts: 592


The Uber-Scriptor


View Profile WWW Email
« Reply #2 on: June 23, 2006, 10:26:31 AM »

Yes you would, and my friend wrote the PHP part of the script, because I don't know squad about that ^^. Yes, you'll need a site to generate them, but can't help you with that part.
Moderob
Active Member
***
Offline Offline

Posts: 322



View Profile Email
« Reply #3 on: June 23, 2006, 10:28:41 AM »

lol i was just checking, ill try it when im not drawing lol
Heytherejake
Eclipse Evolution Dev
Active Member
***
Offline Offline

Posts: 426

Currently working on C++ 3D


View Profile WWW Email
« Reply #4 on: July 22, 2006, 06:19:57 PM »

For some reason, I only get the first half of the code...
So i get 123123-
Not 123123-123123123
The Emblem
Uber Programmer
Emblem
Advanced Member
******
Offline Offline

Posts: 517


The game


View Profile Email
« Reply #5 on: July 23, 2006, 08:18:40 AM »

Nice Ilnair!

BTW, Can you PM me the steps to make a code in english and ill try scripting the PHP part ^.^
jakeruston
Member
**
Offline Offline

Posts: 85


View Profile WWW Email
« Reply #6 on: July 23, 2006, 09:09:59 AM »

What do i put in the credit.ini file?
Ilnair
The Uber-Scriptor
Advanced Member
****
Offline Offline

Posts: 592


The Uber-Scriptor


View Profile WWW Email
« Reply #7 on: July 24, 2006, 10:29:18 AM »

Just in the server folder.

Btw, the php part is already done, but dunno how it works. I'll ask my friend who made it to post about it here.
jakeruston
Member
**
Offline Offline

Posts: 85


View Profile WWW Email
« Reply #8 on: July 24, 2006, 10:30:35 AM »

I meant what do you write in the ini file?
CyberGenesis
Member
**
Offline Offline

Posts: 89


View Profile Email
« Reply #9 on: July 24, 2006, 10:38:50 AM »

Very nice. Now we have something to use when we want to limit access to the game(but who wants that?)
Lach
Newb
*
Offline Offline

Posts: 2


View Profile WWW Email
« Reply #10 on: July 24, 2006, 10:51:36 AM »

Wow good job man.
Ilnair
The Uber-Scriptor
Advanced Member
****
Offline Offline

Posts: 592


The Uber-Scriptor


View Profile WWW Email
« Reply #11 on: July 24, 2006, 12:37:01 PM »

Quote from: jakeruston
I meant what do you write in the ini file?


If i'm correctly, nothing.


Quote
Very nice. Now we have something to use when we want to limit access to the game(but who wants that?)

But you could use it to give people some item if they donate for your server :p.
CyberGenesis
Member
**
Offline Offline

Posts: 89


View Profile Email
« Reply #12 on: July 24, 2006, 10:54:38 PM »

good point! now why didnt that idea hit me... ><
Niko
Official Eclipse Nazi Admin
Administrator
Teh Uberleet
*
Offline Offline

Posts: 3,309


Fear me for I have the power of the BAN HAMMER!


View Profile Email
« Reply #13 on: July 26, 2006, 04:09:48 PM »

nice man, very nice... hmmm... i feel a members section of my game suddenly popping up...wooot that php part would be nice tho.. lol
Ilnair
The Uber-Scriptor
Advanced Member
****
Offline Offline

Posts: 592


The Uber-Scriptor


View Profile WWW Email
« Reply #14 on: July 27, 2006, 05:58:12 AM »

Can't help with that. Never did ANY php, so I got no clue how it's working, I can ask ralphje to post the script here though (already did, but will do again).
Niko
Official Eclipse Nazi Admin
Administrator
Teh Uberleet
*
Offline Offline

Posts: 3,309


Fear me for I have the power of the BAN HAMMER!


View Profile Email
« Reply #15 on: July 27, 2006, 06:13:01 AM »

thanks man, id realy like to use this i just need a way to give the people a code.
Pickle
REBEL SCUM
Veteran
Advanced Eclipser
*
Offline Offline

Posts: 1,765


So, a baby seal walks into a club...


View Profile Email
« Reply #16 on: July 29, 2006, 08:25:37 AM »

I just installed this on a friend's game and I have to say that it's really easy to set up and use, great job man :)

Marsh, you should put this on the script page in the website.
whiteknight
Active Member
***
Offline Offline

Posts: 181



View Profile Email
« Reply #17 on: July 23, 2007, 04:10:31 AM »

What are the chances of doing something like:
The generated code:
12345-12345678
and if the user does like:
12344-12345678
what are the chances of that working?
Pages: [1]
  Print  
 
 

Powered by EzPortal
Powered by MySQL Powered by PHP Powered by SMF 2.0 Beta 4 |