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

TFS 1.x

Itutorial

Board Moderator
Staff member
Board Moderator
Joined
Dec 23, 2014
Messages
2,462
Solutions
68
Reaction score
1,129
I asked about this problem before and did get half of what I needed solved.

I am trying to input/export useable data from my database. I have figured out how to input new data but am having a problem exporting new data...

So I can put values in the database but cant seem to call it out of it.

Here is the function I am using to export.

Code:
function getPetName(cid)
       local resultr, ret = db.storeQuery("SELECT `pet_name` FROM `player_pet` WHERE `player_id` = "..getPlayerGUID(cid)..";")
        ret = result.getDataInt(resultr,'pet_name')
        result.free(resultr)
        return ret
end

Is there something I need to do to tell the script whether the data is a string, or number value?

When I use the function the script will read that there is something there, however, I cannot ask it things like:

Code:
if getPetName(cid) =="name" then

It wont register it but If I do:

Code:
if getPetName(cid) then

Then the script reads it and accepts that the player does have a value there.
 
Solved....

If someone can please give me the script to check is a player is in combat please and thank you.
 
that code does not work for all types of combat, probably you will have to use a condition checker like

Code:
creature:getCondition(CONDITION_INFIGHT)

P.S: I have no idea if it will work, im not familiarized with TFS 1X yet :X

EDIT:

try this:

Code:
local c_type = CONDITION_INFIGHT
    local c_id = condition:getSubId()

    if getCreatureCondition(cid, c_type, c_id) == 1 then
            player:sendTextMessage(MESSAGE_INFO_DESCR, "This action is not permitted infight.")
        return false
    end
 
Last edited:
Back
Top