
Originally Posted by
whopps
Hey..
:gift
Does anyone remember on openhotel the :gift command which would give you a gift containing a random furni ID..that could be any id from the database?
source: Dissi's edit
Here, this should do it.
PHP Code:
case "gift": // Warps the virtual user to a certain X,Y coordinate
{
int TID;
using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
{
dbClient.addParameterWithValue("userid", userID);
if (dbClient.findsResult("SELECT id FROM users WHERE id = @userid AND gifted = 0"))
return; // Already used :gift
TID = dbClient.getInteger("SELECT tid FROM catalogue_items ORDER BY RAND() LIMIT 1");
dbClient.runQuery("UPDATE users SET gifted = 1 WHERE id = @userid");
}
catalogueManager.handlePurchase(TID, userID, 0, "", 0, 0);
break;
}
Execute this query
Code:
ALTER TABLE `users` ADD `gifted` TINYINT NOT NULL DEFAULT '0'