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

Action My first script (Exp Token)

Printer

if Printer then print("LUA") end
Senator
Premium User
Joined
Dec 27, 2009
Messages
5,782
Solutions
31
Reaction score
2,286
Location
Sweden?
Hello otland,

Here is my first script, a exptoken with more options to edit. Enjoy :)

Fixed!


Lua:
local config = {
local exp = 1000 --- Here edit how much exp!
local level = 40 -- Edit here level to use item!

function onUse(cid, item, frompos, item2, topos)
if isPlayer(cid) and getPlayerLevel(cid, level) then
doPlayerAddExp(cid,exp)
doSendAnimatedText(getCreaturePosition(cid), "OH YEAH EXPRIENCE YEA!", TEXTCOLOR_RED)
doPlayerSendTextMessage(cid, 27, "You have recived "..exp.." exprience points.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
else
doPlayerSendCancel(cid, "Sorry, but you need level "..level.." to use Exp Token.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
doSendAnimatedText(getCreaturePosition(cid), "GROW UP!", TEXTCOLOR_RED)
end
return true
end
 
Last edited:
Counted 10 mistakes, this script won't work.

No offence, but if you're going to release a script test it yourself and THEN post it.
This is just redicolous :S
 
PROTIP: Don't use a config table until you know how to use it well. Start with separated tables.
e.g.
Lua:
local mlp = love
local fim = tolerate
and use Notepad++, it's easier to find what's wrong with it.
 
First:
Lua:
exp = 1000, <-- edit how much exprience
wtf is "<--" ^.-

Second:
Lua:
doPlayerSendTextMessage(cid, 27, "You have recived "..config.exp.." exprience points."
If u open (, u must close it right?

Third:
Lua:
doSendAnimatedText(getCreaturePosition(cid), "GROW UP KID!", TEXTCOLOR_RED)
8 letters allowed :p

Fourth:
Lua:
doSendMagicEffect(getThingPos(cid, 32)
Close "(" :3

Fifth:
Lua:
if isPlayer and getPlayerLevel(cid, config.lvl) then
Thats completly wrong, u should use this:
Lua:
if isPlayer(cid) and getPlayerLevel(cid) == config.lvl then


@and its weird, becouse only player who have exactly 40lvl can use that.
If u wanna 40lvl or highter use:
Lua:
if getPlayerLevel(cid) >= config.lvl then

But for the first script, that was nice, and what Ratser said, use simple tables first ;P
 
Now it have been fixed! By using a program which tells the bugs of the script :p

And i used local but i wanted use smth new xD
 
Remove "local config = {" and change "isPlayer" to "isPlayer(cid)".
And as I said, PLEASE TAB YOUR SCRIPTS!
 
Ty but i dont know how to tab :(
 
Lua:
local x = {
	tab
	tab
}
function lala()
	if bla bla then
		if bla bla then
			for k = 1, #x do
				bla bla
			end
		else
			blabla
		end
	elseif trolo then
		repeat
			trololo
		until lolo = trolo
	end
return TRUE
end
Just an example that's how I tab ._.
 
this is how I tab :p
Lua:
local config = {
local exp = 1000 --- Here edit how much exp!
local level = 40 -- Edit here level to use item!

function onUse(cid, item, frompos, item2, topos)
    if isPlayer(cid) and getPlayerLevel(cid, level) then
       doPlayerAddExp(cid,exp)
       doSendAnimatedText(getCreaturePosition(cid), "OH YEAH EXPRIENCE YEA!", TEXTCOLOR_RED)
       doPlayerSendTextMessage(cid, 27, "You have recived "..exp.." exprience points.")
       doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
   else
       doPlayerSendCancel(cid, "Sorry, but you need level "..level.." to use Exp Token.")
       doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
       doSendAnimatedText(getCreaturePosition(cid), "GROW UP!", TEXTCOLOR_RED)
   end
   return TRUE
end
 
otswe which program do you use ?

OTScript Live, but it dont make scripts automatic if you think that xD, it got a list with functions.
 
Just press "TAB" button (Near "Q" Button) xD

@amiroslo
Lua:
getPlayerLevel(cid, level)
That'll working? :O
 
He just tabbed the code, he didn't correct anything.
As far as I know -> doSendAnimatedText(pos,'text',EFFEKT) will only support 9 letters!
The rest will be cut off.
 
Back
Top