Sending everyone 1 item?

Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    MC Web Designs Matt Clarke is offline
    MemberRank
    Oct 2010 Join Date
    UKLocation
    933Posts

    Sending everyone 1 item?

    Hi guys, on my server today something sprung to mind.

    How would I send an item, say Fireworks to every character on the server.

    I just want to know how I would go about doing that sort of thing, maybe it is in the Lua functions in-game? Or maybe its to do with the database? I don't know.

    If someone has the Answers please let me know.

    Thanks a lot guys! :D


  2. #2
    MC Web Designs Matt Clarke is offline
    MemberRank
    Oct 2010 Join Date
    UKLocation
    933Posts

    Re: Sending everyone 1 item?

    ~ Bump.

  3. #3
    Trust your senses Gravious is offline
    MemberRank
    Sep 2009 Join Date
    NetherlandsLocation
    713Posts
    ITEM_SEND_TBL I think? Look into a vote system and just write a query for it.

  4. #4
    Flyff Developer ShadowDragon is offline
    MemberRank
    Apr 2009 Join Date
    1,916Posts

    Re: Sending everyone 1 item?

    He wants to send items to players that are currently online. ITEM_SEND_TBL requires a relog for them to recieve it.

  5. #5
    MC Web Designs Matt Clarke is offline
    MemberRank
    Oct 2010 Join Date
    UKLocation
    933Posts

    Re: Sending everyone 1 item?

    Yeah, I need it so that the players receive the item in-game when they are online. Just for an Example a Firework to celebrate an event.

  6. #6
    Valued Member Objected is offline
    MemberRank
    Jun 2012 Join Date
    115Posts

    Re: Sending everyone 1 item?

    Look at spikenbror's BillingAPI. Make it work to whatever you want to do it with.

    From the top of my head:

    PHP Code:
    <?php
    // Include the API.
    include("./api/procedural.php");

    // Create a connection to MsSQL and select the character database.
    $mssql_socket mssql_connect("SQL Server""Username""Password"false);
    mssql_select_db("CHARACTER_01_DBF"$mssql_socket);

    // Create an array of items.
    $adbill_objects = array();

    //Get MsSQL account names of who's online
    //Send an item to every character on account(If no other way to figure out /which/ character is on)?
    //run a while() and insert a new element for each PLAYER ID
    //$adbill_objects[] = billing_create_item(01, {PLAYER_ID}, {ITEM_ID}, {Quantity});

    // Send items.
    billing_send_items("127.0.0.1"$mssql_socket$adbill_objects);

    // Close MsSQL connection.
    mssql_close($mssql_socket);
    ?>

  7. #7
    Flyff Developer ShadowDragon is offline
    MemberRank
    Apr 2009 Join Date
    1,916Posts

    Re: Sending everyone 1 item?

    He was asking about a way to do it in-game. That would certainly work, but it would require accessing a website control panel or something

  8. #8
    0xC0FFEE spikensbror is offline
    MemberRank
    Dec 2006 Join Date
    SwedenLocation
    1,855Posts

    Re: Sending everyone 1 item?

    If he wants to do it in-game, make a command like /allci or something that can create an item for all characters currently online, then make the command iterate the player pool and add item to each player.

  9. #9
    Flyff Developer ShadowDragon is offline
    MemberRank
    Apr 2009 Join Date
    1,916Posts

    Re: Sending everyone 1 item?

    That's a good idea, but unless you have some C++ knowledge, not really possible. I've done so to create a GM's online command, usable in-game. But I had to make a new function in order to iterate through the online players.

  10. #10
    MC Web Designs Matt Clarke is offline
    MemberRank
    Oct 2010 Join Date
    UKLocation
    933Posts

    Re: Sending everyone 1 item?

    Thanks for the reply's guys. I dont mind it being web-based or Client based just as long as I can do it haha. I've taken a look at spikens API and I'll see what I can do with it and see if it works.

    Thanks again guys.

  11. #11
    [R8]ℓσℓ32 caja is offline
    MemberRank
    Oct 2008 Join Date
    Here!Location
    1,502Posts

    Re: Sending everyone 1 item?

    This may work

    Code:
    BOOL TextCmd_CreateItemToAll( CScanner& scanner )
    {
    #ifdef __WORLDSERVER
    	map<DWORD, CUser*>::iterator it;
    
    	for(it = players.begin(); it != players.end; ++it)
    	{
    		DWORD dwNum;
    		DWORD dwCharged		= 0;
    		ItemProp* pProp	= NULL;
    
    		if( scanner.tokenType == NUMBER )
    			pProp	= prj.GetItemProp( _ttoi( scanner.Token ) );
    		else
    			pProp	= prj.GetItemProp( scanner.Token );
    
    		if( pProp && pProp->dwItemKind3 != IK3_VIRTUAL )
    		{
    			if( pProp->dwItemKind3 == IK3_EGG && pProp->dwID != II_PET_EGG )	// ¸®¾îÆêÀ» »ý¼ºÇÏ·Á°í ÇÒ °æ¿ì "¾Ë"ÀÎ °æ¿ì¸¸ »ý¼º °¡´ÉÇÏ´Ù.
    				return TRUE;
    
    			dwNum	= scanner.GetNumber();
    			dwNum	= ( dwNum == 0? 1: dwNum );
    			dwCharged	= scanner.GetNumber();
    			dwCharged	= ( dwCharged == 0 ? 0 : 1 );
    			
    			CItemElem itemElem;
    			itemElem.m_dwItemId		= pProp->dwID;
    			itemElem.m_nItemNum		= (short)( dwNum );
    			itemElem.m_nHitPoint	= -1;
    			itemElem.m_bCharged		= dwCharged;
    
    			it->second->CreateItem( &itemElem );
    		}
    	}
    #endif // __WORLDSERVER
    	return TRUE;
    }

  12. #12
    Game Developer MisterKid is offline
    MemberRank
    Jun 2009 Join Date
    1,585Posts

    Re: Sending everyone 1 item?

    Here php based on the billing api.
    Suggest you run this localhost(on the server!) and make it unaccesable by everyone but you.
    Ofcourse i used this for other perpuses hehe :P
    PHP Code:
    <?php
    $Server_IP 
    '127.0.0.1';//IP
    $m_idPlayer = (INT)000000;//player id start
    $ItemID 26456;//Item id
    $ItemCnt 99;//item count
    $MaxPlayerId 100000

    for(
    $i 0$i $MaxPlayerId $i ++)
    {
        
    $m_idPlayer ++;
        
    $socket socket_create(AF_INETSOCK_STREAMSOL_TCP);
        
        
    $packet pack("VVVVV"01$m_idPlayer0$ItemID$ItemCnt) . str_pad("IIIIIIIIIIIIIIIIIIIIII"21' ') . pack("V"1);
        if(
    socket_connect($socket$Server_IP29000))
        {
            
    socket_write($socket$packetstrlen($packet));
            }
        
    socket_close($socket);
    }
    ?>
    Credits to yannickmamma for the base tough(I think it was him)

  13. #13
    Flyff Developer ShadowDragon is offline
    MemberRank
    Apr 2009 Join Date
    1,916Posts

    Re: Sending everyone 1 item?

    Lol, MisterKid, that PHP script is very inefficient. Just do a quick CHARACTER_TBL query to retrieve all m_idPlayer values for people who have a MultiServer value that is not 0.

  14. #14
    Game Developer MisterKid is offline
    MemberRank
    Jun 2009 Join Date
    1,585Posts

    Re: Sending everyone 1 item?

    But what if you don't have acces to sql?:P I just copy pasted it quick and removed the ip xD
    But yea what ShadowDragon42 said get all the id's from the database.

  15. #15
    MC Web Designs Matt Clarke is offline
    MemberRank
    Oct 2010 Join Date
    UKLocation
    933Posts

    Re: Sending everyone 1 item?

    Alright guys, thanks for all your help, going to try them all out.

    One thing I would say, would there be a way to do it using the Event files in the Resource, but not restarting the server each time I update it?

    Thanks again guys.



Page 1 of 2 12 LastLast

Advertisement