• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action ghettobird's cigarette !

ghettobird

LUA newbie
Joined
Aug 17, 2013
Messages
679
Reaction score
132
Location
OTland
Hey otlanders, this is the 3rd script i release, i really hope you like it =)!

Lua:
 function onUse(cid, item, frompos, item2, topos)
doCreatureSay(cid, "COUGH...COUGH..." , 16)
doPlayerAddHealth(cid, "-5")
doSendMagicEffect(getCreaturePosition(cid), 34)
return true
end

now go to actions.xml

Lua:
 <action itemid="7499" event="script" value="urscriptname.lua"/>

post bugs or errors!
 
there is a lua scripting guide here, i read it a couple of times, i just open the lua functions (docs, lua_functions) and its pretty easy

function onUse(cid, item, frompos, item2, topos) << used for pretty much all scripts that are in actions (onUse=actions)
doCreatureSay(cid, "I OWN!" ,25) << doCreatureSay = it will say i'm using tfs 0.4, and cid is used for players, if your script has something to do with players, so doCreatureSay (cid,"i own") without ", 25)" then the player will say I OWN (asif he typed it)

lua is just like um a noob type of english xD,, doCreaturesSay = make the player say etc... :)
 
Damn, nice scripts, Can I just ask you 1 thing ? Who are learning you to scripts :D ?

who is teaching you..Not Learning you

@onTopic Already Released before but Good Work.Next Time Should Be A Beer :p
 
[24/8/2013 10:0:7] [Error - Action Interface]
[24/8/2013 10:0:7] mods/scripts/Scripts en General/Azzkaban Acciones Respaldo/Cigarro.lua:eek:nUse
[24/8/2013 10:0:7] Description:
[24/8/2013 10:0:7] ...ts en General/Azzkaban Acciones Respaldo/Cigarro.lua:3: attempt to call global 'doPlayerAddHealth' (a nil value)
[24/8/2013 10:0:7] stack traceback:
[24/8/2013 10:0:7] ...ts en General/Azzkaban Acciones Respaldo/Cigarro.lua:3: in function <...ts en General/Azzkaban Acciones Respaldo/Cigarro.lua:1>
 
Lua:
 function onUse(cid, item, frompos, item2, topos)
doCreatureSay(cid, "COUGH...COUGH..." , 16)
doPlayerAddHealth(cid, -5)
doSendMagicEffect(getCreaturePosition(cid), 34)
return true
end
 
Btw Ghetto you should add "" unless it is a message or letters.your mistake is
Lua:
doPlayerAddHealth(cid,  "-5" )

it should be

Lua:
doPlayerAddHealth(cid,  -5 )

Same thing goes to add mana

2-if you are writing a broadcast or a message it should be like this

Lua:
doPlayerSendTextMessage(cid,MESSAGE_EVENT_ORANGE, "BlaBla" )

Got It?,:)
 
Lua:
 function onUse(cid, item, frompos, item2, topos)
doCreatureSay(cid, "COUGH...COUGH..." , 16)
doPlayerAddHealth(cid, -5)
doSendMagicEffect(getCreaturePosition(cid), 34)
return true
end


[24/8/2013 11:25:44] [Error - Action Interface]
[24/8/2013 11:25:44] mods/scripts/Scripts en General/Azzkaban Acciones Respaldo/Cigarro.lua:eek:nUse
[24/8/2013 11:25:44] Description:
[24/8/2013 11:25:44] ...ts en General/Azzkaban Acciones Respaldo/Cigarro.lua:3: attempt to call global 'doPlayerAddHealth' (a nil value)
[24/8/2013 11:25:44] stack traceback:
[24/8/2013 11:25:44] ...ts en General/Azzkaban Acciones Respaldo/Cigarro.lua:3: in function <...ts en General/Azzkaban Acciones Respaldo/Cigarro.lua:1>
 
[24/8/2013 11:25:44] [Error - Action Interface]
[24/8/2013 11:25:44] mods/scripts/Scripts en General/Azzkaban Acciones Respaldo/Cigarro.lua:eek:nUse
[24/8/2013 11:25:44] Description:
[24/8/2013 11:25:44] ...ts en General/Azzkaban Acciones Respaldo/Cigarro.lua:3: attempt to call global 'doPlayerAddHealth' (a nil value)
[24/8/2013 11:25:44] stack traceback:
[24/8/2013 11:25:44] ...ts en General/Azzkaban Acciones Respaldo/Cigarro.lua:3: in function <...ts en General/Azzkaban Acciones Respaldo/Cigarro.lua:1>

Change "doPlayerAddHealth" to "doCreatureAddHealth".
 
Maybe because the value is a string and the lua engine searches for an integer? Just change "-5" to -5.
 
Back
Top