• 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} Talkaction - checking parameters. (When parameters are mispelled)

Cadyan

Well-Known Member
Joined
Mar 30, 2008
Messages
845
Reaction score
63
Normally this WORKS when you use the right parameters in the game, but if you spell the name wrong then you get an error message in the console.
Code:
function onSay(cid, words, param)
    if(param ~= "") then
        local lCheck = getPlayerByName(param)
        doPlayerPopupFYI(cid, ' '..lCheck..' ')
    end
end
This is when I use the wrong parameters in the game:
Code:
Player not found.
 
Last edited:
Code:
function onSay(cid, words, param)
    if(param == "") then
        return true
    else
        doPlayerPopupFYI(cid, getPlayerByName(param))
    end
    return true
end
 
I don't understand the problem. Isn't it good that you get a message when the player wasn't found? =P
You get the error in-game right?
 
Code:
function onSay(cid, words, param)
    if(param ~= "") then
    if getPlayerByName(param) then
        local lCheck = getPlayerByName(param)
        doPlayerPopupFYI(cid, ' '..lCheck..' ')
    else
    doPlayerPopupFYI(cid, 'No Player With This Name')
end
    end
end
 
No, I get the error in the console. - updated first post

Ok, then it seems like a problem in your source code. The function is probably sending an error message instead of returning NULL. If you have the source code you can check this in luascript.cpp.

Edit:
I just realized that it depends on the version of TFS. So what version do you have? =P
 
Last edited:
Ok, then it seems like a problem in your source code. The function is probably sending an error message instead of returning NULL. If you have the source code you can check this in luascript.cpp.
This is when I use the wrong parameters in the game.
this is because the server can't find player.so it is returning Null and Error Message.You Can Remove The Error Message If You Wish from luascript.cpp as Elime Posted
 
Code:
function onSay(cid, words, param)
    if(param ~= "") then
    if getPlayerByName(param) then
        local lCheck = getPlayerByName(param)
        doPlayerPopupFYI(cid, ' '..lCheck..' ')
    else
    doPlayerPopupFYI(cid, 'No Player With This Name')
end
    end
end
This is what I needed, thanks. I don't know why I couldn't figure it out myself, I have alot on my mind.
 
Back
Top