"name of party" to party_id

Zirius

New member
Messages
261
Points
0
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!

 
Last edited by a moderator:
why not use @partyrecall ?

atcommand "@partyrecall "+party name 1;

atcommand "@partyrecall "+party name 2;

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


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

 
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:

Code:
// Determine party ID of party "Party Name".@party_id = getpartyid("Party Name");
 
Last edited by a moderator:
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

 
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
 
Right, in which case just change line 4:

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

to this:

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