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

TalkAction Level 100 Prize

I r New

New Member
Joined
Feb 1, 2008
Messages
137
Reaction score
1
I am like.. very new to scripting and I like talkactions alot. So I am trying to make a talkaction that gives you a prize at level 100 and you can only use it once and says "Congratulations -playername- You have reached level 100. Here is your prize"

So far I got dis

PHP:
function onSay(cid, words, param)
	if getPlayerLevel(cid) >= 100 then
			doPlayerAddItem(cid, 2160, 100)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations you have reached level 100! Heres your prize.")
		else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry You are not level 100, therefore no prize for you.")
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ENERGY)
	end
end

I've been trying to make it work ONCE and to put player name in but I fail. and if someone does it can you describe how you did it. If you can it'll be much appreciated

I r New~ ;D!
 
In Talkaction? But player must use the command, better is to do it in creaturescripts. You can use OnAdvance function :]
If you have OnAdvance system by 4220niller then you can do it in creturescripts/scripts/advances/level.lua

Maybe something like this (with the player name):
function onAdvance(cid, oldlevel, newlevel)
if newlevel == 100 then
doPlayerAddItem(cid, 2160, 100)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations ".. getCreatureName(cid) ..", you have reached level 100! Heres your prize.")
end
end


<Didn't tested,sry>
 
Last edited:
I tried getting his onAdvance function but i dont have "global.lua" in Data or anywhere.. Idk why lol but everything else works o.0

so i'd rather have a talkaction for this.
 
data/lib/constant.lua, thats your global.lua
 
@Up
As Rudolf Czarodziej said in tfs 0.3 you don't have global.lua but you have constant.lua in lib.

BTW:
In your script you didn't put the storagevalue, so players can use this command everytime and they will get a lot of money :p


#Edit
Hmm, and now i know that my script needs storagevalue too, beacouse someone can reach 100 lvl and then he can die, reach the 100 lvl again and he will again get the prize :p


