orsino Posted January 18, 2013 Share Posted January 18, 2013 i am working on adding some crimes in the effect code i have this $userStats["!Currency"]->value+=rand(2000,5000); ResultMessage("You stole the money."); here i would like that the resultmessage says how much it really added like you stole 3120 money Quote Link to comment Share on other sites More sharing options...
a_bertrand Posted January 18, 2013 Share Posted January 18, 2013 That should do the trick: $v=rand(2000,5000); $userStats["!Currency"]->value+=$v; ResultMessage(Translate("You stole %d !Currency.",$v),false); Quote Link to comment Share on other sites More sharing options...
orsino Posted January 18, 2013 Author Share Posted January 18, 2013 yes this worked thx alot Quote Link to comment Share on other sites More sharing options...
orsino Posted January 22, 2013 Author Share Posted January 22, 2013 is this possible with items ?? like: you stole a itemname and its taking a item from id 1 to 10 Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted January 23, 2013 Share Posted January 23, 2013 I dont see why it wouldnt. You just set the variable like the above sample is $v=rand (2000, 5000); So in this case it would be something like: $item=rand(1, 10); $result=$db->LoadData("select itemname from items where itemid = ?", $item); /*here is where you would put your success code*/ ResultMessage(Translate("You stole %s.",$result['itemname']),false); Couple discalimers: 1. Now im still learning nwe and dont really know table and column names yet so be sure they are right. 2. Im not great at sprintf or printf or whatever you may call but I think the %s is the right one to use. 3. Also last I heard you can call out your queries by column name now but if not I believe $result->fields[0] will work if $result['itemname'] fails. 4. This isnt tested but you should get the gist of it cause in theory it should work but im sure somone may chime in and show a better, faster, more elaborate way to do so Quote Link to comment Share on other sites More sharing options...
a_bertrand Posted January 23, 2013 Share Posted January 23, 2013 Well... the right code for it would be more like: $item=Item::GetObjectInfo(rand(1, 10)); Item::InventoryAdd($item->id,1); ResultMessage(Translate("You stole %s.",$item->name),false); Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted January 23, 2013 Share Posted January 23, 2013 Ahh go figure figure. I forgot you had items all sorted out like that Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.