Jump to content
  • 0

first 50 Prize


Scofield

Question


  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.03
  • Content Count:  265
  • Reputation:   11
  • Joined:  01/11/13
  • Last Seen:  

I have this NPC that is showing the following error in the console, and it's possible that I'm not using the correct syntax. I'm using the eAthena emulator for my project, as it's an old-time project, and I prefer it for various reasons.
 

prontera,155,172,3    script    Comece Com o Pé Direito    880,{

    set .@aid,getcharid(3);
    set .@cid,getcharid(0);
    set .@ip$,getcharip(.@aid);
    set .@unique_id$,get_unique_id();
    
    query_logsql("SELECT `id`,`time` FROM `reward_for_first_50` WHERE `aid` = "+.@aid+" OR `last_ip` = '"+escape_sql(.@ip$)+"' OR `last_unique_id` = '"+escape_sql(.@unique_id$)+"' LIMIT 1", .@id, .@time$);
    query_logsql("SELECT COUNT(`id`) FROM `reward_for_first_50`", .@size);
    if (.@size >= .max_redeem) {
        mes "Desculpe, você perdeu a recompensa. Apenas os primeiros "+.max_redeem+" jogadores receberam a recompensa.";
    }
    else if (.@id) {
        mes "Você já reivindicou as recompensas em "+.@time$+".";
    }
    else {
        query_logsql("INSERT INTO `reward_for_first_50` (`aid`,`cid`,`last_ip`,`last_unique_id`,`time`) VALUES ("+.@aid+","+.@cid+",'"+escape_sql(.@ip$)+"','"+escape_sql(.@unique_id$)+"', NOW())");
        if (.@size < 10) {
            getitem 20001, 10;
            getitem 12411, 10;
            getitem 12312, 20;
            getitem 12214, 30;
            getitem 12210, 10;
            getitem 14232, 2;
            getitem 13989, 1;
            getitem 13973, 1;
            
        if (.@size == 49) {
            announce "Parabéns ao jogador número 50! Ele ganhou um prêmio especial!", 0, 0xFFFF00;
            getitem 12925, 1;  // Dê um item especial ao jogador número 50
            getitem 20001, 10;
            getitem 12411, 10;
            getitem 12312, 20;
            getitem 12214, 30;
            getitem 12210, 10;
            getitem 14232, 2;
            getitem 13989, 1;
            getitem 13973, 1;
            getitem 7558, 1;
            
            }
            
            mes "Parabéns! Você é um dos 10 primeiros jogadores a receber a recompensa. Aqui estão seus itens:";
            
        } else {
            getitem 20001, 5;
            getitem 12411, 5;
            getitem 12312, 10;
            getitem 12214, 15;
            getitem 12210, 5;
            getitem 14232, 1;
            getitem 13989, 1;
            getitem 13973, 1;
            mes "Você recebeu uma recompensa. Aqui está seu item exclusivo:";
        }
        mes "Você é o "+(.@size+1)+"/"+.max_redeem+" jogadores que receberam a recompensa";
    }
    close;
    
    OnInit:
        set .max_redeem,50;
        end;
}

erro

[Error]:  Loading NPC file: npc/personalizado/josedias/estreia.txt
script error on npc/personalizado/josedias/estreia.txt line 5
    parse_line: need ';'
     1 : {
     2 :
     3 :        set .@aid,getcharid(3);
     4 :        set .@cid,getcharid(0);
*    5 :        set .@ip$,getcharip'('.@aid);
     6 :        set .@unique_id$,get_unique_id();
     7 :
     8 :        query_logsql("SELECT `id`,`time` FROM `reward_for_first_50` WHERE `aid` = "+.@aid+" OR `last_ip` = '"+escape_sql(.@ip$)+"' OR `last_unique_id` = '"+escape_sql(.@unique_id$)+"' LIMIT 1", .@id, .@time$);
     9 :        query_logsql("SELECT COUNT(`id`) FROM `reward_for_first_50`", .@size);
    10 :        if (.@size >= .max_redeem) {

Edited by cumbe11
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  22
  • Reputation:   5
  • Joined:  02/22/22
  • Last Seen:  

Can you try copy and paste and replace the first line for this 

prontera,155,172,3	script	Test	880,{

 

Edited by Hergel
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.03
  • Content Count:  265
  • Reputation:   11
  • Joined:  01/11/13
  • Last Seen:  

 

I didn't understand your suggestion, the script problem is exactly along these lines

 set .@ip$,getcharip(.@aid);

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  232
  • Reputation:   86
  • Joined:  06/30/18
  • Last Seen:  

Seems to be a problem specific to your emulator. I can't reproduce this error on the current rAthena.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.03
  • Content Count:  265
  • Reputation:   11
  • Joined:  01/11/13
  • Last Seen:  

Okay, I partially solved the problem, I just removed the part that took the ip and just used the other parameters, they are enough to meet my business rule

 

prontera,155,172,3    script    Comece Com o Pé Direito    880,{

    set .@aid,getcharid(3);
    set .@cid,getcharid(0);
    set .@unique_id$,get_unique_id();
    
    query_sql("SELECT `id`,`time` FROM `reward_for_first_50` WHERE `aid` = "+.@aid+" OR `last_unique_id` = '"+escape_sql(.@unique_id$)+"' LIMIT 1", .@id, .@time$);
    query_sql("SELECT COUNT(`id`) FROM `reward_for_first_50`", .@size);
    if (.@size >= .max_redeem) {
        mes "Desculpe, você perdeu a recompensa. Apenas os primeiros "+.max_redeem+" jogadores receberam a recompensa.";
    }
    else if (.@id) {
        mes "Você já reivindicou as recompensas em "+.@time$+".";
    }
    else {
        query_sql("INSERT INTO `reward_for_first_50` (`aid`,`cid`,`last_unique_id`,`time`) VALUES ("+.@aid+","+.@cid+",'"+escape_sql(.@unique_id$)+"', NOW())");
        if (.@size < 10) {
            getitem 20001, 10;
            getitem 12411, 10;
            getitem 12312, 20;
            getitem 12214, 30;
            getitem 12210, 10;
            getitem 14232, 2;
            getitem 13989, 1;
            getitem 13973, 1;
            
        if (.@size == 49) {
            announce "Parabéns ao jogador número 50! Ele ganhou um prêmio especial!", 0, 0xFFFF00;
            getitem 12925, 1;  // Dê um item especial ao jogador número 50
            getitem 20001, 10;
            getitem 12411, 10;
            getitem 12312, 20;
            getitem 12214, 30;
            getitem 12210, 10;
            getitem 14232, 2;
            getitem 13989, 1;
            getitem 13973, 1;
            getitem 7558, 1;
            
            }
            
            mes "Parabéns! Você é um dos 10 primeiros jogadores a receber a recompensa. Aqui estão seus itens:";
            
        } else {
            getitem 20001, 5;
            getitem 12411, 5;
            getitem 12312, 10;
            getitem 12214, 15;
            getitem 12210, 5;
            getitem 14232, 1;
            getitem 13989, 1;
            getitem 13973, 1;
            mes "Você recebeu uma recompensa. Aqui estão seus itens exclusivos:";
        }
        mes "Você é o "+(.@size+1)+"/"+.max_redeem+" jogadores que receberam a recompensa";
    }
    close;
    
    OnInit:
        set .max_redeem,50;
        end;
}
 

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...