• 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!

TalkAction Add VIP to a player | Remove VIP of a player

Xampy

PHP | SQL | LUA | C++
Joined
Jun 22, 2008
Messages
1,109
Reaction score
17
Hello!

I will post for you my script to add or remove the VIP of a player you want to. I don't know if there's any similar script here, but I will post it. If there's any other script like mine, Admins, close this thread if you want to.

Let's go:

TFS 0.2+

Go to data/talkactions/scripts/ and create a file called vip.lua and copy this into the file:
Code:
function onSay(cid,words,param)

local requiredGroup = 3

local vipStorageValue = [COLOR="DarkOrchid"]11551[/COLOR]

local target = getPlayerByName(param)

	if words == '/addvip' then	
	
		if target > 0 then
		if getPlayerGroupId(cid) >= requiredGroup and param ~= "" and getPlayerStorageValue(target, vipStorageValue) == -1 then 
			adminName = getPlayerName(cid) 		
			setPlayerStorageValue(target, vipStorageValue, 1)			
			doPlayerSendTextMessage(target, MESSAGE_STATUS_CONSOLE_BLUE, 'You are now a V.I.P. member. '..adminName..' gave you the V.I.P.') 			
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You made a V.I.P. member to "..param..".")			

		elseif getPlayerGroupId(cid) < requiredGroup then		
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't make V.I.P. member to anyone.")
			
		elseif getPlayerStorageValue(target, vipStorageValue) ~= -1 then		
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This player is already a V.I.P. member.")
		end
		else
				doPlayerSendTextMessage(cid, 21, "This player doesn't exists or is not online.")
		
		end
		

	elseif words == '/takevip' then	
	
		if target > 0 then
		if getPlayerGroupId(cid) >= requiredGroup and param ~= "" and getPlayerStorageValue(target, vipStorageValue) == 1 then
			adminName = getPlayerName(cid) 		
			setPlayerStorageValue(target, vipStorageValue, -1)			
			doPlayerSendTextMessage(target, MESSAGE_STATUS_CONSOLE_BLUE, 'You are now a normal player. '..adminName..' took your V.I.P.') 			
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You took the V.I.P. of "..param..".")			

		elseif getPlayerGroupId(cid) < requiredGroup then		
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't take the V.I.P. of anyone.")
			
		elseif getPlayerStorageValue(target, vipStorageValue) ~= 1 then		
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This player is not a V.I.P. member.")
		end
		else
				doPlayerSendTextMessage(cid, 21, "This player doesn't exists or is not online.")
		
		end
end		
end
Change the "11551" to the StorageValue of your VIP.

Now, go to data/talkactions/talkactions.xml, open it and put, under <talkactions>:
Code:
	<talkaction words="/addvip" script="vip.lua"/>
	<talkaction words="/takevip" script="vip.lua"/>
Now, in your server you must put this commands (in my case, the player name = Xampy):
Code:
/addvip "Xampy
/takevip "Xampy

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

TFS 0.3+

Go to data/talkactions/scripts/ and create a file called vip.lua and copy this into the file:
Code:
function onSay(cid,words,param)

local requiredGroup = 3

local vipStorageValue = [COLOR="DarkOrchid"]11551[/COLOR]

local target = getPlayerByNameWildcard(param)

	if words == '/addvip' then	
	
		if target > 0 then
		if getPlayerGroupId(cid) >= requiredGroup and param ~= "" and getPlayerStorageValue(target, vipStorageValue) == -1 then 
			adminName = getPlayerName(cid) 		
			setPlayerStorageValue(target, vipStorageValue, 1)			
			doPlayerSendTextMessage(target, MESSAGE_STATUS_CONSOLE_BLUE, 'You are now a V.I.P. member. '..adminName..' gave you the V.I.P.') 			
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You made a V.I.P. member to "..param..".")			

		elseif getPlayerGroupId(cid) < requiredGroup then		
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't make V.I.P. member to anyone.")
			
		elseif getPlayerStorageValue(target, vipStorageValue) ~= -1 then		
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This player is already a V.I.P. member.")
		end
		else
				doPlayerSendTextMessage(cid, 21, "This player doesn't exists or is not online.")
		
		end
		

	elseif words == '/takevip' then	
	
		if target > 0 then
		if getPlayerGroupId(cid) >= requiredGroup and param ~= "" and getPlayerStorageValue(target, vipStorageValue) == 1 then
			adminName = getPlayerName(cid) 		
			setPlayerStorageValue(target, vipStorageValue, -1)			
			doPlayerSendTextMessage(target, MESSAGE_STATUS_CONSOLE_BLUE, 'You are now a normal player. '..adminName..' took your V.I.P.') 			
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You took the V.I.P. of "..param..".")			

		elseif getPlayerGroupId(cid) < requiredGroup then		
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't take the V.I.P. of anyone.")
			
		elseif getPlayerStorageValue(target, vipStorageValue) ~= 1 then		
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This player is not a V.I.P. member.")
		end
		else
				doPlayerSendTextMessage(cid, 21, "This player doesn't exists or is not online.")
		
		end
end		
return TRUE
end
Change the "11551" to the StorageValue of your VIP.

Now, go to data/talkactions/talkactions.xml, open it and put, under <talkactions>:
Code:
	<talkaction log="yes" words="/addvip" event="script" value="vip.lua"/>
	<talkaction log="yes" words="/takevip" event="script" value="vip.lua"/>
Now, in your server you must put this commands (in my case, the player name = Xampy):
Code:
/addvip Xampy
/takevip Xampy

