Jump to content
  • 0

Need source code's for some @command.


Question

Posted

Hello guys, like i said, i need source code's for @command they are:

1) @auraset (I have some custom aura on my server and i need to set the aura to a particular player permanently, and the aura's are in the form of items like potions, is there are way to set the aura to a player?)

2) @freez (This command must freeze's him self at the spot where he is)

3) @freezall (This command must freeze's all player at the spot where they are [This must be a gm command])

4) @unfreezall (This command must unfreeze's all players and kick them out of the server who had been freeze'n before [This must be a gm command])

Thats all i want people, please do help me i seriously need the code, help me out guys.........

Thanking you

(Vijay Kumar)

13 answers to this question

Recommended Posts

Posted

@freez

ACMD_FUNC(freez)

{

nullpo_retr(-1, sd);

sd->sc.opt1 = 10;

return 0;

}

@freezall

ACMD_FUNC(freezall)
{
  struct map_session_data* pl_sd;
  struct s_mapiterator* iter;
  nullpo_retr(-1, sd);

  iter = mapit_getallusers();
  for( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) )
  {
     if (pc_get_group_level(sd) >= pc_get_group_level(pl_sd)) { // only lower or same gm level?
        if (sd->status.account_id != pl_sd->status.account_id)
            pl_sd->sc.opt1 = 10;
     }
   }
  mapit_free(iter);
  return 0;
}

@unfreezeall


ACMD_FUNC(unfreezeall)
{
  struct map_session_data* pl_sd;
  struct s_mapiterator* iter;
  nullpo_retr(-1, sd);

  iter = mapit_getallusers();
  for( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) )
  {
     if (pc_get_group_level(sd) >= pc_get_group_level(pl_sd)) { // only lower or same gm level?
        if (sd->status.account_id != pl_sd->status.account_id && pl_sd->sc.opt1 == 10;){
            clif_GM_kick(NULL, pl_sd);
        }
     }
   }
  mapit_free(iter);
  return 0;
}

finally

ACMD_DEF(freez),
ACMD_DEF(freezall),
ACMD_DEF(unfreezall),

never been tested..anyway if it doesn't work don't bother to ask.. :)

Posted
Im very thank full to you, can i add you on msn please? i needed some help.

your welcome..yes you can..but ATM just pm me..I just broke my MSN that is why I can't OL in MSN

Anyway to put a effect like a frozen effect?

How about @freezeoff?

just change sd->sc.opt1 = 10; to sd->sc.opt1 = OPT1_FREEZE;

and for @freezeoff

just copy the @freeze then change sd->sc.opt1 = 10; to sd->sc.opt1 &= ~10; or sd->sc.opt1 &= ~OPT1_FREEZE;

Posted (edited)

They will be the sae for 3ceam or Ea, you just need to change the declaration part :

ACMD_DEF(freez),

to

{ "freez", 60,60, atcommand_freez},

but it ain't a 3ceam forum here, plus since it was merged there no really point kepping it.

@malufett, dunno if I would force check sd for freezall and unfreezall, make sense for player usage but may be a bother if he planing using it from a script.

So in short I would only check the level thing if we have a player attach otherwise do it for all..

ACMD_FUNC(freezall)
{
  struct map_session_data* pl_sd;
  struct s_mapiterator* iter;

  iter = mapit_getallusers();
  for( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) )
  {
	  if (sd && (pc_get_group_level(sd) < pc_get_group_level(pl_sd)  || sd->status.account_id == pl_sd->status.account_id)
	   ) {
			 continue;   //skip it if we have someone attach and his lower gmlvl than the other.					  
	  } //(perhaps we should check groupid instead or add a new permission..)		  
	  pl_sd->sc.opt1 = 10;
	  clif_changeoption(&pl_sd->bl);
  }
  mapit_free(iter);
  return 0;
}

Edited by Lighta
Posted (edited)

do you want to specify the mapname or just current map ?

anyway assuming you giving a mapname :

ACMD_FUNC(freezall)
{
  struct map_session_data* pl_sd;
  struct s_mapiterator* iter;
  int map_id=0;
  char map_name[MAP_NAME_LENGTH_EXT] = "";
  bool chkmap = 1;

  if (sscanf(message, "%15s", map_name) < 1 || (map_id = map_mapname2mapid(map_name)) < 0){
   chkmap=0; //no valid map found do not chk it
  }

  iter = mapit_getallusers();
  for( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) )
  {
			  if (sd && (pc_get_group_level(sd) < pc_get_group_level(pl_sd)  || sd->status.account_id == pl_sd->status.account_id)
				 || (chkmap && pl_sd->bl.m != map_id)
			   ) {
							 continue;   //skip it if we have someone attach and his lower gmlvl than the other.									  
			  } //(perhaps we should check groupid instead or add a new permission..)				
			  pl_sd->sc.opt1 = 10;
			  clif_changeoption(&pl_sd->bl);
  }
  mapit_free(iter);
  return 0;
}

There you go just adapt it for freezmap or whatever right now if you don't give him a map (or it's an invalid one) he would freeze them all (like before).

You can just check other atcommand for thoses adds actually.

Edited by Lighta

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...