Why don't use the OnPCLoginEvent?
Like:
- script DonateExchange FAKE_NPC,{
end;
OnPCLoginEvent:
set @dCreds,query_sql("SELECT `balance` FROM cp_credits WHERE `account_id` = "+getcharid(3)+";",.@dCreds);
if(!.@dCreds) {
end;
}
set #CASHPOINTS,#CASHPOINTS+.@dCreds;
.@dCreds = 0;
query_sql("UPDATE `cp_credits` SET `balance` = "+.@dCreds+" WHERE account_id = "+getcharid(3)+";");
dispbottom "Credis were converted into Cashpoints ["+ #CASHPOINTS +"].";
end;