function onAdvance(cid, oldlevel, newlevel)
if newlevel == 100 then
if getPlayerStorageValue(cid, 5000) == -1 then
doPlayerAddItem(cid, 2160, 100)
setPlayerStorageValue(cid, 5000, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations ".. getCreatureName(cid) ..", you have reached level 100! Heres your prize.")
else
doPlayerSendTextMessage(cid, 22, "You already received your prize !")
end
return TRUE
end
end

<Didn't Tested>
 
Last edited:
Erhmm? Newlevel? and shouldn't the return true be before the last end:eek:?

and getCreatureName(cid) should be getPlayerName(cid) or both works?

And why adding else and then a text:eek:?

PHP:
function onAdvance(cid, oldlevel, newlevel)


if getPlayerLevel(cid) == 100 and getPlayerStorageValue(cid, 5000) -1 then
doPlayerAddItem(cid, 2160, 100)
setPlayerStorageValue(cid, 5000, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations ".. getCreatureName(cid) ..", you have reached level 100! Heres your prize.")
doSendAnimatedText(cid, "Level 100!", 35)
else 
return end
end
 
@Up
I'm newbie in LUA and as I said I didn't tested it.
Newlevel beacouse onadvance system by niller has newlevel and oldlevel.
Else and then a text for "cooler efect" xd

Ps:
getPlayerStorageValue(cid, 5000) == -1 then
You have forgot about "=="
 
Use this one since this one only work when you advance to lvl 100, if you use the other scripts they made in this thread it will work for all(Level, maglevel, skills)

Only for level advance:
PHP:
function onAdvance(cid, skill, oldlevel, newlevel)
pos = getPlayerPosition(cid)
local positions = {
		{x=pos.x+1,y=pos.y-1,z=pos.z},
		{x=pos.x-1,y=pos.y-1,z=pos.z},
		{x=pos.x+1,y=pos.y+1,z=pos.z},
		{x=pos.x-1,y=pos.y+1,z=pos.z},
		{x=pos.x+1,y=pos.y,z=pos.z},
		{x=pos.x-1,y=pos.y,z=pos.z},
		{x=pos.x,y=pos.y+1,z=pos.z},
		{x=pos.x,y=pos.y-1,z=pos.z}}
		
	if skill == SKILL__LEVEL and newlevel == 100 and getPlayerStorageValue(cid, 9090) == -1 then
	setPlayerStorageValue(cid, 9090, 1)
	doPlayerAddItem(cid, 2160, 100)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations ".. getCreatureName(cid) ..", you have reached level "..getPlayerLevel(cid).."! Heres your prize.")
			for i = 1, table.maxn(positions) do
				doSendMagicEffect(positions[i],30)
			end
end
end

Added some effects :D:

23012009161715fi3.png
 
PHP:
function onSay(cid, words, param)
    if getPlayerLevel(cid) >= 100 then
     doPlayerAddItem(cid, 2160, 100)
     doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations you have reached level 100! Heres your prize.")
     doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ENERGY)
        else
     doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry You are not level 100, therefore no prize for you.")
     doSendMagicEffect(getPlayerPosition(cid), 2)
    end
return TRUE
end
 
Use this one since this one only work when you advance to lvl 100, if you use the other scripts they made in this thread it will work for all(Level, maglevel, skills)

Only for level advance:
PHP:
function onAdvance(cid, skill, oldlevel, newlevel)
pos = getPlayerPosition(cid)
local positions = {
		{x=pos.x+1,y=pos.y-1,z=pos.z},
		{x=pos.x-1,y=pos.y-1,z=pos.z},
		{x=pos.x+1,y=pos.y+1,z=pos.z},
		{x=pos.x-1,y=pos.y+1,z=pos.z},
		{x=pos.x+1,y=pos.y,z=pos.z},
		{x=pos.x-1,y=pos.y,z=pos.z},
		{x=pos.x,y=pos.y+1,z=pos.z},
		{x=pos.x,y=pos.y-1,z=pos.z}}
		
	if skill == SKILL__LEVEL and newlevel == 100 and getPlayerStorageValue(cid, 9090) == -1 then
	setPlayerStorageValue(cid, 9090, 1)
	doPlayerAddItem(cid, 2160, 100)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations ".. getCreatureName(cid) ..", you have reached level "..getPlayerLevel(cid).."! Heres your prize.")
			for i = 1, table.maxn(positions) do
				doSendMagicEffect(positions[i],30)
			end
end
end

Added some effects :D:

23012009161715fi3.png

Nope, beacouse in OnAdvance system by niller you have files like level.lua, distance.lua etc. and if he do this script in level.lua it will show only if he gain the level, not the skills like dist, axe etc.
 
Nope, beacouse in OnAdvance system by niller you have files like level.lua, distance.lua etc. and if he do this script in level.lua it will show only if he gain the level, not the skills like dist, axe etc.

First of all im not using niller system, im using the function from TFS onAdvance!

Second here is the script for level, skills, magic level(all)!
Link: http://otland.net/f82/skill-up-message-20774/ Made by ME(Pitufo)!
 
I dont have nillers onAdvance thingy~ lol.. i tried getting it but i couldnt figure it all out.. Do i need to get it?
 
First of all im not using niller system, im using the function from TFS onAdvance!

Second here is the script for level, skills, magic level(all)!
Link: http://otland.net/f82/skill-up-message-20774/ Made by ME(Pitufo)!

Yes i know that, but i said you why in "my" script i used it.

@Up
If you have TFS 0.3 then you don't need niller's system. You can use Pitufo's script.
 
Pitufo i edit it :p

PHP:
function onAdvance(cid, skill, oldlevel, newlevel)
pos = getPlayerPosition(cid)
local positions = {
        {x=pos.x+1,y=pos.y-1,z=pos.z},
        {x=pos.x-1,y=pos.y-1,z=pos.z},
        {x=pos.x+1,y=pos.y+1,z=pos.z},
        {x=pos.x-1,y=pos.y+1,z=pos.z},
        {x=pos.x+1,y=pos.y,z=pos.z},
        {x=pos.x-1,y=pos.y,z=pos.z},
        {x=pos.x,y=pos.y+1,z=pos.z},
        {x=pos.x,y=pos.y-1,z=pos.z}}
local effect = math.random (2, 50)
        
    if skill == SKILL__LEVEL and newlevel == 100 and getPlayerStorageValue(cid, 9090) == -1 then
    setPlayerStorageValue(cid, 9090, 1)
    doPlayerAddItem(cid, 2160, 100)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations ".. getCreatureName(cid) ..", you have reached level "..getPlayerLevel(cid).."! Heres your prize.")
            for i = 1, table.maxn(positions) do
                doSendMagicEffect(positions[i],effect)
            end
end
end
 
I'm using tfs 0.3b2-console and Pitufo's script doesn't work :/ it saysError.JPG
 
Back
Top