almarket23 0 Posted January 1, 2016 Hi everyone. How can I make a script or NPC that when I change the group id of one character the server will recognize the group id of that player without logging out from the game. Thanks for the help.. Quote Share this post Link to post Share on other sites
0 AnnieRuru 957 Posted January 1, 2016 you want this to last permanently or only temporary until logout ? there is a script command setgroupid that temporary change the group id if you want it permanent, can set a temporary player variable and query_sql at OnPCLogoutEvent Quote Share this post Link to post Share on other sites
0 almarket23 0 Posted January 2, 2016 the group id should be permanent, however if we do this by using the NPC the player's group id should change automatically without logging out. Quote Share this post Link to post Share on other sites
0 AnnieRuru 957 Posted January 2, 2016 (edited) ... it seems we have setgroupid, but we don't have checkgrouplevel @@Emistry, go make that script command XD the reason is, if I somehow set the group belongs to non-existent group ID ... [Warning]: pc_authok: AnnieRuru (AID:2000000) logged in with unknown group id (7)! kicking..... . prontera,155,185,5 script setgroupid 1_F_MARIA,{ dispbottom getgroupid() +" "+ getgmlevel(); if ( getgmlevel() < 99 ) { mes "admin only"; close; } mes "input the player name"; next; if ( input( .@name$, 1, 23 ) ) { mes "invalid name length"; close; } .@aid = getcharid( 3, .@name$ ); if ( !.@aid ) { mes "the player you input doesn't exist"; close; } mes "the player is"; .@name$ = rid2name( .@aid ); mes callfunc( "F_MesColor", C_BLUE ) + .@name$ + callfunc( "F_MesColor", C_BLACK ); mes "input the group ID"; next; if ( input ( .@groupid, 0, 99 ) ) { mes "invalid group id"; close; } setgroupid .@groupid, .@aid; query_sql "update login set group_id = "+ .@groupid +" where account_id = "+ .@aid; mes "The player "+ callfunc( "F_MesColor", C_BLUE ) + .@name$ + callfunc( "F_MesColor", C_BLACK ); mes "has change group ID into "+ callfunc( "F_MesColor", C_RED ) + .@groupid; close;}though, I tested there is no need to use OnPCLogoutEventdirectly set with query_sql works fine without logging out it seems the login table is left untouch Edited January 2, 2016 by AnnieRuru 1 Kairedia reacted to this Quote Share this post Link to post Share on other sites
0 almarket23 0 Posted January 2, 2016 so if ever that I do this one the player will have all the commands that the group id have without logging out the player? Quote Share this post Link to post Share on other sites
0 almarket23 0 Posted January 2, 2016 anyone pls? Quote Share this post Link to post Share on other sites
0 Emistry 145 Posted January 2, 2016 if ( setgroupid( .@groupid, .@aid ) == false ) { // group id not exist or failed close;} we dont really need a checkgroupid script command because inside the setgroupid, they already have the checking. 1 AnnieRuru reacted to this Quote Share this post Link to post Share on other sites
0 AnnieRuru 957 Posted January 3, 2016 (edited) oh it really works didn't read the documentation carefully EDIT: maybe can change offline player ... prontera,150,185,5 script setgroupid 1_F_MARIA,{// dispbottom getgroupid() +" "+ getgmlevel(); if ( getgmlevel() < 99 ) { mes "admin only"; close; } mes "input the player name"; next; if ( input( .@name$, 1, 23 ) ) { mes "invalid name length"; close; } .@aid = getcharid( 3, .@name$ ); if ( !.@aid ) { if ( !query_sql( "select account_id, name from `char` where name = '"+ escape_sql(.@name$) +"'", .@aid, .@name$ ) ) { mes "the player you input doesn't exist"; close; } } else .@name$ = rid2name( .@aid ); mes "the player is"; mes callfunc( "F_MesColor", C_BLUE ) + .@name$ + callfunc( "F_MesColor", C_BLACK ); mes "input the group ID"; next; if ( input ( .@groupid, 0, 99 ) ) { mes "invalid group id"; close; } if ( isloggedin( .@aid ) ) { if ( setgroupid( .@groupid, .@aid ) == false ) { mes "group ID doesn't exist"; close; } } query_sql "update login set group_id = "+ .@groupid +" where account_id = "+ .@aid; mes "The player "+ callfunc( "F_MesColor", C_BLUE ) + .@name$ + callfunc( "F_MesColor", C_BLACK ); mes "has change group ID into "+ callfunc( "F_MesColor", C_RED ) + .@groupid; close;}nope, if I wanna change offline player group ID, the setgroupid can't detect the playerand possible for a GM to disable that player from logging in with invalid group Edited January 3, 2016 by AnnieRuru Quote Share this post Link to post Share on other sites
0 Emistry 145 Posted January 3, 2016 erm, ya if we're updating an offline players, then we need to check for existing group id. setgroupid() only used to alter the online player's group id, so it doesnt work for offline players. but i think the checkgroupid() script command isnt really needed. it's admin themselves setup the group_id in the conf/groups.conf so they should be aware of what is the exact group_id they going to use in script Quote Share this post Link to post Share on other sites
0 almarket23 0 Posted January 3, 2016 thus this script automatically change the group id of one player without logging out and also used the commands that the certain group id have? Quote Share this post Link to post Share on other sites
Hi everyone.
How can I make a script or NPC that when I change the group id of one character the server will recognize the group id of that player without logging out from the game.
Thanks for the help..
Share this post
Link to post
Share on other sites