Jump to content
MakeWebGames

Recommended Posts

Posted

hi im wondering can anyone help me on this honor exchange thing? im trying to make it so you can exchange 100 honors for a weapon or armour.

this is my money/crystals part, can anyone change the information in this coding to make it so u can exchange the honors for weapon or armour the item ID's are 86 and 87.

 

<?php
include "globals.php";
if(!$_GET['spend'])
{
print "<font color=white>Welcome to the Reward Exchange Center!

You have [b]{$ir['honor']}[/b] Rewards.

What would you like to spend your Rewards on?</font>


<table width=50% cellspacing=1 class='table'>

<th><font color=firebrick><h3>Type</h3></th>
<th><font color=firebrick><h3>Money/Knifes Per Reward</h3></th>
<th><font color=firebrick><h3>Claim</h3></font></th></tr>

<td><center><font color=white>Money</td><td><center><font color=white>\$10000</td><td><center><a href='rewardexchange.php?spend=money'>Get It</td></tr><tr>
<td><center><font color=white>Knifes</td><td><center><font color=white>50</td><td><center><a href='rewardexchange.php?spend=crystals'>Get It</td></tr><tr>
</td></tr></table>";
}
else if($_GET['spend'] == 'money')
{
print "<font color=white>Type in the amount of Rewards you want to swap for cash.

You have [b]{$ir['honor']}[/b] Rewards.

One Reward = \$10000.</font><form action='rewardexchange.php?spend=money2' method='post'><input type='text' name='honor' />
<input type='submit' value='Swap' /></form>";
}
else if($_GET['spend'] == 'money2')
{
$_POST['honor']=(int) $_POST['honor'];
if($_POST['honor'] <= 0 || $_POST['honor'] > $ir['honor'])
{
print "<font color=white>Error, you either do not have enough Rewards or did not fill out the form.</font>

[url='rewardexchange.php?spend=money']Back[/url]";
}
else
{
$moneygain=$_POST['honor']*10000;
mysql_query("UPDATE users SET honor=honor-{$_POST['honor']},money=money+$moneygain WHERE userid=$userid",$c);
print "<font color=white>You traded {$_POST['honor']} Rewards for $moneygain.</font>";
}
}
else if($_GET['spend'] == 'crystals')
{
print "<font color=white>Type in the amount of Rewards you want to swap for Knifes.

You have [b]{$ir['honor']}[/b] Rewards.

One Reward = 50 Knifes.</font><form action='rewardexchange.php?spend=crystals2' method='post'><input type='text' name='honor' />
<input type='submit' value='Swap' /></form>";
}
else if($_GET['spend'] == 'crystals2')
{
$_POST['honor']=(int) $_POST['honor'];
if($_POST['honor'] <= 0 || $_POST['honor'] > $ir['honor'])
{
print "Error, you either do not have enough Rewards or did not fill out the form.

[url='rewardexchange.php?spend=crystals']Back[/url]";
}
else
{
$crystalsgain=$_POST['honor']*50;
mysql_query("UPDATE users SET honor=honor-{$_POST['honor']},crystals=crystals+$crystalsgain WHERE userid=$userid",$c);
print "<font color=white>You traded {$_POST['honor']} Rewards for $crystalsgain knifes.</font>";
}
}
$h->endpage();
?>
Posted

Re: honor exchange help

also if you could... can u tell me how to make the streets search 1 by 1 and not all at a time until u go into hospital/jail?

i have tried searching for both these topics before i posted a help thing, but i cant find it.

Posted

Re: honor exchange help

 

$_POST['honor']=strip_tags($_POST['honor']);
$_POST['honor']=abs((int)($_POST['honor']));
$_POST['money']=strip_tags($_POST['money']);
$_POST['money']=abs($_POST['money']);

LOL, why even use all that?...

Posted

Re: honor exchange help

but anyways, does anyone know how to make it so u can exchange the honor points for weapons or armour?

it would be greatful, if u can convert the money into weapon and crystals into armour at 100 honor points each.

with the item ID's of 86 and 87,

Posted

Re: honor exchange help

no, i have no idea what u mean lol. i dont know how to write the query thing in to insert a item thing. if anyone knows, can u tell me please? or even show me a post which probably explains it :)

Posted

Re: honor exchange help

Honestly you need to do some more learning and reseach on your game code if you cant figure out how to add something to someones inventory. You have no business running/coding a game thats open to the public until you learn the basics. THere are two ways: insert it into the inventory, or use the item_add function in your global functions. (v2).

Posted

Re: honor exchange help

the honor exchange thing confuses me when trying to make it add a item and not stats. the adding stats bit is easy.

thats why i asked if someone can convert that honor exchange file i posted up into where you can give out items and not stats.

thats all i asked... not how to do it. as if someone can convert it into making it give out items for a set amount of honors which is 100 of them, i can learn how to do it that way. its much easier...

Posted

Re: honor exchange help

i wasnt sure what you ment but as ive been trying to learn the basics of HTML and XHTML over the past week i thought i would give it a go :) it probably wont be right but if it is could someone who knows HTML/XHTML fix it :D lol erm here it is