That's all.:thumbup:
 
Last edited:
I like it but it isn't really vip, because vip is over the whole account and this is for 1 character.
 
Well, I know, but in my server was per player, not by account. Then, I will make per account tomorrow, I gonna sleep now.

Thanks.
 
Error:

Code:
[12/04/2009 15:11:51] Lua Script Error: [TalkAction Interface] 
[12/04/2009 15:11:51] data/talkactions/scripts/vip.lua:onSay

[12/04/2009 15:11:51] data/talkactions/scripts/vip.lua:11: attempt to compare number with nil
[12/04/2009 15:11:51] stack traceback:
[12/04/2009 15:11:51] 	data/talkactions/scripts/vip.lua:11: in function <data/talkactions/scripts/vip.lua:1>

Please script for TFS 0.3.3 for 8.41.
 
Error:

Code:
[12/04/2009 15:11:51] Lua Script Error: [TalkAction Interface] 
[12/04/2009 15:11:51] data/talkactions/scripts/vip.lua:onSay

[12/04/2009 15:11:51] data/talkactions/scripts/vip.lua:11: attempt to compare number with nil
[12/04/2009 15:11:51] stack traceback:
[12/04/2009 15:11:51] 	data/talkactions/scripts/vip.lua:11: in function <data/talkactions/scripts/vip.lua:1>

Please script for TFS 0.3.3 for 8.41.

same, help.
 
For 0.3.x:

Code:
function onSay(cid,words,param)

local requiredGroup = 3

local vipStorageValue = 11551

local target = getPlayerByNameWildcard(param)

	if words == '/addvip' then	
	
		if target > 0 then
		if getPlayerGroupId(cid) >= requiredGroup and param ~= "" and getPlayerStorageValue(target, vipStorageValue) == -1 then 
			adminName = getPlayerName(cid) 		
			setPlayerStorageValue(target, vipStorageValue, 1)			
			doPlayerSendTextMessage(target, MESSAGE_STATUS_CONSOLE_BLUE, 'You are now a V.I.P. member. '..adminName..' gave you the V.I.P.') 			
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You made a V.I.P. member to "..param..".")			

		elseif getPlayerGroupId(cid) < requiredGroup then		
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't make V.I.P. member to anyone.")
			
		elseif getPlayerStorageValue(target, vipStorageValue) ~= -1 then		
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This player is already a V.I.P. member.")
		end
		else
				doPlayerSendTextMessage(cid, 21, "This player doesn't exists or is not online.")
		
		end
		

	elseif words == '/takevip' then	
	
		if target > 0 then
		if getPlayerGroupId(cid) >= requiredGroup and param ~= "" and getPlayerStorageValue(target, vipStorageValue) == 1 then
			adminName = getPlayerName(cid) 		
			setPlayerStorageValue(target, vipStorageValue, -1)			
			doPlayerSendTextMessage(target, MESSAGE_STATUS_CONSOLE_BLUE, 'You are now a normal player. '..adminName..' took your V.I.P.') 			
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You took the V.I.P. of "..param..".")			

		elseif getPlayerGroupId(cid) < requiredGroup then		
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't take the V.I.P. of anyone.")
			
		elseif getPlayerStorageValue(target, vipStorageValue) ~= 1 then		
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This player is not a V.I.P. member.")
		end
		else
				doPlayerSendTextMessage(cid, 21, "This player doesn't exists or is not online.")
		
		end
end		
return TRUE
end

Talkactions examples:
Code:
/addvip Xampy
/takevip Xampy

The full code and tutorial is on the main post.

Regards.
 
Last edited:
Working, very nice! Rep+++++++, can you create one script for me?

When one player log, the server check you storagevalue if storagevalue is 555112 add +2 xp in you experiencie..

Example my server is 15x, if player is vip xp go to 17x
using this function: setPlayerExtraExpRate(cid, value).

ty bye, tks for script :)
 
Last edited:
Something liek this ?

Code:
function onLogin(cid)
local status = getPlayerStorageValue(cid, 555112)
	if(status == 1) then
        setPlayerExtraExpRate(cid, 2)
	end
	return TRUE
end
 
Don't work, i need disable stages xp ?

is correct in creaturescripts:
<event type="login" name="PlayerLogin" script="vip1.lua"/>

tks for reply.

in console say nothing error :/
 
In creaturescripts/creaturescripts.xml you must put this:

PHP:
<event type="login" name="ExtraExp" script="ExtraExp.lua"/>

In creaturescripts/scripts/ create a new file called ExtraExp.lua and copy this into it and, afther that, save it:
PHP:
-- Script by Don Daniello xD --

function onLogin(cid)

local status = getPlayerStorageValue(cid, 11551)

	if (status == 1) then
		setPlayerExtraExpRate(cid, 2)
	end
return TRUE
end

Go to creaturescripts/scripts/ and open login.lua. Below registerCreatureEvent(cid, "PlayerDeath") write:
PHP:
registerCreatureEvent(cid, "ExtraExp")

I didn't test it, so I don't know that if you level up the exp-rate will change or not (if you have stages activated ofc, if not, don't worry).

Regards.
 
@Rogil:
It must work for everybody who uses TFS 0.2.x or TFS 0.3.x (TFS users ofc). Maybe you did something wrong.


@Fakaa:
Thanks :p
 
@up:
These talkactions are for Add VIP (permanently)/Remove VIP per player. If you want to use VIP by days, go to this thread.

Regards.
 
@up:

What error messages do you get in console?
 
Back
Top