Jump to content
  • 1

Daily reward for top rank player error


Question

Posted

Hi,

I'm getting console error:

[Error]: buildin_getcharid: Player with nick '150103' is not found.
[Error]: buildin_getcharid: Player with nick '150103' is not found.

with this code:

OnClock0000:
	set .prize, 7227;
    set .amount, 5;
    query_sql "SELECT `char_id` FROM `char_reg_num` ORDER BY `key` = 'kills' DESC LIMIT 1",$kill$;
    set
	if (!isloggedin(getcharid(0, $kill$))) {
		query_sql "INSERT INTO `inventory` (`char_id`, `nameid`, `amount`, `equip`, `identify` ) VALUES ('" +getcharid(0, $kill$)+ "', '" +.prize+ "', '" +.amount+ "', 0, 1)";
		} else getitem .prize, .amount, getcharid(0, $kill$);
    end;

I based it from this post xD

Regards~

2 answers to this question

Recommended Posts

  • 0
Posted (edited)

Instead of use getcharid(0, $kill$), you just need to use $kill$ ($kill$ is actually saving the character id (char_id) and not the character name (name), so you don't need to use getcharid).

Try this:

OnClock0000:
    set .prize, 7227;
    set .amount, 5;
    query_sql "SELECT `char_id` FROM `char_reg_num` ORDER BY `key` = 'kills' DESC LIMIT 1", $kill$;
    query_sql "SELECT `name` FROM `char` WHERE `char_id`="+$kill$+"", .@name$;
    if (!isloggedin(getcharid(3, .@name$))
        query_sql "INSERT INTO `inventory` (`char_id`, `nameid`, `amount`, `equip`, `identify` ) VALUES ('"+$kill$+"', '"+.prize+"', '" +.amount+ "', 0, 1)";
    else
        getitem .prize, .amount, getcharid(3, .@name$);
    end;

 

Edited by Sindit
  • Upvote 1
  • 0
Posted
11 minutes ago, Sindit said:

Instead of use getcharid(0, $kill$), you just need to use $kill$ ($kill$ is actually saving the character id (char_id) and not the character name (name), so you don't need to use getcharid).

Try this:


OnClock0000:
    set .prize, 7227;
    set .amount, 5;
    query_sql "SELECT `char_id` FROM `char_reg_num` ORDER BY `key` = 'kills' DESC LIMIT 1", $kill$;
    query_sql "SELECT `name` FROM `char` WHERE `char_id`="+$kill$+"", .@name$;
    if (!isloggedin(getcharid(3, .@name$))
        query_sql "INSERT INTO `inventory` (`char_id`, `nameid`, `amount`, `equip`, `identify` ) VALUES ('"+$kill$+"', '"+.prize+"', '" +.amount+ "', 0, 1)";
    else
        getitem .prize, .amount, getcharid(3, .@name$);
    end;

 

Thanks for the information about the $$ vars. Was totally unaware on it.

However, I had some tutorials on discord with script experts and helped me with this. I used ROdex instead of this code. 

Your help is really appreciated. 

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...