<?php // pwetty colors remove this one only
else if($_GET['spend'] == 'gun')
{
switch($_GET['gun'])
{
case 'gun1': gun1(); break;
case 'gun1buy': gun1buy(); break;
case 'gun2': gun2(); break;
case 'gun2buy': gun2buy(); break;
default: index(); break;
}
function index()
{
?>
<font color=white>Select the gun you would like to sawp for rewards.

You have [b]<? echo "{$ir['honor']} "; ?>[/b] Rewards.

<table border="0">
<tr>
<td>Name</td>
<td>Price</td>
<td>Swap?</td>
</tr>
<tr>
<td>Gun 1</td>
<td>100 Honors</td>
<td>[url='rewardexchange.php?spend=gun&gun=gun1']Swap![/url]</td>
</tr>
<tr>
<td>Gun2</td>
<td>100 Honors</td>
<td>[url='rewardexchange.php?spend=gun&gun=gun2']Swap![/url]</td>
</tr>
</table> 
<font>
<?
}
function gun1()
{
?>
<font color=white>So you want a Gun1.

It will cost you 100 honors.

Are you sure?

<form name="input" action="rewardexchange.php?spend=gun&gun=gun1buy" method="get">
<input type="button" value="Yes Please">
</form>
<form name="input" action="rewardexchange.php" method="get">
<input type="button" value="No Thanks">
</form>
</font>
<?
}
function gun1buy()
{
if($ir['honor'] <= 99)
{
?>
<font color=white>
<big>Ehem</big>

You do not have enought honors to buy gun1 yet you only have <? echo"{$ir['honor']}."; ?>

[url='index.php']Go Home.[/url]   [url='rewardexchange.php']Go Back.[/url]  

</font>
<?
}
else
{
?>
<font color=white>
You have swaped the 100 honors for Gun1 Remember this could hurt someone be carefull.

<?
$itemid = '1'; // change this to gun id
item_add($userid, $itemid);
$db->query("UPDATE users SET honors=honors - 100 WHERE userid={$_SESSION['userid']}");
?>
</font>
<?
function gun2()
{
?>
<font color=white>So you want a Gun2.

It will cost you 100 honors.

Are you sure?

<form name="input" action="rewardexchange.php?spend=gun&gun=gun2buy" method="get">
<input type="button" value="Yes Please">
</form>
<form name="input" action="rewardexchange.php" method="get">
<input type="button" value="No Thanks">
</form>
</font>
<?
}
function gun2buy()
{
if($ir['honor'] <= 99)
{
?>
<font color=white>
<big>Ehem</big>

You do not have enought honors to buy gun2  yet you only have <? echo"{$ir['honor']}."; ?>

[url='index.php']Go Home.[/url]   [url='rewardexchange.php']Go Back.[/url]  

</font>
<?
}
else
{
?>
<font color=white>
You have swaped the 100 honors for Gun2 Remember this could hurt someone be carefull.

<?
$itemid = '2'; // change this to gun id
item_add($userid, $itemid);
$db->query("UPDATE users SET honors=honors - 100 WHERE userid={$_SESSION['userid']}");
?>
</font>
<?
Posted

Re: honor exchange help

Ok then try

<?php // pwetty colors remove this one only
else if($_GET['spend'] == 'gun')
{
switch($_GET['gun'])
{
case 'gun1': gun1(); break;
case 'gun1buy': gun1buy(); break;
case 'gun2': gun2(); break;
case 'gun2buy': gun2buy(); break;
default: index(); break;
}
function index()
{
?>
<font color=white>Select the gun you would like to sawp for rewards.

You have [b]<? echo "{$ir['honor']} "; ?>[/b] Rewards.

<table border="0">
<tr>
<td>Name</td>
<td>Price</td>
<td>Swap?</td>
</tr>
<tr>
<td>Gun 1</td>
<td>100 Honors</td>
<td>[url='rewardexchange.php?spend=gun&gun=gun1']Swap![/url]</td>
</tr>
<tr>
<td>Gun2</td>
<td>100 Honors</td>
<td>[url='rewardexchange.php?spend=gun&gun=gun2']Swap![/url]</td>
</tr>
</table>
<font>
<?
}
function gun1()
{
?>
<font color=white>So you want a Gun1.

It will cost you 100 honors.

Are you sure?

<form name="input" action="rewardexchange.php?spend=gun&gun=gun1buy" method="get">
<input type="button" value="Yes Please">
</form>
<form name="input" action="rewardexchange.php" method="get">
<input type="button" value="No Thanks">
</form>
</font>
<?
}
function gun1buy()
{
if($ir['honor'] <= 99)
{
?>
<font color=white>
<big>Ehem</big>

You do not have enought honors to buy gun1 yet you only have <? echo"{$ir['honor']}."; ?>

[url='index.php']Go Home.[/url]   [url='rewardexchange.php']Go Back.[/url]  

</font>
<?
}
else
{
?>
<font color=white>
You have swaped the 100 honors for Gun1 Remember this could hurt someone be carefull.

<?
$itemid = '1'; // change this to gun id
item_add($userid, $itemid, 1);
$db->query("UPDATE users SET honors=honors - 100 WHERE userid={$_SESSION['userid']}");
?>
</font>
<?
function gun2()
{
?>
<font color=white>So you want a Gun2.

It will cost you 100 honors.

Are you sure?

<form name="input" action="rewardexchange.php?spend=gun&gun=gun2buy" method="get">
<input type="button" value="Yes Please">
</form>
<form name="input" action="rewardexchange.php" method="get">
<input type="button" value="No Thanks">
</form>
</font>
<?
}
function gun2buy()
{
if($ir['honor'] <= 99)
{
?>
<font color=white>
<big>Ehem</big>

You do not have enought honors to buy gun2  yet you only have <? echo"{$ir['honor']}."; ?>

[url='index.php']Go Home.[/url]   [url='rewardexchange.php']Go Back.[/url]  

</font>
<?
}
else
{
?>
<font color=white>
You have swaped the 100 honors for Gun2 Remember this could hurt someone be carefull.

<?
$itemid = '2'; // change this to gun id
item_add($userid, $itemid, 1);
$db->query("UPDATE users SET honors=honors - 100 WHERE userid={$_SESSION['userid']}");
?>
</font>
<?

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...