Jump to content
  • 0
Sign in to follow this  
luizragna

OnPCLogoutEvent:

Question

Hello guys, I have the following problem:
When the character disconnects it should lose the buff exp bonus, but for some reason, when I enter the game buff continues
 

-    script    Bonus EXP#Lose  -1,{
 
OnPCLogoutEvent:
 
set online,0;
sc_end SC_EXPBOOST;
end;
 
}

 

 

I put the script in an npc and it worked, but with OnPCLogoutEvent system not worked

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Im not sure if OnPCLogoutEvent triggers the character that is going out the game.....
Myabe your problem is cause the script have not a RID attached to it and cause that works on NPC, cause a NPC Triggers a RID on talking with it.

 

I would recommend use ONPcLoginEvent

 

Whetever, the solution should be using attachrid Script command

or wth doevent "<NPC object name>::<event label>"; 


 

Share this post


Link to post
Share on other sites
  • 0

I have a NPC equal to yours and even with some more functions.

The NPC I created saves the time of Buff XP and checks when the player replays to see if there is still some time left for the Buff or it should be deleted.

This avoids leaving the Buff time paralyzed when the player moves, as if time continues to roll.
 

NPC: Buff Exp

-	script	Check_Buff_Bonus_XP	-1,{

OnPCLogoutEvent:
if (getstatus(SC_CASH_PLUSEXP,0) == 1)
	set BuffXP_Tempo, gettimetick(2);
end;

OnPCLoginEvent:
if (getstatus(SC_CASH_PLUSEXP,0) == 1) {
	set .@tempo, gettimetick(2)-BuffXP_Tempo;
	set .@tempo2,.@tempo*1000;
	if (.@tempo2 >= getstatus(SC_CASH_PLUSEXP,5)) {
		sc_end SC_CASH_PLUSEXP;
		end;
	}
	else {
		set .@rate, getstatus(SC_CASH_PLUSEXP,1);
		set .@temposet, getstatus(SC_CASH_PLUSEXP,5)-.@tempo2;
		sc_end SC_CASH_PLUSEXP;
		sc_start4 SC_CASH_PLUSEXP,.@temposet,.@rate,0,0,0;
		end;
	}
}
}

 

NPC: Buff Drop

-	script	Check_Buff_Bonus_Drop	-1,{


OnPCLogoutEvent:
if (getstatus(SC_CASH_RECEIVEITEM,0) == 1)
	set BuffDrop_Tempo, gettimetick(2);
end;

OnPCLoginEvent:
if (getstatus(SC_CASH_RECEIVEITEM,0) == 1) {
	set .@tempo, gettimetick(2)-BuffDrop_Tempo;
	set .@tempo2,.@tempo*1000;
	if (.@tempo2 >= getstatus(SC_CASH_RECEIVEITEM,5)) {
		sc_end SC_CASH_RECEIVEITEM;
		end;
	}
	else {
		set .@rate, getstatus(SC_CASH_RECEIVEITEM,1);
		set .@temposet, getstatus(SC_CASH_RECEIVEITEM,5)-.@tempo2;
		sc_end SC_CASH_RECEIVEITEM;
		sc_start4 SC_CASH_RECEIVEITEM,.@temposet,.@rate,0,0,0;
		end;
	}
}
}

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.