• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Pomoc ze skryptem

Status
Not open for further replies.

Aleh

Active Member
Joined
Jan 9, 2009
Messages
1,228
Reaction score
39
Location
Rzeszów
Code:
function onUse(cid, item, fromPosition)
  local stare = 6530 
  local nowe = 2640
  local pos = getCreaturePosition(cid)
  local kasa = 50000
  
  if doPlayerRemoveMoney(cid, kasa) == TRUE then
      if doPlayerRemoveItem(cid,stare,1) == TRUE and doPlayerAddItem(cid,nowe,1) == TRUE then 
        doPlayerSendTextMessage(cid,22,"Naprawiles swoje Soft Bootsy!")
      else
        doPlayerSendTextMessage(cid,22,"Nie masz przy sobie Soft Bootsow!")
      end
    else
      doPlayerSendTextMessage(cid,22,"Nie masz " ..kasa.. "gp!")
      return TRUE
    end
  end​
Mógłby mi ktoś pomóc w naprawie tego skryptu - napisałem go sam - pierwszy skrypt w lua.
Wszystko ładnie działa tylko jak użyje danego itemka zabiera kase, daje nowe softy i zamiast wyświetlać: Naprawiles swoje Soft Bootsy! to wyświetla Nie masz przy sobie Soft Bootsow!.
Jest jeszcze jeden problem. Nie mając starych softów i używając itemka wyświetla napis: Nie masz przy sobie Soft Bootsow! i zabiera xxx gp.
Pomoże ktoś??
 
najpierw sprawdz czy ma softy i $$$
else
nie masz softow lub hajsu

jesli ma softy i $$$
zabierz softy i daj nowe

w Twoim skrypcie najpierw zabiera $$$ pozniej dopiero sprawdza czy player ma softy.


return true przed ostatnim endem daj
 
Code:
  local stare = 6530 
  local nowe = 2640
  local kasa = 50000
function onUse(cid, item, fromPosition)
  if getPlayerItemCount(cid, stare) >= 1 then
    if getPlayerMoney(cid) >= kasa then
      doPlayerBuyItem(cid, nowe, 1, kasa, 1)
      doPlayerRemoveItem(cid, stare, 1)
      doPlayerSendTextMessage(cid,22,"Naprawiles swoje Soft Bootsy!")
    else
      doPlayerSendTextMessage(cid,22,"Nie masz " ..kasa.. "gp!")
    end
    doPlayerSendTextMessage(cid,22,"Nie masz Softów i wystarczajaco pieniedzy!")
  end
  return TRUE
end
Teraz jest dobrze napisane?;)
 
Spróbuj tego :
PHP:
local cfg =
{
    old = 6530,
    new = 2640,
    money = 50000
}

function onSay(cid, words, param, channel)
    if getPlayerItemCount(cid, cfg.old) >= 1 and getPlayerMoney(cid) >= cfg.money then
        doPlayerRemoveItem(cid, cfg.old, 1)
        doPlayerAddItem(cid, cfg.new, 1)
        doPlayerSendCancel(cid, MESSAGE_INFO_DESCR, "Naprawil"..(getPlayerSex(cid) == 0 and "as" or "es").." swoje softy!")
    else
        return doPlayerSendCancel(cid, MESSAGE_INFO_DESCR, "Nie masz wystarczajaco ".. cfg.money.." kasy lub nie masz softow.")
    end
return true
end

Bo to chyba ma być w talkactions a nie w actions.
 
Last edited:
Właśnie, że ja chce w actions a nie w talkactions.

@edit
Code:
  local stare = 6530 
  local nowe = 2640
  local kasa = 50000
function onUse(cid, item, fromPosition)
  if getPlayerItemCount(cid, stare) >= 1 then
    if getPlayerMoney(cid) >= kasa then
      doPlayerBuyItem(cid, nowe, 1, kasa, 1)
      doPlayerRemoveItem(cid, stare, 1)
      doPlayerSendTextMessage(cid,22,"Naprawiles swoje Soft Bootsy!")
    else
      doPlayerSendTextMessage(cid,22,"Nie masz " ..kasa.. "gp!")
    end
	else
    doPlayerSendTextMessage(cid,22,"Nie masz Softów i wystarczajaco pieniedzy!")
  end
  return TRUE
end
Skrypt działa jak należy ;)) Dzięki koob za rade!
 
To 3 maj
PHP:
local cfg =
{
    old = 6530,
    new = 2640,
    money = 50000
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerItemCount(cid, cfg.old) >= 1 and getPlayerMoney(cid) >= cfg.money then
        doPlayerRemoveItem(cid, cfg.old, 1)
        doPlayerAddItem(cid, cfg.new, 1)
        doPlayerSendCancel(cid, MESSAGE_INFO_DESCR, "Naprawil"..(getPlayerSex(cid) == 0 and "as" or "es").." swoje softy!")
    else
        return doPlayerSendCancel(cid, MESSAGE_INFO_DESCR, "Nie masz wystarczajaco ".. cfg.money.." kasy lub nie masz softow.")
    end
return true
end
 
Status
Not open for further replies.
Back
Top