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

[SOLVED] On_login player script

Status
Not open for further replies.

Reloac

BETA Tester
Since i couldn't get the right click teleporter to resurrect, i made a new spell that works as the actual teleporter would have, but ofcourse needed to make it give the player it when they logon, it works (nearly) as intended but has a problem with the spell, it casts it... but continues to cast it over and over on repeat, and wont stop, I don't know if I coded it incorrectly but..

Code:
#include "ScriptPCH.h"

class on_login : public PlayerScript
{
public:
	on_login() : PlayerScript("on_login") {}

	void OnLogin(Player* player)
	{
		player->SaveToDB(false);
	        player->CastSpell(player, 20707);
	
	}
};

void AddSC_PlayerScripts()
{
	new on_login();
}
 

Tommy

Founder
What do you mean it casts it over and over again? The OnLogin hook only ticks when the player logs in. :/

Don't see how it spams.
 

Reloac

BETA Tester
Removed the cast time on 20707 (and the duration) but logging in to any character currently, it continues to cast the spell over and over, you can move and it continues to cast doing anything, as far as i can tell its done correctly but maybe i used the wrong function to make them cast?
 

Rochet2

Moderator / Eluna Dev
Why are you saving the player on login?..

The spell is not spammed for me.
I use default TC with eluna and your script exact copy.

If you made some edits elsewhere, the mistake must be in those.
 

Reloac

BETA Tester
Yeah, I worked out what was wrong with it, someone added the line to player::update to test if it worked and never removed it so ofcourse, it spammed it.. making me think it was this script all is working fine.

and the save thing was just because I was going to add a currency to them on login every 12 hours but decided against it and never removed it, its not there now :p
 
Status
Not open for further replies.
Top