• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Feature Anti raibow Outfit!

slaw

Software Developer
Joined
Aug 27, 2007
Messages
3,667
Solutions
125
Reaction score
1,114
Location
Germany
GitHub
slawkens
Working with TAGS/0.2 and TRUNK :)

player.cpp
After:
PHP:
	nextAction = 0;
Add:
PHP:
	lastOutfitChange = 0;
player.h
After:
PHP:
		int64_t nextAction;
Add:
PHP:
		#ifdef __SLAW_ANTI_RAINBOW__
		int64_t lastOutfitChange;
		#endif

After:
PHP:
		uint32_t getNextActionTime() const;
Add:
PHP:
		#ifdef __SLAW_ANTI_RAINBOW__
		void setNextOutfitChange(uint64_t time) {if(time > lastOutfitChange) {lastOutfitChange = time;}}
		bool canChangeOutfit() const {return lastOutfitChange <= OTSYS_TIME();}
		#endif

game.cpp
In function:
PHP:
bool Game::playerChangeOutfit(uint32_t playerId, Outfit_t outfit)
After:
PHP:
	Player* player = getPlayerByID(playerId);
	if(!player || player->isRemoved())
		return false;
Add:
PHP:
	#ifdef __SLAW_ANTI_RAINBOW__
	if(!player->canChangeOutfit())
		return false;
	#endif
And after:
PHP:
		internalCreatureChangeOutfit(player, outfit);
Add:
PHP:
		#ifdef __SLAW_ANTI_RAINBOW__
		player->setNextOutfitChange(OTSYS_TIME() + 2000);
		#endif

Where, 2000 = delay betweew changing outfits.

Well, now you are protected :D!
 
Last edited:
There's already some minor protection code in TFS against this, you have to request the change outfit window before you can set a new outfit.
 
@Tala

But maybe some bots can first send request, and next set? ; o

[Update]
Added player.cpp part ;!
 
@Tala

But maybe some bots can first send request, and next set? ; o

[Update]
Added player.cpp part ;!

The thing is that majority of bot developers doesn't think about that since it works fine on CipSoft's server without requesting, so you can even use the code in TFS to find out who cheat (checking who tried to set outfit without requesting outfit window first).
 
You forgot this part in player.h?
Code:
        #ifdef __SLAW_ANTI_RAINBOW__
        int64_t lastOutfitChange;
        #endif
 
Yes you forgot ; |

player.h

int64_t lastOutfitChange;

You havent this, or missspelled. Or forgot to remove __SLAW_ANTI_RAWINBOW__
 
Back
Top