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

Script - Help

Zippow

Member
Joined
Aug 27, 2011
Messages
454
Reaction score
21
Location
Sweden
How do i make so i can only use it once?
This is the script that i've made

Code:
function onSay(cid, words, param)
if doPlayerAddItem(cid, 3043, 25) == TRUE then 
doSendMagicEffect(getPlayerPosition(cid), 30)
 doPlayerSendTextMessage(cid,22,"You Obtained 25cc")
 
Try this

Lua:
function onSay(cid, words, param)

if getPlayerStorageValue(cid,29053) == 14 
	doCreatureSay(cid, "You have already recieved this xxxx!", TALKTYPE_ORANGE_1)

else if doPlayerAddItem(cid, 3043, 25) == TRUE then 
       setPlayerStorageValue(cid,29053,14)
       doSendMagicEffect(getPlayerPosition(cid), 30)
       doPlayerSendTextMessage(cid,22,"You Obtained 25cc")
  end
	
end



It's not tested but it should work
 
I've tried it, fixed some errors, but i can still use it how much as i wan't, any ideas?

Code:
function onSay(cid, words, param)
        if getPlayerStorageValue(cid, 29053) == 14
then doCreatureSay(cid, "You've Already Recieved 25cc", TALKTYPE_ORNAGE_1) 
           
        elseif doPlayerAddItem(cid, 2160, 25) == TRUE then
doSendMagicEffect(getPlayerPosition(cid), 30)
 doPlayerSendMessage(cid,22, "You've Obtained 25cc")
 setPlayerStorageValue(cid, 29053, 14)
        end
        return TRUE
end
 
Add this

Lua:
queststatus = getPlayerStorageValue(cid,9869)
if queststatus == -1 then
 
 
doPlayerSetStorageValue(cid, 9869, 1)

First 2 lines at the beginning, last line at the end.
 
Getting debugs in-game, no errrors in the console tho ;)

Code:
function onSay(cid, words, param)
        queststatus = getPlayerStorageValue(cid,9869)
if queststatus == -1 then
doCreatureSay(cid, "You've Already Recieved 25cc", TALKTYPE_ORNAGE_1) 
           
        elseif doPlayerAddItem(cid, 2160, 25) == TRUE then
doSendMagicEffect(getPlayerPosition(cid), 30)
 doPlayerSendMessage(cid,22, "You've Obtained 25cc")
 doPlayerSetStorageValue(cid, 9869, 1)
        end
        return TRUE
end
 
use this :
Lua:
function onSay(cid, words, param)
         if getPlayerStorageValue(cid, 9999, - 1) then 
         doSendMagicEffect(getPlayerPosition(cid), 30)
         doPlayerSendTextMessage(cid,22,"You've Obtained 25cc")
         setPlayerStorageValue(cid, 9999, 1)
         doPlayerAddItem(cid, 2160, 25)
         end
    return 1
end
 
Last edited:
Lua:
function onSay(cid, words, param)
         if getPlayerStorageValue(cid, 9999, - 1) then 
         doSendMagicEffect(getPlayerPosition(cid), 30)
         doPlayerSendTextMessage(cid,22,"You've Obtained 25cc")
         doPlayerSetStorageValue(cid, 9999, 1)
         doPlayerAddItem(cid, 2160, 25)
         end
    return 1
end
 
Still getting the Error

Code:
Error - TalkAction Interface
data/talkactions/scripts/obtain.lua:onSay
Description:
<luaGetCreatureStorage> Creature not found
 
Last edited:
Lua:
function onSay(cid, words, param)
 
	queststatus = getPlayerStorageValue(cid,9869)
	if queststatus == -1 then
	doPlayerAddItem(cid, 2160, 25)
	doSendMagicEffect(getPlayerPosition(cid), 30)
	doPlayerSendTextMessage(cid,22,"You Obtained 25cc")
        doPlayerSetStorageValue(cid, 9869, 1)
	else
        doPlayerSendCancel(cid, "You already recieved it!")
	end
end
 
Fixed some errors and removed the local from the upper script.
Lua:
function onSay(cid, words, param)
	if getPlayerStorageValue(cid,9009) <= 0 then
                doPlayerSetStorageValue(cid, 9869, 1)
		doPlayerAddItem(cid, 2160, 25)
		doSendMagicEffect(getPlayerPosition(cid), 30)
                doPlayerSendTextMessage(cid,22,"You have obtained 25cc")
		else
                doPlayerSendCancel(cid, "You already recieved it!")
end
return true
end

If this didn't work then tell me the version of TFS you are using and try to use this

Lua:
function onSay(cid, words, param)
	if getPlayerStorageValue(cid,9009) <= 0 then
                doPlayerSetStorageValue(cid, 9869, 1)
		doPlayerAddItem(cid, 2160, 25)
                doSendMagicEffect(getCreaturePosition(cid), CONST_ME_CAKE)
                doPlayerSendTextMessage(cid,22,"You have obtained 25cc")
		else
                doPlayerSendCancel(cid, "You already recieved it!")
end
return true
end
 
Last edited:
Back
Top