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

Xampy

PHP | SQL | LUA | C++
Joined
Jun 22, 2008
Messages
1,104
Best answers
0
Reaction score
16
Location
Barcelona (Spain)
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:

Master-m

Need help? Just ask!
Joined
May 28, 2007
Messages
4,339
Best answers
0
Reaction score
15
Location
The Netherlands
I like it but it isn't really vip, because vip is over the whole account and this is for 1 character.
 
OP
X

Xampy

PHP | SQL | LUA | C++
Joined
Jun 22, 2008
Messages
1,104
Best answers
0
Reaction score
16
Location
Barcelona (Spain)
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.
 

Jhon Herbert

I'm a Brazilian :P
Joined
Jan 28, 2009
Messages
5
Best answers
0
Reaction score
0
Location
Brazil
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.
 

xTremoxx

domasturb(cid, genital)
Joined
Aug 11, 2007
Messages
389
Best answers
0
Reaction score
4
Location
Brazil
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.
 
OP
X

Xampy

PHP | SQL | LUA | C++
Joined
Jun 22, 2008
Messages
1,104
Best answers
0
Reaction score
16
Location
Barcelona (Spain)
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:

xTremoxx

domasturb(cid, genital)
Joined
Aug 11, 2007
Messages
389
Best answers
0
Reaction score
4
Location
Brazil
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:

Don Daniello

/root
Staff member
Administrator
Joined
Apr 11, 2008
Messages
3,523
Best answers
15
Reaction score
931
Location
Proland
Something liek this ?

Code:
function onLogin(cid)
local status = getPlayerStorageValue(cid, 555112)
	if(status == 1) then
        setPlayerExtraExpRate(cid, 2)
	end
	return TRUE
end
 

xTremoxx

domasturb(cid, genital)
Joined
Aug 11, 2007
Messages
389
Best answers
0
Reaction score
4
Location
Brazil
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 :/
 
OP
X

Xampy

PHP | SQL | LUA | C++
Joined
Jun 22, 2008
Messages
1,104
Best answers
0
Reaction score
16
Location
Barcelona (Spain)
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.
 
OP
X

Xampy

PHP | SQL | LUA | C++
Joined
Jun 22, 2008
Messages
1,104
Best answers
0
Reaction score
16
Location
Barcelona (Spain)
@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
 
Top