Jump to content

Question

Posted

Hey, just curious if there was a way to add an @command that would call a variable linked to the player that uses it. For example, I have a variable set whenever somebody gains an achievement and the variable is the achievement points they gain, which can later be used at a pointshop. What I'm curious is, can I somehow make a command that will tell that player what their variable is set to? So they can check how many achievement points they have whenever they want.

3 answers to this question

Recommended Posts

  • 0
Posted

You can add a command handler like this:

ACMD_FUNC(mypoints)
{
	int points = pc_readaccountreg(sd, add_str("your-script-variable-here"));
	char buffer[32];

	sprintf(buffer, "You have %d points.", points);

	clif_displaymessage(fd, buffer);

	return 0;
}
  • Upvote 1
  • 0
Posted

I'd recommend a script command instead for what you need.

-	script	atcmd_mypoints	-1,{
	end;
OnInit:
	bindatcmd "mypoints", strnpcinfo(3) + "::OnAtcommand", 0, 99;
	end;
OnAtcommand:
	dispbottom "You have " + variable_here + " points.", 0x00ff00;
	end;
}

They are easier to manage and doesn't require a server recompile.

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