Scripting Help - TC 4.3.4 menu

User Tag List

Results 1 to 2 of 2
  1. #1
    roifok's Avatar Member
    Reputation
    4
    Join Date
    Aug 2008
    Posts
    100
    Thanks G/R
    43/2
    Trade Feedback
    11 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Scripting Help - TC 4.3.4

    Hi everybody !

    I'm making a donation point system linked between the emu and the cms.

    When a player buy some donation points on the website, these donation points are stored in a sql table.

    I want these donation points to go to the player bag on login. So i started wrote this :

    Code:
    // Add Donation Points
    		QueryResult pts = LoginDatabase.PQuery("SELECT `dp` FROM account_data WHERE id = '%u'", pCurrChar->GetSession()->GetAccountId());
    		Field* fields = pts->Fetch();
            uint32 dp = fields[0].GetUInt32();
    		if (dp == 0)
                {
    				pCurrChar->GetSession()->SendAreaTriggerMessage("");
                }
            else
                {
    				pCurrChar->AddItem(999910,dp);
    				QueryResult pts2 = LoginDatabase.PQuery("UPDATE account_data SET `dp`= 0 WHERE id ='%u'", pCurrChar->GetSession()->GetAccountId());
    				Field* fields = pts2->Fetch();
    			}
    This part of code is include in CharacterHandler.cpp and it works like a charm.

    My problem is here : I want these donation points to go in bag of any characters on the same account.

    Explaination : I'm login in. I got in my bag 5 donation points. If i log out these 5 donation points stay in the character's bag.

    I was asking my self about a solution, so i wrote this :

    Code:
    //Remove Donation Points 	
    	if (GetPlayer()->GetCurrency(999910,true))		
    	{
    		QueryResult rmvpts = LoginDatabase.PQuery("UPDATE account_data SET `dp`= '%u'", GetPlayer()->GetItemCount(999910,true), "WHERE id ='%u'", GetPlayer()->GetSession()->GetAccountId());
    		Field* fields = rmvpts->Fetch();
            uint32 dp = fields[0].GetUInt32();
    		GetPlayer()->RemoveMItem(999910);
    	}
    This code, on log out, should check if the current character have some Donation Point (999910) and if the player has, it should get the amount of donation points and update this amount in the account table.

    Unfortunately this part doesn't work, worldserver crash when trying to log out and all accounts are credited with the amount of donation point in the player bag..
    That's the reason why i'm asking to this great community to help me about this shity problem !

    Apologize for my bad english. Thank you all.

    Scripting Help - TC 4.3.4
  2. #2
    choweyiii's Avatar Contributor
    Reputation
    91
    Join Date
    Aug 2010
    Posts
    127
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You may have some success using a server hook, but I've never done anything like this.

    Code:
    RegisterServerHook(4, "OnEnterWorld_Hook_Donation")

Similar Threads

  1. Lua script help and general questions from beginner
    By WinKIller0 in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 02-23-2008, 04:38 AM
  2. LUA Boss Script Help
    By neurothymia in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 02-05-2008, 02:57 PM
  3. Need LUA Scripting Help ?
    By Snailz in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 02-04-2008, 12:36 PM
  4. Scripting help please will +rep need for a new server
    By runiker in forum WoW EMU Guides & Tutorials
    Replies: 0
    Last Post: 01-22-2008, 04:05 AM
  5. [Ascent] Boss Scripts help
    By n0t5ew in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 12-24-2007, 03:04 PM
All times are GMT -5. The time now is 10:57 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search