Cronwerks MCCode/MCCodes Forums

Please login or register.

Login with username, password and session length

News:

Register your account to receive email notifications when new services and mods are added.


This forum is now closed and has moved to a new location! Click here to find out why.
Pages: 1 [2] 3 4 ... 6

AuthorTopic: [MCCode] Voting System  (Read 10081 times)

Dylan

  • Basic Member
  • *
  • Reputation Power: 0
  • Dylan has no influence.
  • Offline Offline
  • Posts: 12
    • View Profile
    • Email
Re: [MCCode] Voting System
« Reply #15 on: March 16, 2009, 12:21:56 AM »
Heres an addon for staff to see who has voted...

Add This to the bottom of Staff_Logs
Code: [Select]
function view_vote_logs()
{
global $ir,$c,$h,$userid;
print "<h3>Voting Logs</h3>
<table width=75% border=1> <tr> <th>ID</th> <th>Time</th><th>Player</th></tr>";
$q=mysql_query("SELECT * FROM votes ORDER BY  userid ASC",$c);
while($r=mysql_fetch_array($q))
{
print"<tr><td>{$r['site']}</td> <td>".date('F j, Y, g:i:s a',$r['voteTIME'])."</td><td><a href='viewuser.php?u={$r['userid']}'>{$r['userid']}</a></td>
</tr>";
}
}

Add the case

Code: [Select]
case 'votelogs': view_vote_logs(); break;
In the File - Voted.php

Code: [Select]
if($r['rewardtype'] == 1)
 {
 $muneh=money_formatter($reward);
 mysql_query("INSERT INTO votes values ($userid,$id,unix_timestamp())",$c);
 event_add($userid,"Thank you for voting! You have receieved $muneh!", $c);
 mysql_query("UPDATE users SET money=money+$reward WHERE userid=$userid",$c);
 }
 if($r['rewardtype'] == 2)
 {
 mysql_query("INSERT INTO votes values ($userid,$id,unix_timestamp())",$c);

^^ Lines 70-79

And for the link

<a href='staff_logs.php?action=votelogs'>Voting Logs</a><br />


Remove if not needed here.
« Last Edit: March 16, 2009, 12:36:28 AM by Dylan »
Logged

buddy

  • Basic Member
  • *
  • Reputation Power: 4
  • buddy has no influence.
  • Offline Offline
  • Posts: 10
    • View Profile
    • Email
Re: [MCCode] Voting System
« Reply #16 on: March 17, 2009, 05:11:38 PM »
i have that issue for multiple votes from one site on mine...im using version 2. I will try and re-do the sql and recheck the code
Logged

SaMz

  • Basic Member
  • *
  • Reputation Power: 22
  • SaMz has no influence.
  • Offline Offline
  • Posts: 35
    • View Profile
    • Email
Re: [MCCode] Voting System
« Reply #17 on: March 20, 2009, 06:28:03 PM »
yup same prob its not to do with database
Logged

SaMz

  • Basic Member
  • *
  • Reputation Power: 22
  • SaMz has no influence.
  • Offline Offline
  • Posts: 35
    • View Profile
    • Email
Re: [MCCode] Voting System
« Reply #18 on: March 24, 2009, 05:50:57 PM »
got it working :)
Logged

Cronus

  • Administrator
  • Senior Member
  • *****
  • Reputation Power: 2901
  • Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!
  • Offline Offline
  • Posts: 550
    • MSN Messenger - preston__08@hotmail.com
    • View Profile
    • WWW
Re: [MCCode] Voting System
« Reply #19 on: March 26, 2009, 01:55:40 AM »
A new updated version has been uploaded.
There was a small bug that was effecting some games.
This bug may not currently be present on your game, but it could in the future.
It is advised to redownload this mod and upload the voting.php page again.
The voting.php page was the only page with an issue, and is completely fixed now.
Sorry if this caused any trouble.
Logged
My msn is preston__08@hotmail.com if anyone is interested, I am online frequently.

DGM-Studios

  • Basic Member
  • *
  • Reputation Power: 0
  • DGM-Studios has no influence.
  • Offline Offline
  • Posts: 22
    • MSN Messenger - katsuto@dgm-studios.com
    • View Profile
    • WWW
Re: [MCCode] Voting System
« Reply #20 on: March 26, 2009, 05:15:15 PM »
Well Done! This is a great mod, i have also seen a few people charging for simular voting system's like this but this is really the best i have seen.
Good One Cronus!
Logged

SaMz

  • Basic Member
  • *
  • Reputation Power: 22
  • SaMz has no influence.
  • Offline Offline
  • Posts: 35
    • View Profile
    • Email
Re: [MCCode] Voting System
« Reply #21 on: April 11, 2009, 05:12:47 PM »
if anyone is having a problem with this multiple voting...

find in day cron:
Code: [Select]
mysql_query("TRUNCATE TABLE votes;",$c);
Add Below:
Code: [Select]
mysql_query("INSERT INTO `votes` (`userid`, `site`) VALUES (0, 1237179600);",$c);
this will stop the problem... i dont know why this needs to be in voting sql but works ;)...

