wallaby 1 Posted September 30, 2016 How should I go about this in an event? Getting the character ID of the last player on a map? Thanks for your time! Quote Share this post Link to post Share on other sites
0 bWolfie 139 Posted September 30, 2016 (edited) Firstly, you would need to set the mapflag 'loadevent' for your map in question. map_name mapflag loadeventNext, you need to create a script to register the last player on that map using the 'OnPCLoadMapEvent' function.- script Last Player ID FAKE_NPC,{ OnPCLoadMapEvent: if (strcharinfo(3) == "map_name") { .@charid = getcharid(3,"" + strcharinfo(0) + ""); $last_char_name = " + rid2name(.@charid) + "; end; } else end; } The above script asks the following:.@charid asks for the charid type 3, which is the Account ID. $last_char_name, converts .@charid into a name using the command 'rid2name'. Note: rid2name only displays the current online character of that account. Next you need a script which you'll be able to easily access the above value. For this post, we'll use an atcmd using 'bindatcmd'. All in all, it turns out like this: - script Last Player ID::last_player_id_001 FAKE_NPC,{ OnPCLoadMapEvent: if (strcharinfo(3) == "prontera") { .@charid = getcharid(3,"" + strcharinfo(0) + ""); $last_char_id = .@charid; end; } else end; OnCommand: .@own_id = getcharid(3,"" + strcharinfo(0) + ""); detachrid; attachrid($last_char_id); .@pleb_id = strcharinfo(0); detachrid; attachrid(.@own_id); message strcharinfo(0),"The last player to load map prontera was " + .@pleb_id + "."; end; OnInit: bindatcmd "charid","last_player_id_001::OnCommand",96; end; } prontera mapflag loadevent With a level 96 GM or above, you can use the command '@charid' to view the last player who loaded prontera.Not sure if this is what you were after! Edited September 30, 2016 by True Zeal Quote Share this post Link to post Share on other sites
0 wallaby 1 Posted October 1, 2016 Thanks for taking the time to explain the script you have posted Zeal. Do you have skype? Quote Share this post Link to post Share on other sites
How should I go about this in an event?
Getting the character ID of the last player on a map?
Thanks for your time!
Share this post
Link to post
Share on other sites