Register for your free account! | Forgot your password?

You last visited: Today at 06:06

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



/buff Command

Discussion on /buff Command within the Flyff Private Server forum part of the Flyff category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Apr 2017
Posts: 7
Received Thanks: 0
/buff Command

Hello developers.

I've been trying to impilemt /buff commands for admin on server.

It worked well on my self, but i wanted it to give to other players also then i reworked the code

Here is the code wich worked on me
PHP Code:
BOOL TextCmd_buff(CScannerscanner)
{
#ifdef __WORLDSERVER
        
CUserpUser = (CUser*)scanner.dwValue;
        if (
IsValidObj(pUser))
    {
                
pUser->DoActiveSkill(207pUser);
                
pUser->DoActiveSkill(497pUser);
                
pUser->DoActiveSkill(507pUser);
                
pUser->DoActiveSkill(527pUser);
                
pUser->DoActiveSkill(537pUser);
                
pUser->DoActiveSkill(1147pUser);
                
pUser->DoActiveSkill(1157pUser);
                
pUser->DoActiveSkill(1167pUser);
                
pUser->AddText("Successfully buffed!");
        }
        else
    {
        
pUser->AddText("Something went terrible wrong!");
    }
#endif
    
return TRUE;

here is the code wich didn't work to give players

PHP Code:
BOOL TextCmd_buff(CScanner s)
{
#ifdef __WORLDSERVER
    
CUserpUser = (CUser*)s.dwValue;
    if (
IsValidObj(pUser))
    {
        
pUser->DoActiveSkillSI_ASS_HEAL_PATIENCE,        2011303600000pUser->GetId());
        
pUser->DoActiveSkillSI_ASS_CHEER_QUICKSTEP,    2011303600000pUser->GetId());
        
pUser->DoActiveSkillSI_ASS_CHEER_HASTE,         2011303600000pUser->GetId());
        
pUser->DoActiveSkillSI_ASS_CHEER_CATSREFLEX,    2011303600000pUser->GetId());
        
pUser->DoActiveSkillSI_ASS_CHEER_CANNONBALL,    2011303600000pUser->GetId());
        
pUser->DoActiveSkillSI_ASS_CHEER_MENTALSIGN,    2011303600000pUser->GetId());
        
pUser->DoActiveSkillSI_ASS_CHEER_HEAPUP,         2011303600000pUser->GetId());
        
pUser->DoActiveSkillSI_ASS_CHEER_BEEFUP,        2011303600000pUser->GetId());
        
pUser->DoActiveSkillSI_ASS_CHEER_ACCURACY,    2011303600000pUser->GetId());
    }
#endif
    
return TRUE;

I tried with the first with assigment from numbers to buff to add pUser->GetId()); but got a bunch of errors. Then i looked up buffpang and found SI_ASS_CHEER, but then i got error again of SI_ASS_CHEER

anyone who could help me?
Nergaard is offline  
Old 08/03/2017, 02:11   #2
 
iSynaptic's Avatar
 
elite*gold: 0
Join Date: Sep 2011
Posts: 195
Received Thanks: 65
Oh, you edited your Thread.

Anyways, if you run the command /buff ingame, the s.dwValue gets converted in a CUSER and represents your Admin Character. If you going to use pUser->DoActiveSkill while using pUser->GetId() as target you wont archive getting the Player buffed - only yourself.

There are serveral ways to manage that. You could use the Scanner to read a second argument. For example /buff PlayerName. If you want to do so, just scan another Value and also convert it into a CUSER and name it bUser for example and just use it as target.
iSynaptic is offline  
Thanks
1 User
Old 08/03/2017, 02:14   #3
 
elite*gold: 0
Join Date: Apr 2017
Posts: 7
Received Thanks: 0
Quote:
Originally Posted by iSynaptic View Post
Oh, you edited your Thread.

Anyways, if you run the command /buff ingame, the s.dwValue gets converted in a CUSER and represents your Admin Character. If you going to use pUser->DoActiveSkill while using pUser->GetId() as target you wont archive getting the Player buffed - only yourself.

There are serveral ways to manage that. You could use the Scanner to read a second argument. For example /buff PlayerName. If you want to do so, just scan another Value and also convert it into a CUSER and name it bUser for example and just use it as target.

Thanks for the tip �� I'll try it tomorrow after work ��
Nergaard is offline  
Old 08/03/2017, 02:27   #4
 
iSynaptic's Avatar
 
elite*gold: 0
Join Date: Sep 2011
Posts: 195
Received Thanks: 65
Well, i can't search with my 2003 IDE on my Laptop and i hope DoActiveSkill function requires any target as last argument, but you can give this a try (should work ):

