Zeiyan 4 Posted November 10, 2014 @charinfo A @command (via script) that gives you and your GM Staff (GM level 2 NOT group level)information about Player account informations without having to login to phpmyadmin. I'm quite used to making very simple scripts but this is my first time to give back to the community and also my first time using sql query in scripts (in short i'm a newbie) Please leave comments about what you think . ( I use it on my own server so it includes checking if they have freebies received via account or via mac address) You can choose to input Character name or Username NOTE: I know the @accinfo almost do the same thing but i'm a big noob in source editing so i made this for my own use ( then i can include the stuff i want to display) - script charinfo -1,{OnInit: bindatcmd "charinfo","charinfo::OnCharInfo", 0, 2; end;OnCharInfo: if(getgroupid() >= 2) { mes " [ Character Info ] "; mes " Hello GM ^00CC00"+strcharinfo(0)+"^000000!"; mes " What would you like to check? "; switch (select("Character Name:Username")) { case 1: input .@chrnm$; query_sql "SELECT `account_id` FROM `char` WHERE `name` = '" + .@chrnm$ + "'",.@acid; next; break; case 2: input .@acnme$; query_sql "SELECT `account_id` FROM `login` WHERE `userid` = '" + .@acnme$ + "'",.@acid; next; break; } query_sql "SELECT `userid`,`email`,`group_id`,`last_ip`,`birthdate`,`last_mac` FROM `login` WHERE `account_id` ='" + .@acid + "'", .@usrd$,.@eml$,.@ggm,.@lstip$,.@brtdy$,.@macad$; if ( .@ggm > 0 ) { mes "[ Account Information ]"; mes "GM Account Information are not available"; close; } else if ( .@acid < 2000000 || .@acid > 3000000 ) { mes "[ Account Information ]"; mes "Character Not Found"; close; } query_sql "SELECT `name`, `base_level`, `job_level` FROM `char` WHERE `account_id` =" + .@acid + " ORDER BY `base_level` DESC",.@chrlst$, .@blvl, .@jlvl; mes "[Character List]" ; for(set .@i, 0; .@i < getarraysize(.@chrlst$); set .@i, .@i + 1){ mes .@i+1+". ^00CC00"+.@chrlst$[.@i]+"^000000 "; mes "Level: "+.@blvl[.@i]+"/"+.@jlvl[.@i]+" "; } next; mes "[ Account Information ]"; mes "Account ID: "+.@acid; mes "Username: "+.@usrd$; mes "Email: "+.@eml$; mes "Last IP: ^00CC00"+.@lstip$+"^000000"; mes "Birthdate: "+.@brtdy$; mes "Mac Address: ^FF0000"+.@macad$+"^000000"; query_sql "SELECT `account_id`,`last_mac` FROM `freebies` WHERE `account_id` =" + .@acid + " ",.@rcvfrbs, .@lstmc$; if (.@rcvfrbs > 0) { set .@rcvfrbs, 1; } else { set .@rcvfrbs, 0; } if (.@rcvfrbs > 0) { set .@rcvfrbs$, "^00CC00Yes^000000"; } if (.@rcvfrbs == 0) { set .@rcvfrbs$, "^FF0000No^000000"; } mes "Freebies from account: "+.@rcvfrbs$; for(set .@i1, 0; .@i1 < getarraysize(.@lstmc$); set .@i1, .@i1 + 1){ set .@lstmc, .@lstmc +1; } if (.@lstmc < 1) { set .@lstmc$, "^FF0000No^000000"; } if (.@lstmc > 0) { set .@lstmc$, "^00CC00Yes^000000"; } mes "Freebies from MAC: "+.@lstmc$; close; }} 2. @ipinfo This one displays all users (displays username) with login count and last login from IP address of a certain character (Input Character name) - script ipinfo -1,{OnInit: bindatcmd "ipinfo","ipinfo::OnIPInfo", 2, 2; end;OnIPInfo: if(getgroupid() >= 2) { input .@chrnm$; query_sql "SELECT `account_id` FROM `char` WHERE `name` = '" + .@chrnm$ + "'",.@acid; query_sql "SELECT `last_ip`,`group_id` FROM `login` WHERE `account_id` ='" + .@acid + "'", .@lstp$, .@grplvl; query_sql "SELECT `account_id`,`userid`,`logincount`,`lastlogin` FROM `login` WHERE `last_ip` ='" + .@lstp$+ "'", .@acidlip, .@acidlip$, .@lgncnt, .@lstlgn$; if (.@acid < 2000000 || .@acid > 3000000) { mes "Character Not Found"; close; } if (.@grplvl > 0) { mes "GM Accounts Not Available"; close; } mes "Name: ^00CC00"+.@chrnm$+"^000000 "; mes "IP Address: ^FF0000"+.@lstp$+"^000000 "; next; mes "Displaying Users with IP: ^00CC00"+.@lstp$; next; for(set .@i, 0; .@i < getarraysize(.@acidlip$); set .@i, .@i + 1){ mes .@i+1+". ^00CC00"+.@acidlip$[.@i]+"^000000 "; mes "Login Count: "+.@lgncnt[.@i]+" "; mes "Last Login: "+.@lstlgn$[.@i]+" "; } close; }} 3. @macinfo Same as @ipinfo except this one displays mac address information (if you have harmony or in my case have last_mac table) - script macinfo -1,{OnInit: bindatcmd "macinfo","macinfo::OnMacInfo", 2, 2; end;OnMacInfo: if(getgroupid() >= 2) { input .@chrnm$; query_sql "SELECT `account_id` FROM `char` WHERE `name` = '" + .@chrnm$ + "'",.@acid; query_sql "SELECT `last_mac`,`group_id` FROM `login` WHERE `account_id` ='" + .@acid + "'", .@lstp$, .@grplvl; query_sql "SELECT `account_id`,`userid`,`logincount`,`lastlogin` FROM `login` WHERE `last_mac` ='" + .@lstp$+ "'", .@acidlmac, .@acidlmac$, .@lgncnt, .@lstlgn$; if (.@acid < 2000000 || .@acid > 3000000) { mes "Character Not Found"; close; } if (.@grplvl > 0) { mes "GM Accounts Not Available"; close; } mes "Name: ^00CC00"+.@chrnm$+"^000000 "; mes "Mac Address: ^FF0000"+.@lstp$+"^000000 "; next; mes "Displaying Users with Mac: ^00CC00"+.@lstp$; next; for(set .@i, 0; .@i < getarraysize(.@acidlmac$); set .@i, .@i + 1){ mes .@i+1+". ^00CC00"+.@acidlmac$[.@i]+"^000000 "; mes "Login Count: "+.@lgncnt[.@i]+" "; mes "Last Login: "+.@lstlgn$[.@i]+" "; } close; }} 3 mmseabb02, Kuroyama and lenon25 reacted to this Quote Share this post Link to post Share on other sites