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

bank transfer to voc > 0

Mauzim

Member
Joined
Jan 3, 2011
Messages
568
Reaction score
9
how to add it here
Code:
-- transfer 
    if talk_state[cid] == 40 and getCount(msg) > 0 then 
        if getPlayerBalance(cid) >= getCount(msg) then 
            talk_state[cid] = 41 
            last_count[cid] = getCount(msg) 
            sayText = 'Who would you like transfer ' .. last_count[cid] .. ' gold to?' 
        else 
            talk_state[cid] = 0 
            sayText = 'There is not enough gold on your account.' 
        end 
    elseif talk_state[cid] == 41 then 
        local toPlayer = doPlayerExist(msg) 
        if toPlayer ~= 0 then 
            last_name[cid] = toPlayer 
            talk_state[cid] = 42 
            sayText = 'So you would like to transfer ' .. last_count[cid] .. ' gold coins to ' .. last_name[cid] .. '?' 
        else 
            talk_state[cid] = 0 
            sayText = 'This player does not exist.' 
        end
 
remove this from the script:
PHP:
function doPlayerExist(name)
    player = getPlayerGUIDByName(name)
    if player > 0 then
        return player
    else
        return 0
    end
end

and add it to functions.
Make sure that is the ONLY function named "doPlayerExist" in your server files.
it might be loaded from other places and causing errors because of that
 
Code:
[Error - NpcScript Interface]
data/npc/scripts/Znozel.lua:onCreatureSay
Description:
(LuaInterface::internalGetPlayerInfo) Player not found when requesting player in
fo #6
this is error
 
I dunno what exactly.. but please.. post the entire Znozel.lua as it really is in your file..
the file you posted earlier seems to been mixed with as there's something to hide..

if you post the full script and honestly can say it's the real one, I'll make it work for you.
 
dude i told u getPlayerVocation(................) cannot found player cid work but other not and get error nothing is with npc script :p maybe pid or something idk how to get normal vocation result maybe from sql only
 
i guess to make other function like this to check vocatio
Code:
function doPlayerExist(name)
    local result = db.getResult("SELECT `name` FROM `players` WHERE `name` = " .. db.escapeString(name))
    if (result:getID() ~= -1) then
        local return_name = result:getDataString("name")
        result:free()
        return return_name
    end
    return 0
end
 
PHP:
function doPlayerExist(name)
    local result = db.getResult("SELECT `name`, `vocation` FROM `players` WHERE `name` = " .. db.escapeString(name))
    if (result:getID() ~= -1) then
        local return_name = result:getDataString("name")
        local return_vocation = result:getDataString("vocation")
        result:free()
        return return_name, return_vocation
    end
    return 0
end
 
Code:
function doPlayerExistt(name)
    local result = db.getResult("SELECT `vocation` FROM `players` WHERE `name` = " .. db.escapeString(name))
    if (result:getID() ~= -1) then
        local return_vocation = result:getDataString("vocation")
        result:free()
        return return_vocation
    end
    return 0
end
local toPlayerr = doPlayerExistt(msg)
if toPlayerr > 0 then

that doesnt work how will that work?? and how to get from it vocation > 0??????
 
PHP:
if toPlayerr ~= 0 then

you're getting letters from the code if it's valid..
therefor you can't go with "if number is above"
 
Back
Top