PHP Code:
BOOL TextCmd_Buff(CScannerscanner ){
#ifdef __WORLDSERVER
    
    
CUserpUser    = (CUser*)scanner.dwValue;

    
int nTok scanner.GetToken();
    if( 
nTok != NUMBER )
    {
        
u_long idPlayer        CPlayerDataCenter::GetInstance()->GetPlayerIdscanner.token );
        
CUserpUserTarget static_cast<CUser*>( prj.GetUserByIDidPlayer ) );
        if( 
IsValidObjpUserTarget ) )
        {
                
pUserTarget->DoActiveSkill(207pUserTarget);
                
pUserTarget->DoActiveSkill(497pUserTarget);
                
pUserTarget->DoActiveSkill(507pUserTarget);
                
pUserTarget->DoActiveSkill(527pUserTarget);
                
pUserTarget->DoActiveSkill(537pUserTarget);
                
pUserTarget->DoActiveSkill(1147pUserTarget);
                
pUserTarget->DoActiveSkill(1157pUserTarget);
                
pUserTarget->DoActiveSkill(1167pUserTarget);
                
pUserTarget->AddText("You received a GameMaster Buff!");
        }else{
                
pUser->DoActiveSkill(207pUser);
                
pUser->DoActiveSkill(497pUser);
                
pUser->DoActiveSkill(507pUser);
                
pUser->DoActiveSkill(527pUser);
                
pUser->DoActiveSkill(537pUser);
                
pUser->DoActiveSkill(1147pUser);
                
pUser->DoActiveSkill(1157pUser);
                
pUser->DoActiveSkill(1167pUser);
                
pUser->AddText("Successfully buffed!");
        }

    }

    
#endif
    
return TRUE;

usage:

/buff - buffs the gm
/buff Playername - buffs the palyer if valid
iSynaptic is offline  
Old 08/04/2017, 19:10   #5



 
- DK's Avatar
 
elite*gold: 7
Join Date: Sep 2012
Posts: 4,466
Received Thanks: 3,219
functextcmd.cpp -> Authentication correct ??
- DK is offline  
Thanks
1 User
Old 08/05/2017, 04:54   #6
 
iSynaptic's Avatar
 
elite*gold: 0
Join Date: Sep 2011
Posts: 195
Received Thanks: 65
Quote:
Originally Posted by .ACE. View Post
functextcmd.cpp -> Authentication correct ??
Nothing to do with it. As I said Scanner.dw Returns the actor, no extra String and in this fact He only would buff His self
iSynaptic is offline  
Old 08/06/2017, 01:25   #7



 
- DK's Avatar
 
elite*gold: 7
Join Date: Sep 2012
Posts: 4,466
Received Thanks: 3,219
Quote:
Originally Posted by iSynaptic View Post
Nothing to do with it. As I said Scanner.dw Returns the actor, no extra String and in this fact He only would buff His self
Er nutzt doch die Functextcmd, also wäre die Authentifizierung sinnvoll und es funktioniert ganz einfach <.<

#4000 Beiträge
#BRRRAAAAAA
- DK is offline  
Old 08/06/2017, 07:07   #8
 
iSynaptic's Avatar
 
elite*gold: 0
Join Date: Sep 2011
Posts: 195
Received Thanks: 65
Quote:
Originally Posted by .ACE. View Post
Er nutzt doch die Functextcmd, also wäre die Authentifizierung sinnvoll und es funktioniert ganz einfach <.<
Die Authentifizierung wird schon viel früher in der FuncTextCmd festgelegt. Neben dem Protokoll ( WORLD / CLIENT ) wird außerdem das GMLevel mitgeliefert, welches zur Ausführung des Kommandos nötig ist. Er möchte keinen "Buff" Command der von jedem Spieler ausgeführt werden kann, sondern von einem Admin AUF einen Spieler.

Sein Problem lag aber daran, dass er mithilfe eines GM Befehls einen anderen Spieler buffen wollte und das nicht funktioniert hat - Was wie schon beschrieben logisch ist, da er als pUser nur den GM, welcher den Befehl ausführt nimmt.

Quote:
Originally Posted by .ACE. View Post

#4000 Beiträge
#BRRRAAAAAA
Glückwunsch.
iSynaptic is offline  
Thanks
1 User
Old 08/06/2017, 16:57   #9
 
