• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved Missing sql query ingame store

God Mythera

Veteran OT User
Joined
Aug 11, 2012
Messages
2,051
Solutions
2
Reaction score
260
Location
United States
So when a player trys to use a item that gives 'coins' to there account, it shows no errors.

Script
Code:
local function doPlayerAddPremiumPoints(cid, count)
        db.query('UPDATE accounts SET coins = coins+'.. count ..' WHERE id = ' .. getAccountNumberByPlayerName(getCreatureName(cid)))
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    doPlayerAddPremiumPoints(cid, 25)
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have recived 25 coins to your account.")
    doSendMagicEffect(getCreaturePosition(cid), 28)
    doRemoveItem(item.uid,1)
    return true
end

When i try to transfer coins
MvRld7O.png
 
Last edited:
If I got you right, you're linking a false-free script and then trying to do some association with transferring coins? This means that you're giving us a picture of an error without any code provided with it. Also, there's no conjunction between those two queries that are being used.
 
If I got you right, you're linking a false-free script and then trying to do some association with transferring coins? This means that you're giving us a picture of an error without any code provided with it. Also, there's no conjunction between those two queries that are being used.
If you read correctly i said that the script to add coins doesn't work, and that when i try to transfer coins i get the error that is in the image.

edit: So i stated that the script was to add coins, but doesn't add coins. And the error is for trying to transfer coins.
 
Well it is half fixed, no errors but doesnt add the coins...

Code:
CREATE TABLE IF NOT EXISTS `store_history` (
   `account_id` int(11) NOT NULL,
   `mode` smallint(2) NOT NULL DEFAULT '0',
   `description` VARCHAR(3500) NOT NULL,
   `coin_amount` int(12) NOT NULL,
   `time` bigint(20) unsigned NOT NULL,
   KEY `account_id` (`account_id`),
   FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB;
 
Are you sure this is the right script? Are you getting the following message: You have recived 25 coins to your account.?
 
Then something else is happening after running the script, and the code responsible is located outside the script. Can you search your scripts for the following string?
Code:
INSERT INTO `store_history`
 
Then something else is happening after running the script, and the code responsible is located outside the script. Can you search your scripts for the following string?
Code:
INSERT INTO `store_history`
Code:
return db.asyncQuery(string.format("INSERT INTO `store_history`(`account_id`, `mode`, `description`, `coin_amount`, `time`) VALUES (%s, %s, %s, %s, %s)", accountId, mode, db.escapeString(description), amount, os.time()))
 
Code:
CREATE TABLE IF NOT EXISTS `store_history` (
  `account_id` int(11) NOT NULL,
  `mode` smallint(2) NOT NULL DEFAULT '0',
  `description` varchar(3500) NOT NULL,
  `coin_amount` int(12) NOT NULL,
  `time` bigint(20) unsigned NOT NULL,
  KEY `account_id` (`account_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Code:
ALTER TABLE `accounts` ADD `coins` INT(11) NOT NULL DEFAULT '0' AFTER `premdays`;
 
Back
Top