Jump to content
  • 0

Script ontimer not work Help me?


XeroBall

Question


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  19
  • Reputation:   0
  • Joined:  12/18/11
  • Last Seen:  

 

- script TMPAY  -1,{

OnTimer5000:

 query_sql "SELECT `card_id`,`amount`,`user_id` FROM `truemoney` WHERE `status` = 1 ORDER BY RAND()",.card_id,.card_amount,.card_account_id;

 sleep2 500;

 if (getarraysize(.card_id) > 0) {

  for (set .i,0; .i < getarraysize(.card_id); set .i,.i+1) {

   if(.card_amount[.i] > 0 && attachrid(.card_account_id[.i]) == 1)

   {

    dispbottom "[Refill Center System] คุณได้รับ " + .card_cash_amount[.card_amount[.i]] + " Cash";

    set #CASHPOINTS,(#CASHPOINTS + .card_cash_amount[.card_amount[.i]]);

    set #CASHBONUS,(#CASHBONUS + .card_cash_amount[.card_amount[.i]]);

    dispbottom "[Refill Center System] คุณมี Cash Bonus สะสม " + #CASHBONUS + " Cash";

    if(.card_item_id[.card_amount[.i]] > 0 && .card_item_amount[.card_amount[.i]] > 0)

    {

     getitem .card_item_id[.card_amount[.i]],.card_item_amount[.card_amount[.i]];

     dispbottom "[Refill Center System] คุณได้รับ Item " + getitemname(.card_item_id[.card_amount[.i]]) + " จำนวน " + .card_item_amount[.card_amount[.i]] + " eA";

    }

    if(#CASHBONUS >= .cash_bonus_minimum && .cash_bonus_item_id > 0 && .cash_bonus_item_amount > 0)

    {

     set #CASHBONUS,(#CASHBONUS - .cash_bonus_minimum);

     getitem .cash_bonus_item_id,.cash_bonus_item_amount;

     dispbottom "[Refill Center System] คุณได้รับ Bonus Item " + getitemname(.cash_bonus_item_id) + " จำนวน " + .cash_bonus_item_amount + " eA";

     dispbottom "[Refill Center System] คุณมี Cash Bonus สะสม " + #CASHBONUS + " Cash";

    }

    query_sql "UPDATE `truemoney` SET `status` = 2 WHERE `card_id` = " + .card_id[.i];

   }

   detachrid;

  }

  deletearray .card_id[0],getarraysize(.card_id);

  deletearray .card_amount[0],getarraysize(.card_amount);

  deletearray .card_account_id[0],getarraysize(.card_account_id);

 }

 detachrid;

 setnpctimer 0;

 startnpctimer;

 end;

OnInit:

 set .card_cash_amount[1],50;

 set .card_cash_amount[2],90;

 set .card_cash_amount[3],150;

 set .card_cash_amount[4],300;

 set .card_cash_amount[5],500;

 set .card_cash_amount[6],1000;

 set .card_item_id[1],0;

 set .card_item_amount[1],0;

 set .card_item_id[2],0;

 set .card_item_amount[2],0;

 set .card_item_id[3],0;

 set .card_item_amount[3],0;

 set .card_item_id[4],0;

 set .card_item_amount[4],0;

 set .card_item_id[5],0;

 set .card_item_amount[5],0;

 set .card_item_id[6],0;

 set .card_item_amount[6],0;

 set .cash_bonus_minimum,300;

 set .cash_bonus_item_id,0;

 set .cash_bonus_item_amount,0;

 initnpctimer;

 end;

}

Why ontimer not check?

This script auto add cash when user online.

eAthena + 3Ceam is working.

 

CREATE TABLE `truemoney` (

`card_id` INT( 6 ) UNSIGNED NOT NULL AUTO_INCREMENT ,

`password` VARCHAR( 14 ) NOT NULL ,

`user_id` INT( 11 ) UNSIGNED NOT NULL ,

`amount` INT( 4 ) UNSIGNED NOT NULL ,

`status` TINYINT( 1 ) UNSIGNED NOT NULL ,

`added_time` DATETIME NOT NULL ,

PRIMARY KEY ( `card_id` )

) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;

ALTER TABLE `truemoney` ADD INDEX ( `user_id` );

 

User online script not work but @reloadscript script is work

Edited by XeroBall
Link to comment
Share on other sites

1 answer to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  318
  • Reputation:   54
  • Joined:  12/23/12
  • Last Seen:  

- script TMPAY  -1,{

OnPCLoginEvent:    <<----------

OnTimer5000:

 

This should run the script for each player as soon as they login.

 

If that's not the case, do you have any errors?   (Can't tell what you're saying as you have typed bad grammar.).

Link to comment
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.   Paste as plain text instead

  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.

×
×
  • Create New...