storage.lua

main 106 lines · 3.6 KB Raw
Alex Alex Commit Server upload 18/10/2026 23:38
1function onSay(player, words, param)
2 if player:getGroup():getId() < 3 then
3 return false
4 end
5 local t = param:splitTrimmed(",")
6 if t[01] == "all" then
7 if(not t[2]) or (not t[3]) then
8 player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Defina qual value sera dado.")
9 return false
10 end
11 local hasAccess = player:getGroup():getAccess()
12 local players = Game.getPlayers()
13 for _, targetPlayer in ipairs(players) do
14 if hasAccess or not targetPlayer:isInGhostMode() then
15 if(not t[4]) then
16 if tonumber(t[2]) == _SYSTEM.GOLD_COIN[01] then
17 PlayerGoldCoins(targetPlayer, 02, tonumber(t[3]))
18 else
19 targetPlayer:setStorageValue(t[2], (targetPlayer:getStorageValue(t[2]) + t[3]))
20 end
21 else
22 if tonumber(t[2]) == _SYSTEM.GOLD_COIN[01] then
23 print("Remove Grana")
24 PlayerGoldCoins(targetPlayer, 01, tonumber(t[3]))
25 else
26 targetPlayer:setStorageValue(t[2], t[3])
27 end
28 end
29
30 if tonumber(t[2]) == _SYSTEM.ONLINE_COIN then
31 targetPlayer:sendCancelMessage("@LootMSG 3160 0 0 " ..t[3])
32 doBackpack(targetPlayer, 11)
33 elseif tonumber(t[2]) == 3218 then
34 PlayerVipCoins(targetPlayer, 02, t[3])
35 targetPlayer:sendCancelMessage("@LootMSG 3218 3 0 " ..tonumber(t[3]))
36 doBackpack(targetPlayer, 11)
37 elseif tonumber(t[2]) == _SYSTEM.TASK[00].TASK_COIN_1 then
38 targetPlayer:sendCancelMessage("@LootMSG 3205 0 0 " ..t[3])
39 doBackpack(targetPlayer, 11)
40 elseif tonumber(t[2]) == _SYSTEM.TASK[00].TASK_COIN_2 then
41 targetPlayer:sendCancelMessage("@LootMSG 3205 3 0 " ..t[3])
42 doBackpack(targetPlayer, 11)
43 elseif tonumber(t[2]) == _SYSTEM.TASK[00].TASK_COIN_3 then
44 targetPlayer:sendCancelMessage("@LootMSG 3205 2 0 " ..t[3])
45 doBackpack(targetPlayer, 11)
46 elseif tonumber(t[2]) == _SYSTEM.PVP_POINTS then
47 targetPlayer:sendCancelMessage("@LootMSG 3219 5 0 " ..t[3])
48 doBackpack(targetPlayer, 11)
49 end
50 end
51 end
52
53 player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Todos os jogadores online receberam.")
54 return false
55 end
56
57 if(not t[2]) then
58 player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")
59 return false
60 end
61
62 local tid = Player(t[1])
63 if(not tid) then
64 player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[1] .. " not found.")
65 return false
66 end
67
68 if(not t[3]) then
69 player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, " [" .. t[1] .. " - " .. t[2] .. "] = " .. tid:getStorageValue(t[2]))
70 else
71 if tonumber(t[2]) == _SYSTEM.GOLD_COIN[01] then
72 if(not t[4]) then
73 PlayerGoldCoins(tid, 02, tonumber(t[3]))
74 else
75 print("Remove Grana")
76 PlayerGoldCoins(tid, 01, tonumber(t[3]))
77 end
78 else
79 tid:setStorageValue(t[2], t[3])
80 end
81 player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "O player [" .. t[1] .. "] recebeu a storage [" .. t[2] .. ", " .. t[3] .. "]")
82 if tonumber(t[2]) == _SYSTEM.ONLINE_COIN then
83 tid:sendCancelMessage("@LootMSG 3160 0 0 " ..t[3])
84 doBackpack(tid, 11)
85 elseif tonumber(t[2]) == 3218 then
86 PlayerVipCoins(tid, 02, tonumber(t[3]))
87 tid:sendCancelMessage("@LootMSG 3218 3 0 " ..t[3])
88 doBackpack(tid, 11)
89 elseif tonumber(t[2]) == _SYSTEM.TASK[00].TASK_COIN_1 then
90 tid:sendCancelMessage("@LootMSG 3205 0 0 " ..t[3])
91 doBackpack(tid, 11)
92 elseif tonumber(t[2]) == _SYSTEM.TASK[00].TASK_COIN_2 then
93 tid:sendCancelMessage("@LootMSG 3205 3 0 " ..t[3])
94 doBackpack(tid, 11)
95 elseif tonumber(t[2]) == _SYSTEM.TASK[00].TASK_COIN_3 then
96 tid:sendCancelMessage("@LootMSG 3205 2 0 " ..t[3])
97 doBackpack(tid, 11)
98 elseif tonumber(t[2]) == _SYSTEM.PVP_POINTS then
99 tid:sendCancelMessage("@LootMSG 3219 5 0 " ..t[3])
100 doBackpack(tid, 11)
101 end
102 end
103
104 return false
105end
106
Top