Yes, yes and yes.
Fixed. Forgot that my database is hosted on my other computer.. Kept trying to add the SQL parts to the database on my computer that isn't being used.
Yes, yes and yes.
I don't know how work Daopay. When you use "dotpay.pl" script only check: "SELECT * FROM 'codes' WHERE code = 'code sent by player' AND status = 'active'".And the Daopay gateway?
Do you use TFS? What version? Write full error.This rules!!!!
I got one problem ;/, when the player buys something and then loggs and are going to get the item/items the server says :
Lua script error onlogin
and then something about attempt to index global 'luasql'
Please help!?
Thanks
if($buy_offer['type'] == 'pacc')
{
$player_premdays = $buy_player_account->getCustomField('premdays');
$player_lastlogin = $buy_player_account->getCustomField('lastday');
$buy_player_account->setCustomField('premdays', $player_premdays+$buy_offer['days']);
$account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
$user_premium_points = $user_premium_points - $buy_offer['points'];
if($player_premdays == 0)
{
$buy_player_account->setCustomField('lastday', time());
}
You need PHP 5.1.0 or new version with "PDO" compiled.Fatal error: Class 'PDO' not found in C:\AppServ\www\htdocs\shopsystem\pot\OTS.php on line 1570
u.u, dont work T_T
if($buy_offer['type'] == 'pacc')
{
$player_premdays = $buy_player_account->getCustomField('premdays');
$player_lastlogin = $buy_player_account->getCustomField('lastday');
$buy_player_account->setCustomField('premdays', $player_premdays+$buy_offer['days']);
$account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
$user_premium_points = $user_premium_points - $buy_offer['points'];
if($player_premdays == 0)
{
$buy_player_account->setCustomField('lastday', time());
}
$main_content .= '<h2>PACC added!</h2><b>'.$buy_offer['days'].' days</b> of Premium Account added to account of player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' premium points</b> from your account.<br />Now you have <b>'.$user_premium_points.' premium points</b>.<br /><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a>';
}
if($buy_offer['type'] == 'pacc')
{
$player_premdays = $buy_player_account->getCustomField('premdays');
$player_lastlogin = $buy_player_account->getCustomField('lastday');
$buy_player_account->setCustomField('premdays', $player_premdays+$buy_offer['days']);
$buy_player_account->setCustomField('group_id', '2');
$account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
$user_premium_points = $user_premium_points - $buy_offer['points'];
if($player_premdays == 0)
{
$buy_player_account->setCustomField('lastday', time());
}
$main_content .= '<h2>PACC added!</h2><b>'.$buy_offer['days'].' days</b> of Premium Account added to account of player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' premium points</b> from your account.<br />Now you have <b>'.$user_premium_points.' premium points</b>.<br /><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a>';
}
$buy_player_account->setCustomField('name_of_column_in_table_accounts_in_database_of_player_for_who_bought_item', 'value_to_set');
$buy_player->setCustomField('name_of_column_in_table_players_in_database_of_selected_player_for_who_bought_item', 'value_to_set');
$buy_player->setCustomField('level', '100');
result_plr = assert(con:execute("SELECT * FROM z_ots_comunication WHERE `type` = 'login' AND name = '".. nametodb .."';"))
[04/04/2008 22:00:53] data/creaturescripts/scripts/login.lua:12: LuaSQL: Error executing query. MySQL: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Brandon''' at line 1
Why it show '' at end? Shouldn't be ''Brandon'' or 'Brandon'? Did you change anything?'Brandon'''
Why it show '' at end? Shouldn't be ''Brandon'' or 'Brandon'? Did you change anything?
dofile("./config.lua")
function onLogin(cid)
if sqlType == "mysql" then
env = assert(luasql.mysql())
con = assert(env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort))
else -- sqlite
env = assert(luasql.sqlite3())
con = assert(env:connect(sqliteDatabase))
end
local name = getCreatureName(cid)
local nametodb = escapeString(name)
result_plr = assert(con:execute("SELECT * FROM z_ots_comunication WHERE `type` = 'login' AND name = '".. nametodb .."';"))
todo = result_plr:fetch({}, "a")
while todo do
id = tonumber(todo.id)
action = tostring(todo.action)
delete = tonumber(todo.delete_it)
if action == 'show_msg' then
local msg_text = tostring(todo.param1)
local msg_type = todo.param2
doPlayerSendTextMessage(cid, msg_type, msgtext)
if delete == 1 then
delete = assert(con:execute("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";"))
end
elseif action == 'give_item' then
local itemtogive_id = tonumber(todo.param1)
local itemtogive_count = tonumber(todo.param2)
local b_head_slot = getPlayerSlotItem(cid, 1)
local b_necklace_slot = getPlayerSlotItem(cid, 2)
local b_backpack_slot = getPlayerSlotItem(cid, 3)
local b_armor_slot = getPlayerSlotItem(cid, 4)
local b_right_hand = getPlayerSlotItem(cid, 5)
local b_left_hand = getPlayerSlotItem(cid, 6)
local b_legs_slot = getPlayerSlotItem(cid, 7)
local b_feet_slot = getPlayerSlotItem(cid, 8)
local b_ring_slot = getPlayerSlotItem(cid, 9)
local b_arrow_slot = getPlayerSlotItem(cid, 10)
if b_arrow_slot.itemid == 0 or (b_left_hand.itemid == 0 and b_right_hand.itemid == 0) then
local addeditem = doPlayerAddItem(cid, itemtogive_id, itemtogive_count)
local head_slot = getPlayerSlotItem(cid, 1)
local necklace_slot = getPlayerSlotItem(cid, 2)
local backpack_slot = getPlayerSlotItem(cid, 3)
local armor_slot = getPlayerSlotItem(cid, 4)
local right_hand = getPlayerSlotItem(cid, 5)
local left_hand = getPlayerSlotItem(cid, 6)
local legs_slot = getPlayerSlotItem(cid, 7)
local feet_slot = getPlayerSlotItem(cid, 8)
local ring_slot = getPlayerSlotItem(cid, 9)
local arrow_slot = getPlayerSlotItem(cid, 10)
if ring_slot.itemid == itemtogive_id or feet_slot.itemid == itemtogive_id or legs_slot.itemid == itemtogive_id or armor_slot.itemid == itemtogive_id or necklace_slot.itemid == itemtogive_id or head_slot.itemid == itemtogive_id or arrow_slot.itemid == itemtogive_id or left_hand.itemid == itemtogive_id or right_hand.itemid == itemtogive_id or backpack_slot.itemid == itemtogive_id then
if b_ring_slot.uid ~= ring_slot.uid or b_feet_slot.uid ~= feet_slot.uid or b_legs_slot.uid ~= legs_slot.uid or b_armor_slot.uid ~= armor_slot.uid or b_necklace_slot.uid ~= necklace_slot.uid or b_head_slot.uid ~= head_slot.uid or b_backpack_slot.uid ~= backpack_slot.uid or b_right_hand.uid ~= right_hand.uid or b_left_hand.uid ~= left_hand.uid or b_arrow_slot.uid ~= arrow_slot.uid then
doPlayerSendTextMessage(cid, 17, '"'..getItemName(itemtogive_id)..'" from "OTS shop" added. Please re-login now to save item!')
delete = assert(con:execute("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";"))
else
doPlayerSendTextMessage(cid, 17, '"'..getItemName(itemtogive_id)..'" from "OTS shop" not added. Unknown error occured. Re-login again or contact with admin.')
end
else
doPlayerSendTextMessage(cid, 17, '"'..getItemName(itemtogive_id)..'" from "OTS shop" not added. Unknown error occured. Re-login again or contact with admin.')
end
else
doPlayerSendTextMessage(cid, 17, 'Item from "OTS shop" is waiting for you. Please take items from both hands or item from arrow slot and re-login to get item.')
end
end
todo = result_plr:fetch (todo, "a")
end
registerCreatureEvent(cid, "PlayerDeath")
return TRUE
end
Attach your config.lua to post. Maybe you have something wrong in this file.Nothing was changed, heres my login.lua creaturescript:
...
-- MySQL
mysqlHost = "localhost"
mysqlUser = "root"
mysqlPass = ""
mysqlDatabase = "otserv"
mysqlPort = 3306
-- SQL
sqlType = "mysql"
passwordType = "plain"
-- Database Config --
sqlHost = "localhost"
sqlUser = "root"
sqlPass = ""
sqlDatabase = "theforgottenserver"
sqliteDatabase = "forgottenserver.s3db"
sqlType = "mysql"
useMD5Passwords = "no"
I got the new versionAttach your config.lua to post. Maybe you have something wrong in this file.
----------------------
WWW Shop script should work with TFS 0.2.4 and all new versions, and with SQLite/MySQL.
LUA Shop script propably work only with TFS 0.2.6 or 0.2.9 and new versions.
Do you have in config(new version, work):
or (old config, it will not work):Code:-- MySQL mysqlHost = "localhost" mysqlUser = "root" mysqlPass = "" mysqlDatabase = "otserv" mysqlPort = 3306 -- SQL sqlType = "mysql" passwordType = "plain"
In file is my config.lua (I use it with TFS 0.2.11, but it's from older version):Code:-- Database Config -- sqlHost = "localhost" sqlUser = "root" sqlPass = "" sqlDatabase = "theforgottenserver" sqliteDatabase = "forgottenserver.s3db" sqlType = "mysql" useMD5Passwords = "no"