Jump to content
  • 0

How do I check if party exp share is set to even share?


Question

6 answers to this question

Recommended Posts

Posted (edited)

Thanks

 

Edit: if anyone else is wondering how to check if party is in even share I added a script command that looks like this

BUILDIN_FUNC(getpartyshare)
{
	struct party_data *p;
	int i=0;

	p=party_search(script_getnum(st,2));


	if (p && p->party.exp)
		i++;
	mapreg_setreg(add_str("$@partyshare"),i);

	return 0;
}
Edited by Frosty
  • Upvote 1
Posted

In the SQL table `party`, the `exp` column stores the Exp Share status.

I'm guessing 0 is off and 1 is on. You might want to double check that.

Remember that the value in SQL is not updated immediately when they change Exp Share in-game. I think it's autosaved every 300 seconds.

  • Upvote 1
Posted (edited)

Yeh I figured that. Thanks though.

I was actually wondering if there was a script command to check if its on or do I have to make a custom one.

 

Edit: another question, if I make a custom script command in script.c do I need to declare it somewhere else so I can use it in scripts. Didnt seem to recognize my custom script command. (though I guess this should be asked in source support)

 

Edit2: eh I can just use query_sql right?

 

Edit3: cant figure out how to use it, no knowledge of sql stuff

 

    set .@partyid,getcharid(1);
    set .@share, query_sql(need help here)

 

I need it to get the value of exp from that exact partyid (.@partyid).

Edited by Frosty
Posted

There are 2 places in script.c you have to add your script command.

For example get_revision:

BUILDIN_FUNC(get_revision) {
	const char * revision;

	if ( (revision = get_svn_revision()) != 0 )
		script_pushint(st,atoi(revision));
	else
		script_pushint(st,-1);//unknown

	return 0;
}
	BUILDIN_DEF(get_revision,""),
Posted

how about this ?

BUILDIN_FUNC(getpartyshare)
{
	struct party_data *p;
	
	if( ( p = party_search( sd->status.party_id ) ) != NULL )
		script_pushint( st,p->party.exp );
		
	return 0;
}


BUILDIN_DEF(getpartyshare,""),

 

just a copy paste from above post ....

personally i try just show the value is enough...dont need to store it in a variable ...

if you want to store the value..just do like this..

.@exp_share = getpartyshare();
mes "EXP Share : "+( ( .@exp_share )? "ON":"OFF" );

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