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

Lua How block to cant transfer gold to rookers?

tocold

New Member
Joined
Jun 12, 2016
Messages
73
Reaction score
2
I have this npc banker, but how make to:

Code:
IF player is not a rooker {
IF player try transfer money to a rooker {
show: you are not from rookgaard, so you cant transfer money to rookgaard players!
}
}

Rookgaard vocations ID: 0,13,14

My bank npc script
bank.lua
http://pastebin.com/K6D4CQRn
 
You can easily check if the target has vocation id 0, alternate you can check targets home temple and block it.
If you have tried it, you can post your try here and people can edit the lines some. This forum isnt to give people what they request but if you stuck with something you deserve help.
 
Last edited:
I'm sorry to didn't post

I was tried to vocations, but u guys tell me town mode, i think its better

I tried town mode, but its not work
Code:
  if(getPlayerTown(cid) ~= 7) then
     if(getPlayerTown(v) == 7) then
       npcHandler:say('You cant transfer money to players from Rookgaard.', cid)
       return true
     end
   end

full script:

http://pastebin.com/J7H24wn8
 
if (getPlayerVocation(cid) == 0) or (getPlayerVocation(cid) >= 13) then
npcHandler:say('You cant transfer money to players from Rookgaard.', cid)
return true
end
end
 
if (getPlayerVocation(cid) == 0) or (getPlayerVocation(cid) >= 13) then
npcHandler:say('You cant transfer money to players from Rookgaard.', cid)
return true
end
end
You can't use cid or it will check the vocation of the player trying to send money, instead of the player the money is being transferred to.
You probably have to use a db query to check vocation just incase the player is offline.
 
well change
if (getPlayerVocation(cid) == 0) or (getPlayerVocation(cid) >= 13) then
for
if (getPlayerVocation(v) == 0) or (getPlayerVocation(v) >= 13) then

and use to check online
getPlayersOnline()
if not isPlayer(v) then

and change the topic to

Topic[cid] = 8

or can use
for _, pid in ipairs(getPlayersOnline()) do
if getCreatureName(pid) == "Printer" then

or can use this =

if (getPlayerBalance(v) >= 0 ) and (getPlayerVocation(cid) ~= 7) then
npcHandler:say('You cant transfer money to players from Rookgaard.', cid)
return true
end
end

very easy = if player V (ROOKGARD) have balance 0 or + and you have vocation ~= 7)
You cant transfer money to players from Rookgaard.', cid)
 
I've fix by myserlf... if other member want to use its here

Code:
elseif Topic[cid] == 7 and msgcontains(msg, 'yes') then
if getPlayerBalance(cid) >= count[cid] then
   local v = getPlayerByName(transfer[cid])
   if(getPlayerTown(cid) ~= 7) then
     if(getPlayerTown(v) == 7) then
       npcHandler:say('You cant transfer money to players from Rookgaard.', cid)
       Topic[cid] = nil
     end
   elseif v then
     doPlayerSetBalance(cid, getPlayerBalance(cid) - count[cid])
     doPlayerSetBalance(v, getPlayerBalance(v) + count[cid])
     npcHandler:say('Very well. You have transferred ' .. count[cid] .. ' gold to ' .. getPlayerName(v) .. '.', cid)
   elseif findPlayer(transfer[cid]):lower() == transfer[cid]:lower() then
     doPlayerSetBalance(cid, getPlayerBalance(cid) - count[cid])
     db.executeQuery('UPDATE players SET balance=balance+' .. count[cid] .. ' WHERE name=' .. db.escapeString(transfer[cid]) .. ' LIMIT 1')
     npcHandler:say('Very well. You have transferred ' .. count[cid] .. ' gold to ' .. findPlayer(transfer[cid]) .. '.', cid)
   else
     npcHandler:say('This player does not exist.', cid)
   end
else
   npcHandler:say('There is not enough gold on your account.', cid)
end
 
Back
Top