What's new

-LUA & XML (0.3.6)Talkactions - Komenda

Status
Not open for further replies.

qwasniak

Advanced User
Joined
May 9, 2013
Messages
303
Reaction score
7
Witam.
Po ca?ym dniu kombinowania, niestety nie uda?o mi si? napisa?, lub chocia? znale?? podobnego (budow?) kodu w internecie.
Chodzi o to, gdy administrator napisze
Code:
/komenda kasa/aol, ilosc
to ka?dy gracz otrzyma te przedmioty z tablicy
[LUA]local a ={
["kasa"] = id,
["aol"] = id
}[/LUA]
Zale?y mi na tym aby m?c KONIECZNIE wpisa? w?asn? ilo??.
Dzi?kuje :)
 

buchaLL

bez spiny, luźno
Joined
Aug 2, 2011
Messages
1,013
Reaction score
68
Age
27
Odp: (0.3.6)Talkactions - Komenda

Po co kombinowa? z jaka? tablic??
/komenda crystal coins, 5, /komenda golden armor, 1 , etc..
[lua]function onSay(cid, words, param, channel)
local txt = string.explode(param, ",")
if (txt[1] == nil or txt[2] == nil) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Komenda nieznana.")
end
for _, player in pairs(getPlayersOnline()) do
doPlayerAddItem(player, txt[1], txt[2], true)
doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_ORANGE, "Otrzymales "..txt[2].." "..getItemDescriptionsById(txt[1]).name.."!")
end
return true
end[/lua]

[xml]<talkaction words="!komenda;/komenda" access="5" event="script" value="additem.lua"/>[/xml]
 

Sepox

Active User
Joined
Mar 16, 2017
Messages
138
Reaction score
0
Odp: (0.3.6)Talkactions - Komenda

gdzie to dodac
 

qwasniak

Advanced User
Joined
May 9, 2013
Messages
303
Reaction score
7
Odp: (0.3.6)Talkactions - Komenda

Chodzi mi o to, aby lista by?a ograniczona do kilku przedmiot?w.
 

Sepox

Active User
Joined
Mar 16, 2017
Messages
138
Reaction score
0
Odp: (0.3.6)Talkactions - Komenda

Mi to nie dziala chyba ze zle gdzies dodalem ?
 

buchaLL

bez spiny, luźno
Joined
Aug 2, 2011
Messages
1,013
Reaction score
68
Age
27
Odp: (0.3.6)Talkactions - Komenda

Mi to nie dziala chyba ze zle gdzies dodalem ?
Poprawka:
/komenda [id], [count]
/komenda 2160, 5

Skrypt z tabel?:
[lua]function onSay(cid, words, param, channel)

local items = {
["kasa"] = 2160,
["aol"] = 2218,
}

local param = string.explode(param, ",")

if (param[1] == nil or param[2] == nil) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Komenda nieznana.")
end
for item_name, item_id in pairs(items) do
if param[1] == item_name then
if isItemStackable(item_id) then
for _, player in pairs(getPlayersOnline()) do
doPlayerAddItem(player, item_id, param[2], true)
doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_ORANGE, "Otrzymales "..param[2].." "..getItemDescriptionsById(item_id).name.."!")
end
else
for i=1, param[2] do
for _, player in pairs(getPlayersOnline()) do
doPlayerAddItem(player, item_id, 1, true)
doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_ORANGE, "Otrzymales "..param[2].." "..getItemDescriptionsById(item_id).name.."!")
end
end
end
end
end
return true
end[/lua]
 

qwasniak

Advanced User
Joined
May 9, 2013
Messages
303
Reaction score
7
Odp: (0.3.6)Talkactions - Komenda

Dzia?a, dzi?ki wielkie :)
 

Sepox

Active User
Joined
Mar 16, 2017
Messages
138
Reaction score
0
Odp: (0.3.6)Talkactions - Komenda

Wytlumaczcie mi gdzie mam go doda? co i jak.
 

buchaLL

bez spiny, luźno
Joined
Aug 2, 2011
Messages
1,013
Reaction score
68
Age
27
Odp: (0.3.6)Talkactions - Komenda

Wytlumaczcie mi gdzie mam go doda? co i jak.

Skrypt do data/talkactions/scripts/ a do talkactions.xml doklejasz
[xml]<talkaction words="!komenda;/komenda" access="5" event="script" value="skrypt.lua"/>[/xml]
 
Status
Not open for further replies.
Top