• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

CreatureEvent Putting [v] at name of premiums

Antharaz

New Member
Joined
Jan 28, 2010
Messages
27
Reaction score
0
By: Antharaz
Tested: TFS 0.3.6
Database: mysql


Go to data/creaturescripts/scripts, open login.lua and put the code before the last return true:

Code:
	local id,nm,qry = getPlayerAccountId(cid),string.find (getCreatureName(cid), "(%[+)%v*(%]+)%s*"),""
	if isPremium(cid) and nm == nil then
		qry = "UPDATE `theforgottenserver`.`players` SET `name` = '[v] "..getCreatureName(cid).."' WHERE `players`.`account_id`= "..id..";"
	elseif (not isPremium(cid)) and nm ~= nil then
		local nnome = string.gsub(getCreatureName(cid), "(%[+)%v*(%]+)%s*", "")
		qry = "UPDATE `theforgottenserver`.`players` SET `name` = '"..nnome.."' WHERE `players`.`account_id`= "..id..";"
	end
	if qry ~= "" then
		db.executeQuery(qry)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You will be disconnected and will be required to put the login and password again.")
		addEvent(doRemoveThing,3000,cid)
	end
 
Last edited:
what is? explication please

I think is, your name in to the game is: GuHB, if you'r free, and if you'r vip it looks: [v]GuHB.

Nice! :)

It works if PREMIUM ACCOUNT (same as global) is you'r VIP way. If you'r using some of VIP scripts, you need yo change it.
 
bad way
this changes name instead of just showing tag? in it
but I can call it kinda creative
 
if you want a better version...

on players cpp..
[cpp]
std::string Player::getDescription(int32_t lookDistance) const
[/cpp]

add this
[cpp]
std::string str;
getStorage("storageid", str);
int32_t SRT = atoi(str.c_str());
[/cpp]

and now change here
[cpp]
{
s << nameDescription;
if(!hasCustomFlag(PlayerCustomFlag_HideLevel))
s << " (level " << level << ")";

s << ". " << (sex % 2 ? "He" : "She");
if(hasFlag(PlayerFlag_ShowGroupNameInsteadOfVocation))
s << " is " << group->getName();
else if(vocationId != 0)
s << " is " << vocation->getDescription();
else
s << " is a soul";

}[/cpp]

into
[cpp]
{
if(SRT == 1)
{
s << "[V] " << nameDescription;
else
s << nameDescription;
}
if(!hasCustomFlag(PlayerCustomFlag_HideLevel))
s << " (level " << level << ")";

s << ". " << (sex % 2 ? "He" : "She");
if(hasFlag(PlayerFlag_ShowGroupNameInsteadOfVocation))
s << " is " << group->getName();
else if(vocationId != 0)
s << " is " << vocation->getDescription();
else
s << " is a soul";

}[/cpp]

;~ enjoy
 
@knightxd

ty...

but i think that it will only change the description... if i change the name of player the description will change automatically
 
in 0.4, doPlayerChangeName can be used

otherwise, protocolgame.cpp
[cpp]msg->AddString(creature->getHideName() ? "" : creature->getName());[/cpp]
with
[cpp]msg->AddString(creature->getHideName() ? "" : (creature->getPlayer() && creature->getPlayer()->isPremium() ? "[v] " : "") + creature->getName());[/cpp]
 
Back
Top