Jump to content
  • 0
Sign in to follow this  
almarket23

GM privilege auto update

Question

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

9 answers to this question

Recommended Posts

  • 0

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

Share this post


Link to post
Share on other sites
  • 0

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.

Share this post


Link to post
Share on other sites
  • 0

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

directly set with query_sql works fine without logging out

it seems the login table is left untouch

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0
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.

Share this post


Link to post
Share on other sites
  • 0

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 player

and possible for a GM to disable that player from logging in with invalid group

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0

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 :D

Share this post


Link to post
Share on other sites
  • 0

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?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.