Jump to content
MakeWebGames

Recommended Posts

Posted (edited)

This mod was requested by $Chinion$...

What this does is allow you to steal money and crystals from other players, it takes 10 energy to perform one steal...

This can be modify to steal from banks just change the money part to bankmoney... right now I have it taking from money out of the bank...Create a new file call it steal.php

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Screenshots...

11qo5kw.png

2uo0u45.png

 

NOTE: If the code did not show up correctly let me know and i will take off the bbcode tags.. im using firefox and see br tags everywhere o.O

Edited by lucky3809
recoded.
Posted (edited)

This is the style that goes up above the page...

<style type="text/css">

.steals_msg {

color: #009900;

margin: 0;

padding: 2px 0px 2px 12px;

}

.steals {

border: 1px #009900 solid;

background-color: #eee;

width: 55%;

margin: 0 auto;

padding: 8px 15px 3px 15px;

}

.steal_msg {

color: #000;

margin: 0;

padding: 2px 0px 2px 12px;

}

.steal {

border: 1px #000 solid;

background-color: #eee;

width: 55%;

margin: 0 auto;

padding: 8px 15px 3px 15px;

}

.stealhj {

border: 1px maroon solid;

background-color: #eee;

width: 55%;

margin: 0 auto;

padding: 8px 15px 3px 15px;

}

.stealhj_msg {

color: maroon;

margin: 0;

padding: 2px 0px 2px 12px;

}

 

</style>

 

Forgot lol....

For those that dont know how to create the link to the steal page you place this on the viewuser.php

<a href="steal.php?ID='.$r['userid'].'">Steal</a>

Edited by lucky3809
Posted (edited)

One thing that immediately popped up was

$_GET['action'] = (int)

however on its usage

$_GET['action'] ='money'; <----- thats not a number

Found it curious the usage of abs(intval($_SESSION['userid'])) and your not checking the crystals or money

Its much better assigning a var to the checking in my opinion.

$id=(isset($_GET['ID']) && ctype_digit($_GET['ID'])) ? $_GET['ID'] : '';

Then use the var in your queries.

Having already checked the ID so is there any need for abs(intval($_GET['ID']))

Nothing really bad with what you have done so well done :D

Edited by rulerofzu
Posted

I really wonder why all of you use the abs(intval($var)) idea... Is a negative number a problem for an id? I doubt. Second it would be much much shorter and faster to write simply $var+=0 and your $var is in any case then a number and you will not risk any SQL injections from it anymore.

Posted

I know on some modifications the entry of -99999999999999999999 or +9999999999999- Will cause an error in the script crediting the users with entirely to much money.

this is why most use abs(int) or ctype_digit

Posted

thanks for the input...$var+=0 I didnt know about that, will look it up and practice using that. I haven't covered all the basics, iam no expert lol. I just know somethings that do work for me.

I use abs(intval for many reason one in which Joshua said and another when someone enters for instant http://www.game.com/steal.php?ID='1' in the url, I dont want it to show a query error like it would show if I had not used it in the link directing from the users profile. I dont want users to enter in an invalid statement..

I know I could prevent the error message from showing by adding @$db->query...

Posted

Much better to have PHP error messages on whilst your coding and then if you feel like it turn them off before you go live.

In Mc2 in the db class you can alter the message shown in game for db errors so the user only sees a oops sorry please report it in message.

There is a modification on here for it somewhere.

The session ID shouldnt need to be checked like that as it should have been set correctly upon login

Posted

Error

Hey , i installed this and i had a few errors .. i fixed some and the page finally showed up:

this it what it say all the time :

Stealing Error

Player does not exist.

 

any ideas how to fix it

Posted (edited)

Sorry the end of the script should be...

I forgot the $id = part....

 

$id=(isset($_GET['ID']) && ctype_digit($_GET['ID'])) ? $_GET['ID'] : '';

$user=$db->query("SELECT username FROM users WHERE userid='$id'")or die(mysql_error());

$r=$db->fetch_row($user);

echo '

Each steal cost 10 energy, you have '.$ir['energy'].' energy.<br />

You may steal the following from '.$r['username'].'...<br /><br />

<table><tr><td >

<a href="steal.php?ID='.$id.'&action=money">Money</a> | 

<a href="steal.php?ID='.$id.'&action=crystals ">Crystals

</a></td></table>';

$h->endpage();

 

I updated the main post

also for those using the script some of the mres has a space due to the forum you need to back space them.

also dont forget you cant just link the page to steal.php it has to be steal.php?ID='.$r['userid'].' as typed in second posting lol....

Edited by lucky3809
  • 1 month later...
Posted

your more then welcome to update it if you want to tezzmosis, but i wont be updating it, there is no need of updating it the main thing the requester wanted was for a player to be able to steal cash and crystals from other players, and that's exactly what it does.

Posted

this kind of mod confuses me a little. You want donators to buy cystals yet you then put them at risk of having their crystals stolen. I know if i just spent whatever amount on crystals from your upgrade store that i would be quite mad if they was stolen from me by another player who hasnt paid to play.

Just my thought though :D

Posted (edited)

I made this mod for $Chinion$ he requested it..

http://makewebgames.io/showthread.php/39050-Would-this-cost

If you do not want crystals stolen you can easily remove that part, and only have cash...

$chinion$ asked for a mod where players can steal money and crystals,because on his game crystals are easy to get... I preferably wouldn't want crystals being stolen, but i did not make this mod for myself, i made it for $chinion$ on request... so ask him why he wants crystals stolen lol...

Edited by lucky3809

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...