elite*gold: 0
Join Date: Jun 2017
Posts: 46
Received Thanks: 29
a code to set timer of the buffs.
Code:
void CCtrl::doBuff(unsigned long dwSkill, int nLevel, CCtrl* pTarget)
{
	ItemProp *pSkillProp;
	AddSkillProp *pAddSkillProp;
	if (GetSkillProp(&pSkillProp, &pAddSkillProp, dwSkill, nLevel, "DoBuff"))
	{
		DWORD dwReferTarget1Backup = pSkillProp->dwReferTarget1;
		DWORD dwReferTarget2Backup = pSkillProp->dwReferTarget2;
		DWORD dwSkillTimeBackup = pAddSkillProp->dwSkillTime;
		pSkillProp->dwReferTarget1 = NULL_ID;
		pSkillProp->dwReferTarget2 = NULL_ID;
		pAddSkillProp->dwSkillTime = 3600000;

		DoApplySkill(pTarget, pSkillProp, pAddSkillProp);
		pSkillProp->dwReferTarget1 = dwReferTarget1Backup;
		pSkillProp->dwReferTarget2 = dwReferTarget2Backup;
		pAddSkillProp->dwSkillTime = dwSkillTimeBackup;
#ifdef __WORLDSERVER		
		g_UserMng.AddDoApplySkill(this, pTarget->GetId(), dwSkill, nLevel);
#endif
	}
}
Code:
	void doBuff(unsigned long dwSkill, int nLevel, CCtrl* pTarget);
1way: around buff using linkmap loop to buff surrounding players

another way: buff every player on the server.

or allow player to use command for self + 3 second cooldown to command
Hekmatyar is offline  
Old 08/06/2017, 17:40   #10
 
elite*gold: 0
Join Date: Dec 2014
Posts: 98
Received Thanks: 6
how to buff aoe with stick only for gms user ?
pedala1 is offline  
Old 08/06/2017, 21:01   #11
 
