• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

Simple script for char creat actions

darksoke

OnTop500
ok just figured out how this thing is working and is better than changing your playercrateinfo tables no pain in the ass :)

Code:
[COLOR="#F0FFFF"]
class playertp : public PlayerScript
{
	public:
    playertp() : PlayerScript("playertp") { }
	uint64 playerGUID;
	void OnCreate(Player* player) 
	{
		playerGUID = player->GetGUID();
	}
	void OnLogin(Player* player)
	{
		if (playerGUID == player->GetGUID())
		{
		    //Give items to player
		    //player->AddItem(your_item_id, 1);
		    //player->AddItem(your_item_id, 1);
		    //player->AddItem(your_item_id, 1);
		    //player->AddItem(your_item_id, 1);
		    //player->AddItem(your_item_id, 1);
		    //player->AddItem(your_item_id, 1);
		   //player->AddItem(your_item_id, 1);
			
			//Teleport player to specific location
			//player->TeleportTo(map_id, x, y, z, orientation);
			//player->TeleportTo(1, 4614.016602, -3857.074707, 944.145386, 1.041835);
			
		}
	}
	
};

void AddSC_playertp()
{
    new playertp();
} [/COLOR]

to make it work just remove "//" or add your own events
well hope you like it , you can use it however you want jos't don't repost it in other forums , thank you
 
Last edited:

Laurea

Enthusiast
There are two glaring errors with this script, and I'm more than a little surprised you didn't notice them:
1.) If several characters are created before any of them logs in, the script will only execute for the last one created.
2.) You can claim the reward multiple times by simply relogging, up until somebody else creates a character.
 

Tommy

Founder
You also don't need to include "ScriptPCH.h." I don't know how many times I've mentioned that already. To be honest, it is whole lot better to actually do this in the table. Why is it so difficult for you to put the items in via playercreateinfo_item table? It depletes the purpose to have a script since it is already an easy setup.

Despite what Laurea mentioned, thanks for your attempt and share. You should get the logic fixed before people start using it. :p
 

darksoke

OnTop500
1) well it's a extremly low chance for 2 chars to be created at the same time
2) player won't get duplaicated items since there is a GUID check
3) Tommy well as i already said i stoped working with wow for almost an year and half and i forgot that :|

i already tested it and it work ,btw editing the table gave me like 100 errors when created a new char 0.o something with duplicated race/class 0.o
 

Tommy

Founder
1) well it's a extremly low chance for 2 chars to be created at the same time
2) player won't get duplaicated items since there is a GUID check

The point is that, for public servers, there is a very high chance of it messing up. You might have a GUID check in, but the logic is if someone creates a character at the same time, one of those players won't receive their items because the variable changes its value. Also, it depends on which player can login faster too, I would think. I'd suggest doing what Rochet2 suggested in your support thread. :conflicted:
 
Top