Jump to content
  • 0

How to kick player by aid, after expel him from guild and if he offline?


anacondaq

Question


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  1096
  • Reputation:   344
  • Joined:  02/26/12
  • Last Seen:  

Hi guys, can anyone show me example, because i something can't to recognize and understand.

 

Here is code example, if player in game -> do something

If player not in game -> do another.

 

I found some bug in that system, and i request for a way to kick from the map server & the game a player with aid (account id) if he is in game, but on another character on account.

#ifdef BOUND_ITEMS
void guild_retrieveitembound(int char_id,int aid,int guild_id) {
	TBL_PC *sd = map_id2sd(aid);
	if(sd){ //Character is online
		int idxlist[MAX_INVENTORY];
		int j;
		j = pc_bound_chk(sd,2,idxlist);
		if(j) {
			struct guild_storage* stor = guild2storage(sd->status.guild_id);
			int i;
			for(i=0;i<j;i++) { //Loop the matching items, guild_storage_additem takes care of opening storage
				if(stor)
					guild_storage_additem(sd,stor,&sd->status.inventory[idxlist[i]],sd->status.inventory[idxlist[i]].amount);
				pc_delitem(sd,idxlist[i],sd->status.inventory[idxlist[i]].amount,0,4,LOG_TYPE_GSTORAGE);
			}
			storage_guild_storageclose(sd); //Close and save the storage
		}
	ShowError( "Player is ONLINE! sd= %d aid= %d char_id= %d \n", sd, aid, char_id ); // need to remove this line
	} else { //Character is offline, ask char server to do the job
		struct guild_storage* stor = guild2storage2(guild_id);
		struct guild *g = guild_search(guild_id);
		nullpo_retv(g);
		if(stor && stor->storage_status == 1) { //Someone is in guild storage, close them
			int i;
			for(i=0; i<g->max_member; i++){
				TBL_PC *pl_sd = g->member[i].sd;
				if(pl_sd && pl_sd->state.storage_flag == 2)
					storage_guild_storageclose(pl_sd);
			}
		}
		ShowError( "Player is OFFLINE!!! sd= %d aid= %d char_id= %d \n", sd, aid, char_id ); // need to remove this line
		intif_itembound_req(char_id,aid,guild_id);
	}
}
#endif
Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  1479
  • Reputation:   172
  • Joined:  12/14/11
  • Last Seen:  

hmm, why don't you use a regular NPC script to do that?

 

input .@aid;

if(isloggedin(.@aid)) {
    mes "A character with account id "+.@aid+" is currently around.";
    } else {
    mes "Sorry, there is no character online with account id "+.@aid+",";
    mes "or the account does not exist.";
    }
end;

 
that's how do you check if the ID is online or not.
 
 

input .@aid;
input .@cid;

if(isloggedin(.@aid, .@cid)) {
    mes "Char ID: "+.@cid+" with account id "+.@aid+" is currently around.";
    } else {
    mes "Sorry, char ID "+.@cid+" with account id "+.@aid+",";
    mes "is not online or the char / account does not exist.";
    }
end;

That's how you check if the char within the account ID is online / not.

 

You can use OnPcLogoutEvent as well. like this:

OnPcLogoutEvent:
if (strcharinfo(2)==0) {
    //char isn't in a guild
    do something;
    } else {
    //char is in a guild, idk what
    kick him;
}
Edited by Winz
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  1096
  • Reputation:   344
  • Joined:  02/26/12
  • Last Seen:  

 

hmm, why don't you use a regular NPC script to do that?

 

input .@aid;

if(isloggedin(.@aid)) {
    mes "A character with account id "+.@aid+" is currently around.";
    } else {
    mes "Sorry, there is no character online with account id "+.@aid+",";
    mes "or the account does not exist.";
    }
end;

 

that's how do you check if the ID is online or not.

 

 

input .@aid;
input .@cid;

if(isloggedin(.@aid, .@cid)) {
    mes "Char ID: "+.@cid+" with account id "+.@aid+" is currently around.";
    } else {
    mes "Sorry, char ID "+.@cid+" with account id "+.@aid+",";
    mes "is not online or the char / account does not exist.";
    }
end;

That's how you check if the char within the account ID is online / not.

 

You can use OnPcLogoutEvent as well. like this:

OnPcLogoutEvent:
if (strcharinfo(2)==0) {
    //char isn't in a guild
    do something;
    } else {
    //char is in a guild, idk what
    kick him;
}

 

I did ask about sources) Not script. Thank you very much.

But this is not what i need)

 

I just need a function like clif_GM_kick(), what can i easly add to sources, and not get crashes)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  1479
  • Reputation:   172
  • Joined:  12/14/11
  • Last Seen:  

I would prefer doing this by script, not source (src) modification since it will be another problem while updating the revision.

 

if you still want to modify the source, and not using a NPC script, okay, I'm out

Link to comment
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.   Paste as plain text instead

  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.

×
×
  • Create New...