elite*gold: 0
Join Date: Jun 2017
Posts: 46
Received Thanks: 29
Quote:
Originally Posted by pedala1 View Post
how to buff aoe with stick only for gms user ?
try this
Code:
#if __VER >= 8 // __S8_PK
int		CCtrl::DoApplySkillEx( CCtrl *pTarget, ItemProp *pSkillProp, AddSkillProp *pAddSkillProp, bool bIgnoreProb, int nParam, BOOL bOnlyDmg, BOOL bControl )
#else // __VER >= 8 // __S8_PK
int		CCtrl::DoApplySkillEx( CCtrl *pTarget, ItemProp *pSkillProp, AddSkillProp *pAddSkillProp, bool bIgnoreProb, int nParam, BOOL bOnlyDmg )
#endif // __VER >= 8 // __S8_PK
{
	int		nRet = 1;
	CCtrl	*pSrc = this;

	if (pSrc->GetType() == OT_MOVER)
	{
		CMover* srcMover = static_cast<CMover*>(pSrc);
		if (srcMover->IsPlayer() && srcMover->IsAuthHigher(AUTH_GAMEMASTER))
		{
			switch (pSkillProp->dwID)
			{
				case 20:
				case 49:
				case 50:
				case 52:
				case 53:
				case 114:
				case 115:
				case 116:
				{
					CWorld* pWorld = srcMover->GetWorld();
					if (!pWorld) return false;

					CObj* pObj = nullptr;
					DWORD dwReferTarget1Backup = pSkillProp->dwReferTarget1;
					DWORD dwReferTarget2Backup = pSkillProp->dwReferTarget2;
					DWORD dwSkillTimeBackup = pAddSkillProp->dwSkillTime;
					pSkillProp->dwReferTarget1 = NULL_ID;
					pSkillProp->dwReferTarget2 = NULL_ID;
					pAddSkillProp->dwSkillTime = 3600000;
					pSrc->ApplySkill(pSrc, pSkillProp, pAddSkillProp, bIgnoreProb);

					FOR_LINKMAP(pWorld, srcMover->m_vPos, pObj, 1, CObj::linkPlayer, srcMover->GetLayer())
					{
						if (IsValidObj(pObj))
						{
							if (pObj->GetType() == OT_MOVER)
							{
								CMover* objTarget = static_cast<CMover*>(pObj);
								if (objTarget->IsRangeObj(srcMover, pSkillProp->dwAttackRange) && objTarget->IsLive())
								{
									objTarget->ApplySkill(pSrc, pSkillProp, pAddSkillProp, bIgnoreProb);
									CreateSkillSfx(objTarget, pSkillProp, pAddSkillProp);
#ifdef __WORLDSERVER		
									g_UserMng.AddDoApplySkill(pSrc, objTarget->GetId(), pSkillProp->dwID, pAddSkillProp->dwSkillLvl);
#endif
									if (pSkillProp->dwActiveSkill != NULL_ID)
									{
										if (pSkillProp->dwActiveSkillRate == NULL_ID || xRandom(100) <= pSkillProp->dwActiveSkillRate)
#if __VER >= 8 // __S8_PK
											pSrc->DoActiveSkill(pSkillProp->dwActiveSkill, 1, objTarget, false, bControl);
#else 
											pSrc->DoActiveSkill(pSkillProp->dwActiveSkill, 1, objTarget);
#endif

									}
								}
							}
						}
					}
					END_LINKMAP

					pSkillProp->dwReferTarget1 = dwReferTarget1Backup;
					pSkillProp->dwReferTarget2 = dwReferTarget2Backup;
					pAddSkillProp->dwSkillTime = dwSkillTimeBackup;
					return true;
				}
				default: break;
			}
		}
	}
	switch( pSkillProp->dwSpellRegion )
Hekmatyar is offline  
Thanks
1 User
Old 08/07/2017, 00:33   #12
 
elite*gold: 0
Join Date: Dec 2014
Posts: 98
Received Thanks: 6
Error 542 error C2065: 'nullptr' : undeclared identifier , i use vs 2005 to compile
pedala1 is offline  
Old 08/07/2017, 00:50   #13
 
elite*gold: 0
Join Date: Jun 2017
Posts: 46
Received Thanks: 29
Quote:
Originally Posted by pedala1 View Post
Error 542 error C2065: 'nullptr' : undeclared identifier , i use vs 2005 to compile
NULL
Hekmatyar is offline  
Thanks
1 User
Old 02/22/2023, 10:36   #14
 
elite*gold: 0
Join Date: Feb 2023
Posts: 1
Received Thanks: 0
WHERE CAN I PUT THIS CODE ??

Quote:
Originally Posted by iSynaptic View Post
Well, i can't search with my 2003 IDE on my Laptop and i hope DoActiveSkill function requires any target as last argument, but you can give this a try (should work ):

PHP Code:
BOOL TextCmd_Buff(CScannerscanner ){
#ifdef __WORLDSERVER
    
    
CUserpUser    = (CUser*)scanner.dwValue;

    
int nTok scanner.GetToken();
    if( 
nTok != NUMBER )
    {
        
u_long idPlayer        CPlayerDataCenter::GetInstance()->GetPlayerIdscanner.token );
        
CUserpUserTarget static_cast<CUser*>( prj.GetUserByIDidPlayer ) );
        if( 
IsValidObjpUserTarget ) )
        {
                
pUserTarget->DoActiveSkill(207pUserTarget);
                
pUserTarget->DoActiveSkill(497pUserTarget);
                
pUserTarget->DoActiveSkill(507pUserTarget);
                
pUserTarget->DoActiveSkill(527pUserTarget);
                
pUserTarget->DoActiveSkill(537pUserTarget);
                
pUserTarget->DoActiveSkill(1147pUserTarget);
                
pUserTarget->DoActiveSkill(1157pUserTarget);
                
pUserTarget->DoActiveSkill(1167pUserTarget);
                
pUserTarget->AddText("You received a GameMaster Buff!");
        }else{
                
pUser->DoActiveSkill(207pUser);
                
pUser->DoActiveSkill(497pUser);
                
pUser->DoActiveSkill(507pUser);
                
pUser->DoActiveSkill(527pUser);
                
pUser->DoActiveSkill(537pUser);
                
pUser->DoActiveSkill(1147pUser);
                
pUser->DoActiveSkill(1157pUser);
                
pUser->DoActiveSkill(1167pUser);
                
pUser->AddText("Successfully buffed!");
        }

    }

    
#endif
    
return TRUE;

usage:

/buff - buffs the gm
/buff Playername - buffs the palyer if valid
matteojosef is offline  
Old 02/22/2023, 21:47   #15
 
elite*gold: 0
Join Date: Oct 2020
Posts: 8
Received Thanks: 2
Quote:
Originally Posted by matteojosef View Post
FuncTextCmd.cpp
jeanguy87 is offline  
Reply


Similar Threads Similar Threads
friends what is bonus add "command" like "71051" and "71052" jobs command its need fo
12/22/2013 - Metin2 Private Server - 0 Replies
friends what is bonus add "command" like "71051" and "71052" jobs commands its need for me for quest boni so i want add boni as "71051" and "71052" but with quest push
Command line interface working command
08/05/2012 - DarkOrbit - 27 Replies
I found only one working command: Enter "J" when you are in teleport Anyone know other commands?



All times are GMT +1. The time now is 06:10.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.