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

Help [2nd quest time)!!! TFS 0.3 beta2

scarface77

New Member
Joined
Dec 12, 2008
Messages
53
Reaction score
1
hello, I was wondering if there's any way to let a player second chance to make a quest, not to all players, the player could make all quests once again.

I mean to edit a player so he could make again all quests again- (including the quests he did before).

waiting for your rep~ thanks :thumbup:
 
You can make it on different ways...

But you need to know which storagevalues are used for the quests

I'll make you an example of how you could do it.

Copy and Paste this into the bottom of your functions.lua
Code:
function removePlayerMultiplyStorageValues(cid, storage)
	for _, storage in pairs(storage) do
		setPlayerStorageValue(cid, storage, -1)
	end
end

now you could make it a talkaction

Code:
function onSay(cid, words, param)
	if getPlayerGroupId(cid) == 6 then
		removePlayerMultiplyStorageValues(getPlayerByName(param),{100,3000,500,211,390}) -- put all the quest storage values in that table, so they will be set as not used
	else
		doPlayerSendCancel(cid,"You don't have the right access to use this.")
	end
	return FALSE
end


And this is what you have to put into talkactions.xml
Code:
<talkaction words="/resetquests" script="nameofthefile.lua"/>

now you could make it like /resetquests "Evil Hero


If you want it in another way just let me know...


kind regards, Evil Hero
 
@up
It will also reset addons ;p

How to make exception for
Code:
	for _, storage in pairs(storage) do
?

Nope it doesn't..

aslong as you don't put the storagevalue which is used for an addon in it, it wont remove it ;P

that's why i said he has to put every number manual in it.


kind regards, Evil Hero
 
You can make it on different ways...

But you need to know which storagevalues are used for the quests

I'll make you an example of how you could do it.

Copy and Paste this into the bottom of your functions.lua
Code:
function removePlayerMultiplyStorageValues(cid, storage)
	for _, storage in pairs(storage) do
		setPlayerStorageValue(cid, storage, -1)
	end
end

now you could make it a talkaction

Code:
function onSay(cid, words, param)
	if getPlayerGroupId(cid) == 6 then
		removePlayerMultiplyStorageValues(getPlayerByName(param),{100,3000,500,211,390}) -- put all the quest storage values in that table, so they will be set as not used
	else
		doPlayerSendCancel(cid,"You don't have the right access to use this.")
	end
	return FALSE
end


And this is what you have to put into talkactions.xml
Code:
<talkaction words="/resetquests" script="nameofthefile.lua"/>

now you could make it like /resetquests "Evil Hero


If you want it in another way just let me know...


kind regards, Evil Hero


ye, but it will alow all players to make the quests again,
my request is to let a player that I choose to be able making the qusts again.
 
ye, but it will alow all players to make the quests again,
my request is to let a player that I choose to be able making the qusts again.

Then you clearly didn't read what I wrote...

because you can choose which player do you want to do it...

or why do you think i made it a talkaction...


kind regards, Evil Hero
 
Nope it doesn't..

aslong as you don't put the storagevalue which is used for an addon in it, it wont remove it ;P

that's why i said he has to put every number manual in it.


kind regards, Evil Hero


Oh yeah, you're right, didn't read script fully so I thought that it will remove ALL storages >.>
 
Then you clearly didn't read what I wrote...

because you can choose which player do you want to do it...

or why do you think i made it a talkaction...


kind regards, Evil Hero



you right,
actually I wanted it to reset all of the quests, but it will take me ages to add 500 stoarge's.
is there any way to remove stoargeValue from XXXX to XXXX?
 
There you go...

This is the advanced one with exceptions

Code:
function removePlayerFromToStorageValues(cid, storage)
	for k,v in pairs(storage) do
		if (isNumber(k) and isNumber(v)) == TRUE then 
			if k < v then
				if k > 0 then
					if v > 0 then
						for a = k,v do
							setPlayerStorageValue(cid, a, -1)
						end
					else
						error("Table value has to be higher then 0")
					end
				else
					error("Table key has to be higher then 0")
				end
			else
				error("Table key has to be lower then Table value")
			end
		else
			error("Table value and key have to be numbers")
		end
	end
	return TRUE
end

here and example:

Code:
removePlayerFromToStorageValue(cid,{[100] = 300,[400] = 700})

This would set now the storagevalue from 100-300 and from 400-700 to not used.

and this is the one easier to use...

Code:
function removePlayerFromToStorageValues(cid, fromStorage, toStorage)
	if fromStorage < toStorage then
		if fromStorage > 0 then
			if toStorage > 0 then
				for a = fromStorage, toStorage do
					setPlayerStorageValue(cid, a, -1)
				end
			else
				error("toStorage has to be higher then 0")
			end
		else
			error("fromStorage has to be higher then 0")
		end
	else
		error("fromStorage has to be higher then toStorage!")
	end
end

example:

Code:
removePlayerFromToStorageValue(cid,300,500)

This would set the storage value 300-500 to not used.


kind regards, Evil Hero
 
There you go...

This is the advanced one with exceptions

Code:
function removePlayerFromToStorageValues(cid, storage)
	for k,v in pairs(storage) do
		if (isNumber(k) and isNumber(v)) == TRUE then 
			if k < v then
				if k > 0 then
					if v > 0 then
						for a = k,v do
							setPlayerStorageValue(cid, a, -1)
						end
					else
						error("Table value has to be higher then 0")
					end
				else
					error("Table key has to be higher then 0")
				end
			else
				error("Table key has to be lower then Table value")
			end
		else
			error("Table value and key have to be numbers")
		end
	end
	return TRUE
end

here and example:

Code:
removePlayerFromToStorageValue(cid,{[100] = 300,[400] = 700})

This would set now the storagevalue from 100-300 and from 400-700 to not used.

and this is the one easier to use...

Code:
function removePlayerFromToStorageValues(cid, fromStorage, toStorage)
	if fromStorage < toStorage then
		if fromStorage > 0 then
			if toStorage > 0 then
				for a = fromStorage, toStorage do
					setPlayerStorageValue(cid, a, -1)
				end
			else
				error("toStorage has to be higher then 0")
			end
		else
			error("fromStorage has to be higher then 0")
		end
	else
		error("fromStorage has to be higher then toStorage!")
	end
end

example:

Code:
removePlayerFromToStorageValue(cid,300,500)

This would set the storage value 300-500 to not used.


kind regards, Evil Hero


i get this error when i use /resetquests "Playaname

[05/02/2009 18:43:14] Lua Script Error: [TalkAction Interface]
[05/02/2009 18:43:14] data/talkactions/scripts/quest.lua:eek:nSay

[05/02/2009 18:43:14] luaSetPlayerStorageValue(). Player not found

:confused:
 
did you maybe spelt the playername wrong?

because it should work normally...

If you still get the error then pm me for my msn so we can talk over there...

kind regards, Evil Hero
 
Back
Top