You will be able to vote only once per site :D
Logged

Cronus

  • Administrator
  • Senior Member
  • *****
  • Reputation Power: 2901
  • Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!
  • Offline Offline
  • Posts: 550
    • MSN Messenger - preston__08@hotmail.com
    • View Profile
    • WWW
Re: [MCCode] Voting System
« Reply #22 on: April 11, 2009, 06:40:47 PM »
Well, there is no day cron with this mod so if you have a day cron already set to do that you would have to remove it.
Logged
My msn is preston__08@hotmail.com if anyone is interested, I am online frequently.

SaMz

  • Basic Member
  • *
  • Reputation Power: 22
  • SaMz has no influence.
  • Offline Offline
  • Posts: 35
    • View Profile
    • Email
Re: [MCCode] Voting System
« Reply #23 on: April 11, 2009, 07:10:59 PM »
so how will voting reset... i see no timestamps...
Logged

Crazy-T

  • Basic Member
  • *
  • Reputation Power: 0
  • Crazy-T is looked down upon.
  • Offline Offline
  • Posts: 23
    • MSN Messenger - bb-16-ac@hotmail.co.uk
    • View Profile
Re: [MCCode] Voting System
« Reply #24 on: April 11, 2009, 07:14:37 PM »
Quote
function view_vote_logs()
{
global $ir,$c,$h,$userid;
print "<h3>Voting Logs</h3>
<table width=75% border=1> <tr> <th>ID</th> <th>Time</th><th>Player</th></tr>";
$q=mysql_query("SELECT * FROM votes ORDER BY  userid ASC",$c);
while($r=mysql_fetch_array($q))
{
print"<tr><td>{$r['site']}</td> <td>".date('F j, Y, g:i:s a',$r['voteTIME'])."</td><td><a href='viewuser.php?u={$r['userid']}'>{$r['userid']}</a></td>
</tr>";
}
}

I know i dont need to say this but you forgot echo '</table>';   :)
Logged
Self Taught Website Dev'er
If you need me pm on here or email/pm me on Msn bb-16-ac@hotmail.co.uk

Cronus

  • Administrator
  • Senior Member
  • *****
  • Reputation Power: 2901
  • Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!
  • Offline Offline
  • Posts: 550
    • MSN Messenger - preston__08@hotmail.com
    • View Profile
    • WWW
Re: [MCCode] Voting System
« Reply #25 on: April 11, 2009, 07:19:31 PM »
so how will voting reset... i see no timestamps...
Well they are there, I don't know what else to tell you.
Logged
My msn is preston__08@hotmail.com if anyone is interested, I am online frequently.

strats

  • Active Member
  • **
  • Reputation Power: 13
  • strats has no influence.
  • Offline Offline
  • Posts: 109
    • View Profile
Re: [MCCode] Voting System
« Reply #26 on: April 12, 2009, 02:51:32 PM »
Thanks for the great Mod and thank you for not charging :)

And thanks Sam for your little extra help  :)
Logged

SaMz

  • Basic Member
  • *
  • Reputation Power: 22
  • SaMz has no influence.
  • Offline Offline
  • Posts: 35
    • View Profile
    • Email
Re: [MCCode] Voting System
« Reply #27 on: April 13, 2009, 05:05:46 PM »
so how will voting reset... i see no timestamps...
Well they are there, I don't know what else to tell you.
Many people thaught this ran on crons thats why they had problems with it but overall this is a great modification :D
Logged

Cronus

  • Administrator
  • Senior Member
  • *****
  • Reputation Power: 2901
  • Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!
  • Offline Offline
  • Posts: 550
    • MSN Messenger - preston__08@hotmail.com
    • View Profile
    • WWW
Re: [MCCode] Voting System
« Reply #28 on: April 13, 2009, 06:11:01 PM »
The first line of this mod says, and I quote, "Easy voting system, and runs on timestamps."
Logged
My msn is preston__08@hotmail.com if anyone is interested, I am online frequently.

Karlos

  • Basic Member
  • *
  • Reputation Power: 0
  • Karlos is looked down upon.
  • Offline Offline
  • Posts: 9
    • View Profile
Re: [MCCode] Voting System
« Reply #29 on: April 14, 2009, 03:35:58 AM »
I slightly editted it but in all look for the timestamp.

$Site $db->fetch_row($db->query("SELECT `userid`, `site` FROM `votes` WHERE `userid`='0'"));
  
if (
$Site['site'] < time()) {
 
$db->query("DELETE FROM `votes` WHERE `userid` >= '1'");
 
$db->query(sprintf("UPDATE `votes` SET `site`='%s' WHERE `userid`='0'"mktime('0''0''0') + '86400'));
}
Logged
Pages: 1 [2] 3 4 ... 6
« previous next »
 


This forum is now closed and has moved to a new location! Click here to find out why.