• 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.2 Pomoc przy premium rune.

Kawunnia

New Member
Joined
Nov 15, 2018
Messages
23
Reaction score
2
Witam otóż mam problem z premium rune używając jej dodaje mi 50pkt na konto ale jest myk taki ze daje to kazdemu kto jest online do konta punkty.
Uzywam ZnoteAAC
Serwer TFS 1.2
Code:
local cfg = {
    points = 50,
    effect = CONST_ME_GIFT_WRAPS
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if not isPlayer(cid) then
        return false
    end

    db.query("UPDATE `znote_accounts` SET `points` = `points` + 50 WHERE `account_id`")
    doCreatureSay(cid, "You have received " .. cfg.points .. " premium points!", TALKTYPE_ORANGE_1, false, nil, toPosition)
    doSendMagicEffect(toPosition, cfg.effect)
    doRemoveItem(item.uid, 1)
    return true
end

To mam dodane do bazy danych

Code:
UPDATE `znote_accounts` SET `points` = `points` + 50 WHERE `account_id`
 
Solution
Piszesz, że serwer 1.2, a funkcje wyglądają jak z 0.4:
  • onUse(cid, item, fromPosition, itemEx, toPosition)
  • doCreatureSay(cid, ...

Wracając do pytania, dodaj przed db.query linię:
  • jeśli to 0.4 local accountId = getAccountIdByName(getCreatureName(cid))
  • jeśli to 1.2 local accountId = Player(cid):getAccountId()

a samo zapytanie zmień na db.query("UPDATE `znote_accounts` SET `points` = `points` + 50 WHERE `account_id` = " .. accountId)
Piszesz, że serwer 1.2, a funkcje wyglądają jak z 0.4:
  • onUse(cid, item, fromPosition, itemEx, toPosition)
  • doCreatureSay(cid, ...

Wracając do pytania, dodaj przed db.query linię:
  • jeśli to 0.4 local accountId = getAccountIdByName(getCreatureName(cid))
  • jeśli to 1.2 local accountId = Player(cid):getAccountId()

a samo zapytanie zmień na db.query("UPDATE `znote_accounts` SET `points` = `points` + 50 WHERE `account_id` = " .. accountId)
 
Solution
Funkcję wyglądają jak a działają na 1.2 ?: P nie jestem az takim specjalistą :p uczę sie dopiero mógłbyś mi to w jednym skrypcie wrzucić ?
 
Coś takiego ?
Code:
local cfg = {
    points = 50,
    effect = CONST_ME_GIFT_WRAPS
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if not isPlayer(cid) then
        return false
    end
local accountId = Player(cid):getAccountId()

    db.query("UPDATE `znote_accounts` SET `points` = `points` + 50 WHERE `account_id` = " .. accountId)
    doCreatureSay(cid, "You have received " .. cfg.points .. " premium points!", TALKTYPE_ORANGE_1, false, nil, toPosition)
    doSendMagicEffect(toPosition, cfg.effect)
    doRemoveItem(item.uid, 1)
    return true
end
 
Baza danych zwróciła taki komunikat
Code:
Static analysis:

1 błędów zostało znalezionych podczas analizy.

Unexpected beginning of statement. (near ""UPDATE `znote_accounts` SET `points` = `points` + 50 WHERE `account_id` = "" at position 1)
Zapytanie SQL:

("UPDATE `znote_accounts` SET `points` = `points` + 50 WHERE `account_id` = ")
 
would not it be better to use English as a language?

Maybe it was even easier for you to get help. I for example did not understand absolutely anything that was said in that topic.
 
Back
Top