View Full Version : [SOLVED] On_login player script

01-25-2014, 01:03 AM
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..

#include "ScriptPCH.h"

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

void OnLogin(Player* player)
player->CastSpell(player, 20707);


void AddSC_PlayerScripts()
new on_login();

01-25-2014, 01:10 AM
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.

01-25-2014, 01:19 AM
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?

01-25-2014, 10:13 AM
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.

01-25-2014, 06:20 PM
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