Jump to content
  • 0
Zirius

"name of party" to party_id

Question

hello! warp party requires party_id , I am just wondering if there's a way to get the party_id given the party name?

*warpparty "<to_mapname>",<x>,<y>,<party_id>

I am coding a script that warps 2 parties into 2 different location using whisper system

recall#"party name 1"#"party name 2"

it that way, I can put all members of "party name 1" and "party name 2" on 2 different location simultaneously. Hope somebody can help.

 

Thanks!

Edited by Zirius

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Place this at the top of your script (below the header) and you'll be able to use getpartyid() to determine the party ID of the input party name. Alternatively, you could do something with getcharid(1), but it may require more writing than you'd like.

// getpartyid("Party Name")function getpartyid {	// Determine party ID	query_sql "SELECT `party_id` FROM `party` WHERE `name` ='"+ getarg(0) +"'", .@party_id;		// Return false (0) if party not found	if (!.@party_id) {		return false;		// Return party ID if found	} else {		return .@party_id;	}}

 

 

Example:

// Determine party ID of party "Party Name".@party_id = getpartyid("Party Name");

Share this post


Link to post
Share on other sites
  • 0

why not use @partyrecall ?

 

atcommand "@partyrecall "+party name 1;

 

atcommand "@partyrecall "+party name 2;

 

Because the one who should issue the command must stay at a single far spot. :)

Oh, typo at my original post, each party will be warped at far away from each other.

Share this post


Link to post
Share on other sites
  • 0

you should also be careful if you are thinking to accept user input.

mes "Enter the party name!"



they can enter something bad like


hax'; UPDATE `login` SET `group_id` = 99 WHERE `user_id` = 'Yommy

Share this post


Link to post
Share on other sites
  • 0

you should also be careful if you are thinking to accept user input.

mes "Enter the party name!"

 

they can enter something bad like

 

hax'; UPDATE `login` SET `group_id` = 99 WHERE `user_id` = 'Yommy

To avoid this kind of thing, one should use escape_sql ScriptCommand

Share this post


Link to post
Share on other sites
  • 0

Right, in which case just change line 4:

query_sql "SELECT `party_id` FROM `party` WHERE `name` ='"+ getarg(0) +"'", .@party_id;

 

to this:

query_sql "SELECT `party_id` FROM `party` WHERE `name` ='"+ escape_sql(getarg(0)) +"'", .@party_id;

Share this post


Link to post
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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.