TalkAction [Release] Mount if has completed Quest

Third Aid

Banned User
Joined
Dec 14, 2009
Messages
62
Best answers
0
Reaction score
0
Location
Sweden
Here's a simple script, information:
Player writes command: !mount
If player has completed a quest (has storage value 1)
His outfit changes to Orc Rider and the speed increases for 30 minutes
He can use the command again in 6 hours



talkactions/scripts/mount.lua
Lua:
function onSay(cid, words, param, channel)
	local againHour = 6 -- How many hours until they can use it again
	local speedAdd = 500 -- How much speed that should be added
	local outfit = 30 -- How many minutes they're faster and has the mount outfit
	
	if getPlayerStorageValue(cid, 13000) == 1 then 
		if getPlayerStorageValue(cid, 13001) <= 0 then
			doSetCreatureOutfit(cid, {lookType = 4, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}, outfit*60*1000)
			setPlayerStorageValue(cid, 13001, 1)
			addEvent(setPlayerStorageValue, againHour*60*60*1000, cid, 13001, 0)
			addEvent(doChangeSpeed, outfit*60*1000, cid, -speedAdd)
			doChangeSpeed(cid, speedAdd)
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
		else
		doPlayerSendCancel(cid, "You can only use this command every 6 hours.")
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
		end
	else
		doPlayerSendCancel(cid, "You haven't done the Orc Rider Quest!")
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
	end
return true
end

talkactions/talkactions.xml


PHP:
<talkaction words="!mount" event="script" value="mount.lua"/>

EDIT:
I just took a look at the script again and noticed that addEvent is there to set the players storage value to 0 again to make the player be able to do it again after 6 hours.
But if the player logs out and isn't online when 6 hours has passed wouldn't that make it so the storage value doesn't change?

I don't know if this works (my first script with database stuff included) and maybe the first one would work.
Lua:
function onSay(cid, words, param, channel)
	local againHour = 6 -- How many hours until they can use it again
	local speedAdd = 500 -- How much speed that should be added
	local outfit = 30 -- How many minutes they're faster and has the mount outfit
	local player = getPlayerGUID(cid)
	
	if getPlayerStorageValue(cid, 13000) == 1 then 
		if getPlayerStorageValue(cid, 13001) <= 0 then
			doSetCreatureOutfit(cid, {lookType = 4, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}, outfit*60*1000)
			setPlayerStorageValue(cid, 13001, 1)
			addEvent(setPlayerStorageValue, againHour*60*60*1000, cid, 13001, 0)
			addEvent(doChangeSpeed, outfit*60*1000, cid, -speedAdd)
			addEvent(db.executeQuery, againHour*60*60*1000, "UPDATE `player_storage` SET `value` = 0 WHERE `player_id` = " .. player .. " AND `key` = 13001;")
			doChangeSpeed(cid, speedAdd)
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
		else
		doPlayerSendCancel(cid, "You can only use this command every 6 hours.")
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
		end
	else
		doPlayerSendCancel(cid, "You haven't done the Orc Rider Quest!")
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
	end
return true
end

Would be nice if someone could tell me if the script above would work.
 
Last edited:

Rala Knighta

StCarlo! :]
Joined
Mar 25, 2008
Messages
629
Best answers
0
Reaction score
2
Location
Germany
Code:
                        doSetCreatureOutfit(cid, {lookType = 4, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}, outfit*60*1000)
Cool but i have to search the Outfit for Mounted Creatures like Orc rider? :/
Also good for a costum client server :D
 
OP
Third Aid

Third Aid

Banned User
Joined
Dec 14, 2009
Messages
62
Best answers
0
Reaction score
0
Location
Sweden
You just have to look in your monsters xml file to see the lookType of the creatures you want :)
 

dinodrain

New Member
Joined
Sep 22, 2009
Messages
31
Best answers
0
Reaction score
0
Can you edit this? but with 1 change, script is great but I want sth without time remaining and with second command which will "close" mount event.
Ty (rep++)
 
Last edited:

calum69

New Member
Joined
Aug 12, 2007
Messages
346
Best answers
0
Reaction score
3
Location
Great Britain
good script but it doesnt work to well, when you die it doesnt reset your player storage to 13000 again, so you can only use this 1x. well how it worked for me
 

calum69

New Member
Joined
Aug 12, 2007
Messages
346
Best answers
0
Reaction score
3
Location
Great Britain
can anyone sort this problem its a good script but just didnt reset the 6 hour limit
 

snowz

New Member
Joined
Oct 20, 2009
Messages
5
Best answers
0
Reaction score
1
.
 
Last edited:

Death Blower

I'm Ready.
Joined
Aug 19, 2011
Messages
49
Best answers
0
Reaction score
3
what does the player have to do to be able to be able to use the command !mount
 
Top