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

CREATE ITEM WITH CUSTOM NAME BESIDE CHARACTER!!! and if itemName contains playerName

Blood BlvD Ot

Member
Joined
Jun 12, 2010
Messages
243
Reaction score
7
hey I need to know a way around this, I'm pretty sure its easy and possible.

I need to know the command for:

doCreateItem(............

create item with custom name of:

local crateName = " " .. getPlayerName .. " 's Crate "
local itemID =

and place the item beside character.

--------------------------------------------------------
AND I also need to know this :

if itemName contains playerName then.
doPlayerAddItem(cid...blablabla...
----------------------------------------------
If you could help you will be my bestiee ;) Tanxxx
 
er Would i write this:
local crateName = " " .. getPlayerName(cid) .. "'s Crate"
local pos = getPlayerPosition(cid)
local crateId = ****
doItemSetAttribute(doPlayerAddItem(pos,crateName,1), 'uid', crateID)
 
Wait, you want that for example, you use something and an item is created beside the player?
And that item, when you look at it, it has something special or is it a normal item?
I believe it wud be something like this:
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
ppos = getPlayerPosition(cid)
local t = {
[0] = {x = ppos(cid).x, y = ppos(cid).y-1, z = ppos(cid).z},
[1] = {x = ppos(cid).x-1, y = ppos(cid).y, z = ppos(cid).z},
[2] = {x = ppos(cid).x, y = ppos(cid).y+1, z = ppos(cid).z},
[3] = {x = ppos(cid).x+1, y = ppos(cid).y, z = ppos(cid).z}
}

for k, v in pairs(t) do
    if getPlayerDirection(cid) == k then
       doCreateItem(xxxx,1,v[1])
    end
return true
end
end
 
Hmm kkk this is my plan xD
I have made a killstreak system.
when the player gets 10 killstreaks
I need it to create the item beside the player and make the items name contain that Players name.
On the use of the item, in a seporate script. I'm doing this:
if itemName contains playerName then...continue on.
 
Last edited:
I dont know how to use kill function but I guess with what I put Cyber or Cyko could make that script.
And so it contains the playername too it would with a function onLook or something like that, setting an UID for that item, and when you look the item you see the player name on that item.
 
Try this:
data/actions/scripts/streak.lua
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
ppos = getPlayerPosition(cid)
local t = {
[0] = {x = ppos(cid).x, y = ppos(cid).y-1, z = ppos(cid).z},
[1] = {x = ppos(cid).x-1, y = ppos(cid).y, z = ppos(cid).z},
[2] = {x = ppos(cid).x, y = ppos(cid).y+1, z = ppos(cid).z},
[3] = {x = ppos(cid).x+1, y = ppos(cid).y, z = ppos(cid).z}
}

for k, v in pairs(t) do
    if getPlayerDirection(cid) == k then
       doItemSetAttribute(doCreateItem(xxxx,1,v[1]), 'uid', 15580)
    end
return true
end
end

data/actions/actions.xml
XML:
<action uniqueid="5005" event="script" value="streak.lua"/>

data/creaturescripts/looking.lua
LUA:
function onLook(cid, thing, position, lookDistance)
if item.uid == 15580 then
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You see a " .. getPlayerName(cid) .. " ")
   end
return true
end

data/creaturescripts/creaturescripts.xml
XML:
<event type="look" name="Look" event="script" value="looking.lua"/>

login.lua
LUA:
registerCreatureEvent(cid, "Look")
 
Last edited:
I did this:
I need it to create the item beside the player and make the items name contain that Players name.
On the use of the item, in a seporate script. I'm doing this:
if itemName contains playerName then...continue on.

You can continue on since the item has an UID
 
No u diddn't lol
U made it seem like the items name was what I wanted, but realisticly its not.
you diddnt understand that i need it to limit the scripts progress on the fact that
if itemName contains playerName then
do...
I've seen someone use this command before on some kind of boots script but I cannot find it anymore.
 
What I did was this:
If players heading north, then create item with an assigned UID beside player, if east, west or south same.
Then for that UID I made a script onLook so you can see your playername in the item.
Now just use the UID instead of itemName and it will be the same, because when you see the item, it will have the players name!
 
I don't care about it being on look tho
I want the items name to actualy be what it needs to be!!

if itemName contains playerName then,

will limit it to that one player untill the item decays into another chest for which all players can get at it.

And I'm not stupid lol, I could do exactly what u did if thats what I needed to do.
 
Too bad, I dont think theres a way in a script to actually create a new item with the players name in items.xml (What you actually want!).
If theres a way I dont know it, sorry :p
 
function setItemName(uid,name)
return doItemSetAttribute(uid,'name',name)
end

local crateName = "" .. getPlayerName .. "'s Crate"

setItemName(itemEx.uid, crateName)

hmm... something like this might help?
 
Back
Top