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

How to turn off learning spells automatically

randal923

New Member
Joined
Sep 4, 2009
Messages
19
Reaction score
0
Hi, I used the search and I couldn't find it. Player are learning spells without buying it, how can I turn it off?.

Another thing is that player get 5 premium trial days, but if he waits 5 days and make another character he can get p.a again, how do I fix it?.

Here's the code I made:
function onAdvance(cid)

-- Trial Premium
if getPlayerStorageValue(cid, 30004) == -1 and getPlayerLevel(cid) == 2 and getPlayerPremiumDays(cid) == 0 then
doPlayerAddPremiumDays(cid, 5)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have received 5 days of trial premium account, enjoy it!")
setPlayerStorageValue(cid, 30004, 1)

end

return TRUE
end

Thank you.
 
Thank you, but why did u delete the other post?

I'll rep+ u.

- - - Updated - - -

I couldn't find it at spells.xml.

Here is an example of a spell there

<instant name="Light" words="utevo lux" lvl="8" maglv="0" mana="20" selftarget="1" aggressive="0" script="support/light.lua">
<vocation name="Sorcerer"/> <vocation name="Master Sorcerer"/>
<vocation name="Druid"/> <vocation name="Elder Druid"/>
<vocation name="Paladin"/> <vocation name="Royal Paladin"/>
<vocation name="Knight"/> <vocation name="Elite Knight"/>

there's no needlearn.
 
After aggressive add
needlearn="0"
To make it not need learning. And to 1 to be learnt.
As potak said.
 
I'll try that now. About the trial premium, can you help me with that? Potar made a post of the scripts but he deleted it. I couldn't finish.

Thanks you.

Worked! Thank you very much, I just need the trial premium now.
 
And for it, u want to check account storage rather than ind player, ill look into functions for that in morning
 
Sorry ^_^

All based on folder data/creaturescripts:

creaturescripts.xml

PHP:
 <event type="advance" name="trial" event="script" value="trial.lua"/>

scripts/login.lua

PHP:
registerCreatureEvent(cid, "trial")

and scripts/trial.lua

Lua:
function onAdvance(cid)

-- Trial Premium
if getPlayerStorageValue(cid, 30004) == -1 and getPlayerLevel(cid) == 2 and getPlayerPremiumDays(cid) == 0 then
doPlayerAddPremiumDays(cid, 5)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have received 5 days of trial premium account, enjoy it!")
setPlayerStorageValue(cid, 30004, 1)

end

return TRUE
end

About no more trial, you can use getPlayerAccountId(cid) and setGlobalStorage(getPlayerAccountId(cid),1) .

Small example:

Lua:
function onAdvance(cid)

if getPlayerStorageValue(cid, 30004) == -1 and getPlayerLevel(cid) == 2 and getPlayerPremiumDays(cid) == 0 and getGlobalStorageValue(getPlayerAccountId(cid)) == -1 then
doPlayerAddPremiumDays(cid, 5)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have received 5 days of trial premium account, enjoy it!")
setPlayerStorageValue(cid, 30004, 1)
setGlobalStorageValue(getPlayerAccountId(cid),1)
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You can not use trail premium twice!")
end

return TRUE
end
 
Last edited:
but where do I put it? it would be like that:

function onAdvance(cid)

-- Trial Premium
if getPlayerStorageValue(cid, 30004) == -1 and getPlayerLevel(cid) == 2 and getPlayerPremiumDays(cid) == 0 and getPlayerAccountId(cid) and setGlobalStorage(getPlayerAccountId(cid),1) then
doPlayerAddPremiumDays(cid, 5)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have received 5 days of trial premium account, enjoy it!")
setPlayerStorageValue(cid, 30004, 1)

end

return TRUE
end
 
trail.lua (creaturescripts folder).

and script trial.lua

Lua:
function onAdvance(cid)
 
if getPlayerStorageValue(cid, 30004) == -1 and getPlayerLevel(cid) == 2 and getPlayerPremiumDays(cid) == 0 and getGlobalStorageValue(getPlayerAccountId(cid)) == -1 then
doPlayerAddPremiumDays(cid, 5)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have received 5 days of trial premium account, enjoy it!")
setPlayerStorageValue(cid, 30004, 1)
setGlobalStorageValue(getPlayerAccountId(cid),1)
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You can not use trail premium twice!")
end
 
return TRUE
end
 
Ah, I just saw you exaple, I'll try it out now. Thank you.

- - - Updated - - -

For people that tries this script and it doesn't work, you have to edit your font code, cuz it's probably missing one of those commands in the script. I don't know how to do that, a friend of mine did that for me. If anyone here knows, please show us.

Thank you all.

- - - Updated - - -

function onAdvance(cid)

if getPlayerStorageValue(cid, 30004) == -1 and getPlayerLevel(cid) == 2 and getPlayerPremiumDays(cid) == 0 then
doPlayerAddPremiumDays(cid, 5)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have received 5 days of trial premium account, enjoy it!")
setPlayerStorageValue(cid, 30004, 1)
setGlobalStorageValue(getPlayerAccountId(cid),1)
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You can not use trail premium twice!")
end

return TRUE
end

- - - Updated - - -

this is the right script, you can do it on advance or create your own trial.lua
 
Last edited:
Back
Top