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

Solved Problem with doPlayerSendTextMessage

gunmetal

New Member
Joined
Oct 15, 2007
Messages
75
Reaction score
0
Anytime i use a script that has doPlayerSendTextMessage and i go to use the item for w.e my client crashes. heres an example of one of my scripts that crashes my client

Code:
function onUse(cid, item, frompos, item2, topos)
wall1 = {x=409, y=1389, z=10, stackpos=1}
getwall1 = getThingfromPos(wall1) 
splash = {x=402, y=1390, z=10, stackpos=1}
oil = getThingfromPos(splash)

if item.uid == 10203 and item.itemid == 1945 and oil.itemid == 2025 and oil.type == 11 and getwall1.uid > 0 then
   doRemoveItem(oil.uid,1)
   doRemoveItem(getwall1.uid,1)
   doSendMagicEffect(splash,13)
   doTransformItem(item.uid,item.itemid+1)
elseif item.uid == 10203 and item.itemid == 1946 then
   doTransformItem(item.uid,item.itemid-1)
else
doPlayerSendTextMessage(cid, 22, 'The lever is creaking and rusty.')
end
end


The script works fine when you use the oil on the lever then use the lever. But if you use the lever without oil it tries to send a message and thats when the client crashes
im using tfs 0.2.1.4 anyone have this issue or know whats wrong in the script?
 
Last edited:
Try to use
Lua:
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'The lever is creaking and rusty.')
instead of
Lua:
doPlayerSendTextMessage(cid, 22, 'The lever is creaking and rusty.')

For other kind of messages
Lua:
MESSAGE_FIRST = 18
MESSAGE_EVENT_ORANGE = 19
MESSAGE_STATUS_CONSOLE_ORANGE = 20
MESSAGE_STATUS_WARNING = 21
MESSAGE_EVENT_ADVANCE = 22
MESSAGE_EVENT_DEFAULT = 23
MESSAGE_STATUS_DEFAULT = 24
MESSAGE_INFO_DESCR = 25
MESSAGE_STATUS_SMALL = 26
MESSAGE_STATUS_CONSOLE_BLUE = 27

Or you can also use
Lua:
doPlayerSendCancel(cid, "The lever is creaking rusty.")
 
Last edited:
Im going to try it when I get home from work ill let you know what happens

- - - Updated - - -

Thank You guys so much, both options work perfect! for that script ill be using the talk type orange since i like it, but limos you also gave me a great idea with yours! REPPED
 
Back
Top