-
Posts
693 -
Joined
-
Last visited
-
Days Won
1
Content Type
Profiles
Forums
Events
Everything posted by radio_active
-
mccode-v2 Shops item stock - as requested (Not Tested)
radio_active replied to radio_active's topic in Free Modifications
Re: [MCcode v2] Shops item stock - as requested (Not Tested) Thanks, i need a test... in shops.php put this in it replacing the current one (about 10 lines down) $_GET['shop'] = abs(@intval(int)($_GET['shop'])); If it still doesnt show, just put this there $_GET['shop'] = abs(int)$_GET['shop']); and then replace the $qtwo query with this, was missing a , on the selects. $qtwo = $db->query(sprintf("SELECT si.sitemID,sitemSHOP,sitemITEMID,sitemQTY, i.itmid,itmname,itmdesc,itmbuyprice,itmsellprice,itmtype, it.itmtypename FROM shopitems si LEFT JOIN items i ON si.sitemITEMID = i.itmid LEFT JOIN itemtypes it ON i.itmtype = it.itmtypeid WHERE si.sitemSHOP = ('%d') ORDER BY i.itmtype ASC, i.itmbuyprice ASC, i.itmname ASC", $_GET['shop'] )); Then report back xD -
mccode-v2 Shops item stock - as requested (Not Tested)
radio_active replied to radio_active's topic in Free Modifications
Re: [MCcode v2] Shops item stock - as requested (Not Tested) ishmell, if your selecting only the fields needed in your queries eg $g = $db->query("insert into shops (shopname,shopdesc) values ($_POST['name'],$_POST['desc']"); It wont spill and error, the SQL has a default which if you wish you can set to 100 meaning when you add an item, the stock will be 100 when added, or you can add it and wait for it to be updated, however... If your using SELECT * then it will spill out the Column count Doesn't match blah blah.... =) BUt thanks for pointing it out for other people who use SELECT * $db->query("INSERT INTO shopitems VALUES('',{$_POST['shop']},{$_POST['item']})"); You would want to replace that with what you said if it has a default, if it has no default then you would want to put '0' in that last part... :-) EDIT: Gave a better example -
mccode-v2 Shops item stock - as requested (Not Tested)
radio_active posted a topic in Free Modifications
Well Joss someone requested this so i decided to whip something up, but note i have not tested it. Files to edit and or replace: itembuy.php && shops.php SQL: 1 Alter SQL Cron 1 cron edit. itembuy.php you can either replace with this: <?php include "globals.php"; $_GET['ID']= abs(@intval($_GET['ID'])); $_GET['shop']= abs(@intval($_GET['shop'])); $_POST['qty']= abs(@intval($_POST['qty'])); if(!$_GET['ID'] || !$_POST['qty']) { echo "Invalid use of file"; } else if($_POST['qty'] <= 0) { echo "You have been added to the delete list for trying to cheat the game."; } else { $q = $db->query(sprintf("SELECT `itmid`,`itmtype`,`itmname`,`itmbuyprice`,`itmbuyable` FROM items WHERE itmid=('%d')", $_GET['ID'])); $q = $db->query(sprintf("SELECT sitemID,sitemQTY FROM shopitems WHERE sitemSHOP = ('%d')", $_GET['ID'])); if(mysql_num_rows($q) == 0) { echo "Invalid item ID"; } else { $itemd = mysql_fetch_assoc($q); $qty = mysql_fetch_assoc($q); if($ir['money'] < $itemd['itmbuyprice']*$_POST['qty']) { echo "You don't have enough money to buy this item!"; $h->endpage(); exit; } if($itemd['itmbuyable'] == 0) { echo "This item can't be bought!"; $h->endpage(); exit; } if($qty['sitemQTY'] == 0) { echo "This item is out of stock, you will have to wait for a new shipment"; $h->endpage(); exit; } if($qty['sitemQTY'] <= $_POST['qty']) { echo "There isn't enough items in stock to purchase that quantity"; $h->endpage(); exit; } $price = ($itemd['itmbuyprice'] * $_POST['qty']); item_add($userid, $_GET['ID'], $_POST['qty']); $db->query(sprintf("UPDATE `users` SET `money` = money - ('%d') WHERE `userid` = ('%d')", $price, $userid)); $db->query(sprintf("UPDATE `shopitems` SET `sitemQTY` = sitemQTY - ('%d') WHERE `sitemSHOP` = ('%d')", $_POST['qty'], $_GET['shop'])); $db->query(sprintf("INSERT INTO `itembuylogs` (ibID,ibUSER,ibITEM,ibTOTALPRICE,ibQTY,ibTIME,ibCONTENT) VALUES (%u,%d,%u,%d,%u,unix_timestamp(), '{$ir['username']} bought {$_POST['qty']} {$itemd['itmname']}(s) for {$price}')", '', $r['imITEM'], $_GET['ID'], $price, $_POST['qty'], $r['imPRICE'], $r['imID'], $i) ); echo "You bought {$_POST['qty']} {$itemd['itmname']}(s) for \$$price"; } } $h->endpage(); ?> Or add these to your own (probably safer). $_GET['shop']= abs(@intval($_GET['shop'])); $b = $db->query(sprintf("SELECT sitemID,sitemQTY FROM shopitems WHERE sitemSHOP = ('%d')", $_GET['ID'])); $qty = mysql_fetch_assoc($b); if($qty['sitemQTY'] == 0) { echo "This item is out of stock, you will have to wait for a new shipment"; $h->endpage(); exit; } if($qty['sitemQTY'] <= $_POST['qty']) { echo "There isn't enough items in stock to purchase that quantity"; $h->endpage(); exit; } and $db->query(sprintf("UPDATE `shopitems` SET `sitemQTY` = sitemQTY - ('%d') WHERE `sitemSHOP` = ('%d')", $_POST['qty'], $_GET['shop'])); Now shops.php Im not posting all the edits because they are annoying so you can just have this one which is not tested also, lol <?php include "globals.php"; if($ir['hospital'] | $ir['jail']) { echo " You cannot access this whilst in hospital or jail "; $h->endpage(); exit; } $_GET['shop'] = abs(@intval($_GET['shop'])); if(!$_GET['shop']) { echo "You walk downtown and see all the usefull shops available. "; $q = $db->query(sprintf("SELECT shopNAME,shopDESCRIPTION FROM `shops` WHERE shopLOCATION = ('%u')", $ir['location'])); echo " <table width=85% cellspacing=1 class='table'> <tr style='background: gray;'> <th>Shop</th> <th>Description</th> </tr>"; while($r = mysql_fetch_assoc($q)) { echo " <tr> <td>[url='shops.php?shop={$r[']{$r['shopNAME']}[/url]</td> <td>{$r['shopDESCRIPTION']}</td> </tr>"; } echo "</table>"; } else { $sd = $db->query(sprintf("SELECT shopLOCATION,shopNAME FROM shops WHERE shopID= ('%d')", $_GET['shop'] )); if($db->num_rows($sd)) { $shopdata = $db->fetch_row($sd); if($shopdata['shopLOCATION'] == $ir['location']) { echo "Browsing items at [b]".$shopdata['shopNAME']."...[/b] <table cellspacing=1 class='table'> <tr style='background: gray;'> <th>Item</th> <th>Description</th> <th>Price</th> <th>Sell Price</th> <th>In stock</th> <th>Buy</th> </tr>"; $qtwo = $db->query(sprintf("SELECT si.sitemID,sitemSHOP,sitemITEMID,sitemQTY, i.itmid,itmname,itmdesc,itmbuyprice,itmsellprice,itmtype it.itmtypename FROM shopitems si LEFT JOIN items i ON si.sitemITEMID = i.itmid LEFT JOIN itemtypes it ON i.itmtype = it.itmtypeid WHERE si.sitemSHOP = ('%d') ORDER BY i.itmtype ASC, i.itmbuyprice ASC, i.itmname ASC", $_GET['shop'] )); $lt=" "; ?> <script language="Javascript" type="text/javascript"> //<![CDATA[ function moneyformat(num) { num = num.toString().replace(/\$|\,/g,''); if(isNaN(num)) num = "0"; sign = (num == (num = Math.abs(num))); num = Math.floor(num*100+0.50000000001); cents = num%100; num = Math.floor(num/100).toString(); if(cents<10) cents = "0" + cents; for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) num = num.substring(0,num.length-(4*i+3))+','+ num.substring(num.length-(4*i+3)); return (((sign)?'':'-') + '$' + num); } function tot(id,a,b) { var c=a*Math.round(b); var d=moneyformat(c); document.getElementById("res" + id).innerHTML = d; } function clearText(thefield){ if (thefield.defaultValue==thefield.value) thefield.value = "" } function returnText(thefield){ if (thefield.value=='' || thefield.value==0) thefield.value = thefield.defaultValue } //]]> </script> <?php while($r = mysql_fetch_assoc($qtwo)) { if($lt!= $r['itmtypename']) { $lt = $r['itmtypename']; echo "\n<tr style='background: gray;'><th colspan=5>{$lt}</th></tr>"; } $buyprice = money_formatter($r['itmbuyprice']); $sellprice = money_formatter($r['itmsellprice']); ?> <tr><td> <? echo $r['itmname']; ?> </td><td> <? echo $r['itmdesc']; ?> </td><td><? echo $buyprice; ?> </td><td> <? echo $sellprice; ?> </td><td> </td><td> <? echo $r['sitemQTY']; ?> </td><td> <form action='itembuy.php?ID=<? echo $r['itmid']; ?>' name="shopbuy" method='post'> Qty: <input type='text' name='qty' value='1' onkeyup="tot(<? echo $r['itmid']; ?>, <? echo $r['itmbuyprice']; ?>,this.value);" onfocus="clearText(this);" onblur="returnText(this);" /> <input type='hidden' name='shop' value='<? echo $_GET['shop']; ?>' /> <input type='submit' value='Buy' /> </form> <div id="res<? echo $r['itmid']; ?>" align="center"> <? echo $buyprice; ?> </div></td></tr> <? } echo "</table>"; } else { echo "You are trying to access a shop in another city!"; } } else { echo "You are trying to access an invalid shop!"; } } $h->endpage(); ?> That has a little add on aswell, person in forums posted ages back, just a javascript total amount quantifer. SQL alter table shopitems add sitemQTY int(11) not null default '0' CRON: Add to whatever cron you see fit. Id do the day or week cron. $stockreset = rand(100,500); //100 is the minimum it will reset to and 500 is maximum, you can change $db->query("update shopitems set sitemQTY = ".$stockreset." "); And thats it. Post all errors, do not post the same error twice though. (If you use it that is) I will test it all out tomorrow and maybe even add it to my site. Enjoy :-) EDIT: Forgot to add the quantity to the tables when viewing items in shops, oops -
Re: [MCcode V2] attack.php recode I have gangs wars yes, its not necessary for the attack.php file. For the hospitilzing file is the only file that needs gangdata in it. Why, what do you need to have in your attack.php related with gangs? I personally didnt see selecting gangs and orgcrimes of any use seen as OCs are a completely different setup in my game... Just because i have MCcode doesnt mean i have the same setup as you ;) N no worries, maybe you'll come up with some good ideas. I just choose random files and edit.
-
Re: Shops Item Quantity? I might code this tommorow or tonight. :-)
-
Re: [MCcode V2] attack.php recode Selecting Gangs and OCs on my site is irrelevant in the attack file. Ahh okay, thanks for pointing it out ;)
-
Re: [MCcode V2] attack.php recode Spacing error? Care to show what is was? The only "Error" there is-is <table width='50%' vlass='table' align='center'> I typed vlass instead of class. Looks like all you did was change the default locations for your pictures, and if you dont have attack pics, why do you have this still in there? if($odata['attpics']) and another thing, if im not mistaken, MCcode doesnt upload display pictures, just hosts the images via a link therefore having src='display_pic/".$odata['display_pic']."' Well why do you have a folder called display_pic/ when they are externally hosted? And you say You have not touched the table, and its still vlass not class so you didnt do anything there mate accept rename to your picture names i believe?
-
Re: [REVIEW] Dowtown Toronto RPG ~ review Hahaha pretty Ace hey!!! lol +1 to you to.
-
[Any Mccodes] Digital Clock .. Anywebsite
radio_active replied to John99's topic in Free Modifications
Re: [Any Mccodes] Digital Clock .. Anywebsite Yeah, i dunno about you crazy but i cant pull images out of my ass... lol -
Re: How to use sprintf? I would do it like this. $_POST['shopname'] = htmlentities(mysql_real_escape_string(trim($_POST['shopname']))); $_POST['description'] = htmlentities(mysql_real_escape_string(trim($_POST['description']))); $_POST['sl'] = abs(@intval($_POST['sl'])); $buyshop = sprintf ( "INSERT INTO `usershops` (all field names your inserting into here like this, usID,usUSER etc) values ('' , ('%u') , '1' , ('%d'), ('%s') , ('%s'), '0' )", $userid, $_POST['sl'], $_POST['shopname'], $_POST['description'] ); $db->query($buyshop);
-
Re: [MCcode V2] attack.php recode Hence the But yeah, Happy New year all!
-
Re: [MCcode V2] attack.php recode Its merely a code update, only selecting fields that need selecting, maybe it is a bit securer and the code is much nicer all the same. The visual update was just a tiny part, i had your thing installed illusions but the table you made was crap, lol xD So i fixed that.. As for stalemate, i think thats crap, lol... Only thing that would be good would be a attack quantify, x10, x1, x50 etc... Maybe i will do that and post it.. Thanks all the same.
-
Re: [MCcode V2] attack.php recode Add the next bit of code to the bottom of the first piece of code. $mw = $db->query(sprintf("SELECT i.itmid,itmtype,itmname,weapon,armor FROM items i WHERE i.itmid IN( {$ir['equip_primary']}, {$ir['equip_secondary']} )" )); echo "<tr> <td colspan=2 align='center'>Attack with: "; if($db->num_rows($mw) > 0) { while($r=$db->fetch_row($mw)) { if(!$_GET['nextstep']) { $ns=1; } else { $ns=$_GET['nextstep']+2; } if($r['itmid']==$ir['equip_primary']) { echo "[b]Primary Weapon:[/b] "; } if($r['itmid']==$ir['equip_secondary']) { echo "[b]Secondary Weapon:[/b] "; } echo "[url='attack.php?nextstep=$ns&ID={$_GET[']{$r['itmname']}[/url] "; } } else { echo "You have nothing to fight with."; } echo "</table>"; if($ir['attpics']) { $pic = "[img=".$ir[]"; } else { $pic = "[img=generalpictures/defaultitem.jpg]"; } if($odata['attpics']) { $ture = "[img=attpics/".$odata[] "; } else { $ture = "[img=generalpictures/defaultitem.jpg]"; } echo " <table width='50%' vlass='table' align='center'> <tr> <th> {$odata['username']} Health: </th> <th> {$ir['username']} Health: </th> </tr> <tr> <td><img src=greenbar.png width ='".$vars['hpperc']."' height ='10'> <img src=redbar.png width ='".$vars['hpopp']."' height = '10'> {$ture} </td> <td><img src=greenbar.pngwidth='".$vars2['hpperc']."' height = '10'> <img src=redbar.png width='".$vars2['hpopp']."' height= '10'> {$pic} </td> </tr> </table>"; } $h->endpage(); ?> This bit of code here you will have to edit to suit your game if($ir['attpics']) { $pic = "[img=".$ir[]"; } else { $pic = "[img=generalpictures/defaultitem.jpg]"; } if($odata['attpics']) { $ture = "[img=attpics/".$odata[] "; } else { $ture = "[img=generalpictures/defaultitem.jpg]"; } echo " <table width='50%' vlass='table' align='center'> <tr> <th> {$odata['username']} Health: </th> <th> {$ir['username']} Health: </th> </tr> <tr> <td><img src=greenbar.png width ='".$vars['hpperc']."' height ='10'> <img src=redbar.png width ='".$vars['hpopp']."' height = '10'> {$ture} </td> <td><img src=greenbar.pngwidth='".$vars2['hpperc']."' height = '10'> <img src=redbar.png width='".$vars2['hpopp']."' height= '10'> {$pic} </td> </tr> </table>"; Thats at the end of the file. Looks like this. Nothing special but hey, also one more thing is i have made it so users do not lose exp if they run from a fight, this is a personal reason to do with my game. Other then that.. MERRY CHRISTMAS AND A HAPPY NEW YEAR, ALL THE BEST FOR 2009!!!
-
This is my Christmas and New years present to CE and its users. Nothing special, just re-coded the script that Alabama hit posted for Gurpreet in the help section a while back. Enjoy. <?php $menuhide=1; $atkpage=1; include "globals.php"; $_GET['ID'] = (isset($_GET['ID']) AND !ereg('[^0-9]', $_GET['ID'])) ? abs(@intval($_GET['ID'])) : FALSE ; if(!$_GET['ID']) { echo "You havn't selected someone to attack as of yet."; $h->endpage(); exit; } else if($_GET['ID'] == $userid) { echo "Attacking yourself does not work"; $h->endpage(); exit; } else if ($ir['hp'] <= 1) { echo "You do not have enough health to attack yet. [url='index.php']Back Home[/url]"; $h->endpage(); exit; } else if ($_SESSION['attacklost'] == 1) { print "You must have some EXP at least before you begin attacking. [url='index.php']Back[/url]"; $_SESSION['attacklost']=0; $h->endpage(); exit; } //get player data $youdata=$ir; $q = $db->query(sprintf("SELECT u.userid,username,energy,hp,location,hospital,jail,fedjail,gender,attacking,equip_primary,equip_secondary,equip_armor, us.userid,strength,agility,guard,labour,IQ,maxhp FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=('%d')", (int)$_GET['ID'] )); $odata=$db->fetch_row($q); $myabbr=($ir['gender']=="Male") ? "his" : "her"; $oabbr=($ir['gender']=="Male") ? "his" : "her"; if($ir['attacking'] && $ir['attacking'] != $_GET['ID']) { echo "You cant attack more the one person at a time, if you are not attacking anyone else, mail raDiO_acTivE [url='index.php']Back[/url]"; $_SESSION['attacklost']=0; $h->endpage(); exit; } if($odata['hp'] == 1) { echo "This player is unconscious. [url='index.php']> Back[/url]"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query(sprintf("UPDATE users SET attacking = %d WHERE userid = %d",0,$userid)); exit; } else if($odata['hospital']) { echo "This player is in hospital. [url='index.php']> Back[/url]"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query(sprintf("UPDATE users SET attacking = %d WHERE userid = %d",0,$userid)); exit; } //RIGHT HERE I ADD FED JAIL else if($odata['fedjail'] > 0) { echo "Cannot attack users who are in federal jail."; $h->endpage(); exit; } else if($ir['hospital'] && !$odata['hospital']) { echo "You can only attack other users in hospital. [url='hospital.php']> Back[/url]"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query(sprintf("UPDATE users SET attacking = %d WHERE userid = %d",0,$userid)); exit; } else if($odata['jail']) { echo "This player is in jail. [url='index.php']> Back[/url]"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query(sprintf("UPDATE users SET attacking = %d WHERE userid = %d",0,$userid)); exit; } else if($ir['jail']) { echo "While in jail you can't attack. [url='jail.php']> Back[/url]"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query(sprintf("UPDATE users SET attacking = %d WHERE userid = %d",0,$userid)); exit; } else if($odata['ttime']) { echo "That player is travelling. [url='index.php']> Back[/url]"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query(sprintf("UPDATE users SET attacking = %d WHERE userid = %d",0,$userid)); exit; } echo "<table width=100%><tr><td colspan=2 align=center>"; if($_GET['wepid']) { if($_SESSION['attacking']==0 && $ir['attacking'] == 0) { if ($youdata['energy'] >= $youdata['maxenergy']/2) { $youdata['energy']-= floor($youdata['maxenergy']/2); $me = floor($youdata['maxenergy']/2); $db->query(sprintf("UPDATE users SET energy = energy - ('%d') WHERE userid = %d",$me,$userid)); $_SESSION['attacklog']=""; $_SESSION['attackdmg']=0; } else { echo "You can only attack someone when you have 50% energy"; $h->endpage(); exit; } } $_SESSION['attacking']=1; $ir['attacking'] = $odata['userid']; $db->query(sprintf("UPDATE users SET attacking = %d WHERE userid = %d", $ir['attacking'], $userid )); $_GET['wepid'] = (int) $_GET['wepid']; $_GET['nextstep'] = (int) $_GET['nextstep']; //damage if($_GET['wepid'] != $ir['equip_primary'] && $_GET['wepid'] != $ir['equip_secondary']) { print "You do not have that weapon to attack with. [url='index.php']> Home[/url]"; $h->endpage(); exit; } $qo = $db->query(sprintf("SELECT i.itmid,itmtype,itmname,weapon,armor FROM items i WHERE i.itmid=('%d')", $_GET['wepid'] ) ); $r1=$db->fetch_row($qo); $mydamage = (int) (($r1['weapon']*$youdata['strength']/($odata['guard']/1.5))*(rand(8000,12000)/10000)); $hitratio = max(10,min(60*$ir['agility']/$odata['agility'],95)); if(rand(1,100) <= $hitratio ) { $q3 = $db->query(sprintf("SELECT i.armor FROM items i WHERE itmid = %d ORDER BY rand()", $odata['equip_armor'] )); if($db->num_rows($q3)) { $mydamage-=$db->fetch_single($q3); } if($mydamage < -100000) { $mydamage=abs($mydamage); } else if($mydamage < 1) { $mydamage=1; } $crit=rand(1,40); if($crit==17) { $mydamage*=rand(20,40)/10; } else if($crit==25 or $crit == 8) { $mydamage/=(rand(20,40)/10); } $mydamage=round($mydamage); $odata['hp']-=$mydamage; if($odata['hp']==1) { $odata['hp']=0;$mydamage+=1; } $db->query(sprintf("UPDATE users SET hp = hp - ('%d') WHERE userid={$_GET['ID']}", $mydamage, (int)$_GET['ID'] )); echo "<font color=red>{$_GET['nextstep']}. Using your {$r1['itmname']} you hit {$odata['username']} doing $mydamage damage ({$odata['hp']})</font> \n"; $_SESSION['attackdmg']+=$mydamage; $_SESSION['attacklog'].="<font color=red> {$_GET['nextstep']}. Using {$myabbr} {$r1['itmname']} {$ir['username']} hit {$odata['username']} doing $mydamage damage ({$odata['hp']})</font> \n"; } else { echo "<font color=red>{$_GET['nextstep']}. You tried to hit {$odata['username']} but missed ({$odata['hp']})</font> \n"; $_SESSION['attacklog'].="<font color=red> {$_GET['nextstep']}. {$ir['username']} tried to hit {$odata['username']} but missed ({$odata['hp']})</font> \n"; } if($odata['hp'] <= 0) { $odata['hp']=0; $_SESSION['attackwon']=$_GET['ID']; $db->query(sprintf("UPDATE users SET hp = %d WHERE userid = ('%d')", 0, $_GET['ID'] )); echo " [b]What do you want to do with {$odata['username']} now?[/b] <form action='attackwon.php?ID={$_GET['ID']}' method='post'> <input type='submit' value='Mug Them' /> </form> <form action='attackbeat.php?ID={$_GET['ID']}' method='post'> <input type='submit' value='Hospitalize Them' /> </form> <form action='attacktake.php?ID={$_GET['ID']}' method='post'> <input type='submit' value='Leave Them' /> </form>"; } else { //choose opp gun $eq = $db->query("SELECT i.itmid,itmtype,itmname,weapon,armor FROM items i WHERE i.itmid IN ( {$odata['equip_primary']}, {$odata['equip_secondary']} ) "); if(mysql_num_rows($eq) == 0) { $wep="Fists"; $dam=(int)((((int) ( $odata['strength']/$ir['guard']/100)) +1)*(rand(8000,12000)/10000)); } else { $cnt=0; while($r=$db->fetch_row($eq)) { $enweps[]=$r; $cnt++; } $weptouse = rand(0,$cnt-1); $wep = $enweps[$weptouse]['itmname']; $dam =(int) (($enweps[$weptouse]['weapon'] * $odata['strength']/($youdata['guard']/1.5))*(rand(8000,12000)/10000)); } $hitratio=max(10,min(60*$odata['agility']/$ir['agility'],95)); if(rand(1,100) <= $hitratio) { $q3 = $db->query(sprintf("SELECT i.armor FROM items i WHERE itmid = ('%d') ORDER BY rand()", $ir['equip_armor'] )); if($db->num_rows($q3)) { $dam-=$db->fetch_single($q3); } if($dam < -100000) { $dam=abs($dam); } else if($dam < 1) { $dam=1; } $crit=rand(1,40); if($crit==17) { $dam*=rand(20,40)/10; } else if($crit==25 or $crit == 8) { $dam/=(rand(20,40)/10); } $dam=round($dam); $youdata['hp']-=$dam; if ($youdata['hp']==1) { $dam+=1; $youdata['hp']=0; } $db->query(sprintf("UPDATE users SET hp = hp - ('%d') WHERE userid = ('%d')", $dam, $userid )); $ns=$_GET['nextstep']+1; echo "<font color=blue>{$ns}. Using $oabbr $wep {$odata['username']} hit you doing $dam damage ({$youdata['hp']})</font> \n"; $_SESSION['attacklog'].="<font color=blue>{$ns}. Using $oabbr $wep {$odata['username']} hit {$ir['username']} doing $dam damage ({$youdata['hp']})</font> \n"; } else { $ns=$_GET['nextstep']+1; echo "<font color=red>{$ns}. {$odata['username']} tried to hit you but missed ( {$youdata['hp']} ) </font> \n"; $_SESSION['attacklog'].="<font color=blue>{$ns}. {$odata['username']} tried to hit {$ir['username']} but missed ( {$youdata['hp']}) </font> \n"; } if($youdata['hp'] <= 0) { $youdata['hp']=0; $_SESSION['attacklost'] = 1; $db->query(sprintf("UPDATE users SET hp = %d WHERE userid = ('%d')", 0, $_GET['ID'] )); echo "<form action='attacklost.php?ID={$_GET['ID']}' method='post'> <input type='submit' value='Continue' /> </form>"; } } } else if ($odata['hp'] < 5) { echo "You can only attack those who have health"; $h->endpage(); exit; } else if ($ir['gang'] == $odata['gang'] && $ir['gang'] > 0) { echo "You are in the same gang as {$odata['username']}! Your choice from here on in."; } else if ($youdata['energy'] < $youdata['maxenergy']/2) { echo "You can only attack someone when you have 50% energy"; $h->endpage(); exit; } else if ($youdata['location'] != $odata['location']) { echo "You can only attack someone in the same location! <a href = 'monorail.php'>Travel?</a>"; $h->endpage(); exit; } else { } echo "</td></tr>"; if($youdata['hp'] <= 0 || $odata['hp'] <= 0) { echo "</table>"; } else { $vars['hpperc']=round($youdata['hp']/$youdata['maxhp']*100); $vars['hpopp']=100-$vars['hpperc']; $vars2['hpperc']=round($odata['hp']/$odata['maxhp']*100); $vars2['hpopp']=100-$vars2['hpperc']; CONTINUES ON NEXT POST
-
Re: [mccode] Bit of code for staff Apps hahaha, people would be like, errr wtf?
-
[mccode] Small mod (getting back into coding)
radio_active replied to gurpreet's topic in Free Modifications
Re: [mccode] Small mod (getting back into coding) i forgot vb lol only been about a year... Good for you!!! -
Re: [mccode] Bit of code for staff Apps Yeah hence the That was referring to the actual page, it would be more logical to have the die on the actual staff aps page so people click the link and it says "staff applications are currently closed" blah blah... Easy way would be to add a sql to the staff apps db table. then just if it. if($aps['open']==0) { echo"Staff apps closed"; $h->endpage(); exit; } else { then for the admin just have either a case or just a separate file..but case would be easy i suppose.. taking your sql query is something like and using the case and the link Turn on/off staff apps Please note i did that in like 1minute, its very bad. xD
-
[mccode] Small mod (getting back into coding)
radio_active replied to gurpreet's topic in Free Modifications
Re: [mccode] Small mod (getting back into coding) Well its easy to forget, any language whether it be a programming language or a real speaking language such as english, german etc. However to forget entirely how to code means you wouldn't have looked at any scripting for over 2 years, and then again you wouldn't have been an amazing scripter 2 years ago if you forget everything, lol. How old are you? -
Re: [mccode] Bit of code for staff Apps Yeah ideally you can do this with any link you want however Crazy-t, you should make a little admin option to turn them on and off, only takes a few minutes and makes it easier and better.
-
[mccode] Small mod (getting back into coding)
radio_active replied to gurpreet's topic in Free Modifications
Re: Small mod (getting back into coding) I think its more, you trying to learn to code, not again! lol But thats where we all started so keep it up and you might start producing some quality work! Read code that has been posted by the "better" coders such as well, nyna, floydian, luke etc etc and try and familiarize with there style and work on it :wink: -
Re: Staff Functions! I am actually working on a better smenu.php layout as we speak lol its a vertical css dropdown menu... makes it a whole lot better than the original one. I will prolly post it when I get done with it.. I have made that, i have a horizontal drop down menu though.. Admin can view all the panels, secretary can view SEC and ASS panels and assistant only views assisstant... Really nifty xD
-
Re: [REVIEW] Dowtown Toronto RPG ~ review You dont host me. :?
-
Re: [mccode v2] Better Crystal Temple! What the hell Tezza, if your going to edit my posts, going and edit all of these. http://criminalexistence.com/ceforums/index.php?topic=20634.30
-
[mccodes v2] Combined Gallery and Comment System [$40.00]
radio_active replied to Magictallguy's topic in Paid Modifications
Re: [mccodes v2] Combined Gallery and Comment System [$40.00] Not necessarily, its who you sell to... I buy scripts off people and there is no way i would give them away. Means im paying for there benefit also, i dont like the benefit of others for my money! lol... If you only sell to those who are mature or you believe to be and or you know them well, it will not be distributed, as far as im concerned, i know many of say floydians scripts, i havn't seen any of his on another game which have not been paid for! :-)