GM privilege auto update

almarket23

New member
Messages
90
Points
0
Github
nexus
Emulator
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..

 
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

 
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.

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

 
Last edited by a moderator:
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?

 
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.

 
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

 
Last edited by a moderator:
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
default_biggrin.png


 
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?

 
Back
Top