User Control Panel
Advertisements

HELP US, HELP YOU!

points command for maya

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Code Help
View unanswered posts
Author Message
Calum
Not Yet a God
Not Yet a God


Joined: 21 Feb 2004
Posts: 373
Location: england
Reputation: 34.7Reputation: 34.7Reputation: 34.7

PostPosted: Tue Mar 09, 2004 10:41 pm    Post subject: Reply with quote

its kinda crap it records who gave the points to which user and how many so it comes out like

calum@iamwasted.com awarded user: billy@bill.com 5 points
calum@iamwasted.com awarded user: billy@bill.com 10 points

it doesnt add them up im a noob to perl so its best i could do if any one wants it just post
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Tue Mar 09, 2004 11:51 pm    Post subject: Reply with quote

Here's my shot at it.

Code:
if ($msg =~ /\^points/i) {<br />   # Open points file<br />   open (FILE, "points.txt");<br />   my @data = <FILE>;<br />   close (FILE);<br />   chomp @data;<br /><br />   # Go through file<br />   %temp;<br />   foreach $line (@data) {<br />      my ($sender,$void,$void,$to,$points,$void) = split(/ /, $line, 6);<br /><br />      if (exists $temp->{$sender}->{$to}) {<br />         $temp->{$sender}->{$to} = $temp{$sender}->{$to} + $points;<br />      }<br />      else {<br />         $temp->{$sender}->{$to} = $points;<br />      }<br />   }<br />   # Send reply.<br />   my $reply;<br />   foreach $key (keys %{$temp}) {<br />      foreach $item (keys %{$temp}->{$key}}) {<br />         $reply .= "$key awarded $item: " . $temp->{$key}->{$item} . "points\n";<br />      }<br />   }<br />}


That probably confused you a ton... but that's the easiest way I can think to do it, using hashes.

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
jeanhub
Almost An Agent
Almost An Agent


Joined: 14 Feb 2004
Posts: 1138

Reputation: 50.7

PostPosted: Wed Mar 10, 2004 12:13 am    Post subject: Reply with quote

Surprised I am trying to make a "award" command its hard lol
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Code Help All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group