Jump to content
  • 0

query sql


Break San

Question


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   0
  • Joined:  04/06/13
  • Last Seen:  

I'm trying to add script option trading 3 points for 1 day vip, more is wrong giving someone help?

mes "Okay!";
set .@account_id,getcharid(3);
set .@usedPoints,3;
set $nivelVip, 1;
set $diasVip, 1;
set $verificaVip, 1;
query_sql("UPDATE `cp_v4p_voters` SET points=(points-"+.@usedPoints+") WHERE account_id='"+.@account_id+"'");
if (getgroupid() == 0){
query_sql "UPDATE `login` SET `group_id` = "+$nivelVip+", `dt_vip` = DATE_ADD(`dt_vip`,INTERVAL "+$diasVip+" DAY) WHERE `group_id` = "+$nivelVip+" AND `account_id` = "+getcharid(3);dispbottom "Relogue para ter seu VIP ativado.";
}else{
query_sql "UPDATE `login` SET `group_id` = "+$nivelVip+", `dt_vip` = DATE_ADD(`dt_vip`,INTERVAL "+$diasVip+" DAY) WHERE `group_id` = "+$nivelVip+" AND `account_id` = "+getcharid(3);
}
garbagecol();
close2;
message strcharinfo(0),"Points added";
end;

http://pastebin.com/yx19q9yx

Link to comment
Share on other sites

6 answers to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Ho okay I misread your update function

need to replace -3 by 3

set .@account_id,getcharid(3);
updatePoints( .@account_id,3 );
// dispbottom "Relogue para ter seu VIP ativado.";
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

mes "Pronto!";
set .@account_id,getcharid(3);
updatePoints( .@account_id,-3 );
// dispbottom "Relogue para ter seu VIP ativado.";
query_sql "UPDATE `login` SET `dt_vip` = if( `group_id` = 1 and `dt_vip` > now(), `dt_vip` + INTERVAL 1 day, now() + interval 1 day ), `group_id` = 1  WHERE `account_id` = "+ .@account_id;
atcommand "@adjgroup 1";
garbagecol();
close2;
message strcharinfo(0),"Pontos adicionados";
end;

?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   0
  • Joined:  04/06/13
  • Last Seen:  

thank you

 

@edit

Capuche

Worked out that I came across while is consuming the points are adding again.

Doing update the table cp_v4p_voters

Edited by Break San
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Is that working like you expected ?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   0
  • Joined:  04/06/13
  • Last Seen:  

Is that working like you expected ?

 

The problem is that is adds more 3 point instead of consuming

 

@edit

 

Example 3 points have changed by vip, but instead of zeroing the points are adding 3 more, infinitely

Edited by Break San
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   0
  • Joined:  04/06/13
  • Last Seen:  

Now yes, I will test

 

@edit

 

Thank you

Edited by Break San
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...