Jump to content
  • 1

Daily reward for top rank player error


pajodex

Question


  • Group:  Members
  • Topic Count:  78
  • Topics Per Day:  0.03
  • Content Count:  436
  • Reputation:   167
  • Joined:  12/12/17
  • Last Seen:  

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~

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  22
  • Reputation:   11
  • Joined:  07/16/17
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  78
  • Topics Per Day:  0.03
  • Content Count:  436
  • Reputation:   167
  • Joined:  12/12/17
  • Last Seen:  

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. 

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