Apoccalypse
New Member
- Joined
- Apr 15, 2017
- Messages
- 114
- Solutions
- 2
- Reaction score
- 4
Hello guys,
I am trying to make a small reward for the players in the top 5 guilds which has the most kills.
I have two queststions about it:
1.Is it possible to make a script which would find top 5 guild in terms of amount of kills and get them a proper reward?
2.If for first question anserw is yes, then is it posibble to reset amount of kills for each guild once every one week?
I am asking these questions ,bacause i have on my page something like the most powerful guilds where every guild has assigned the proper amount of kills based of its players frags, so I assume that there is probably the way to do it?
Since I have no idea how to get a guild's total kills or is it even possible I decided to get a uniqe storage for every guild.
The problem was/is to establish a uniqe storage for the guilds,so I thought up that the storage would be a guild id.
I thought that the idea is perfect but I've got the error:
Then I realized that a storage has to be a number from 1000 to 80000. (At least I think so)
And since I have no idea what number a guild id could be I decided to increase the guild number id about 1000 to have a number from the interval.
And the error:
I have to admit that I am a little confused ,because the only explanation for this would be the fact that guild id is not a number but I hardly belive it.
If anyone could take a look on it and explain me why it doesn't want to work in that way that would be great
I am trying to make a small reward for the players in the top 5 guilds which has the most kills.
I have two queststions about it:
1.Is it possible to make a script which would find top 5 guild in terms of amount of kills and get them a proper reward?
2.If for first question anserw is yes, then is it posibble to reset amount of kills for each guild once every one week?
I am asking these questions ,bacause i have on my page something like the most powerful guilds where every guild has assigned the proper amount of kills based of its players frags, so I assume that there is probably the way to do it?
Since I have no idea how to get a guild's total kills or is it even possible I decided to get a uniqe storage for every guild.
The problem was/is to establish a uniqe storage for the guilds,so I thought up that the storage would be a guild id.
I thought that the idea is perfect but I've got the error:
Lua:
local config =
{
killStorageValue = 3943,
deathStorageValue = 3944, -- moje storage naliczajace zgony i kile
gid = getPlayerGuildId(cid), -- nie na cid czyli gracza nakladany storage na na gid czyli na gildie
}
function onKill(cid, target, lastHit)
print("start")
if cid ~= target and isPlayer(target) then
local levelDiff = getPlayerLevel(target)/getPlayerLevel(cid)
print("statment 1 passed")
if levelDiff >= 0.75 then
print("diffrence works")
setGlobalStorageValue((config.gid + 1000),getGlobalStorage((config.gid + 1000),1) + 1)
doPlayerSendTextMessage(cid, "You gained a kill for your Guild.Congratulation!",21)
print("config.gid, getGlobalStorage(config.gid,1)")
end
end
return true
end
Code:
[20:36:05.676] [Error - CreatureScript Interface]
[20:36:05.676] data/creaturescripts/scripts/KillTheSameIP.lua:onKill
[20:36:05.694] Description:
[20:36:05.695] data/creaturescripts/scripts/KillTheSameIP.lua:21: attempt to call global 'getGlobalStorage' (a nil value)
[20:36:05.696] stack traceback:
[20:36:05.697] data/creaturescripts/scripts/KillTheSameIP.lua:21: in function <data/creaturescripts/scripts/KillTheSameIP.lua:11>
Then I realized that a storage has to be a number from 1000 to 80000. (At least I think so)
And since I have no idea what number a guild id could be I decided to increase the guild number id about 1000 to have a number from the interval.
Lua:
local config =
{
killStorageValue = 3943,
deathStorageValue = 3944, -- moje storage naliczajace zgony i kile
gid = getPlayerGuildId(cid) -- nie na cid czyli gracza nakladany storage na na gid czyli na gildie
}
function onKill(cid, target, lastHit)
print("start")
if cid ~= target and isPlayer(target) then
local levelDiff = getPlayerLevel(target)/getPlayerLevel(cid)
print("statment 1 passed")
if levelDiff >= 0.75 then
print("diffrence works")
setGlobalStorageValue((config.gid+1000),getGlobalStorage((config.gid + 1000),1) + 1)
doPlayerSendTextMessage(cid, "You gained a kill for your Guild.Congratulation!",21)
print("config.gid, getGlobalStorage(config.gid,1)")
end
end
return true
end
And the error:
Code:
[20:48:26.247] [Error - CreatureScript Interface]
[20:48:26.247] data/creaturescripts/scripts/KillTheSameIP.lua:onKill
[20:48:26.247] Description:
[20:48:26.247] data/creaturescripts/scripts/KillTheSameIP.lua:21: attempt to perform arithmetic on field 'gid' (a boolean value)
[20:48:26.247] stack traceback:
[20:48:26.247] data/creaturescripts/scripts/KillTheSameIP.lua:21: in function <data/creaturescripts/scripts/KillTheSameIP.lua:11>
I have to admit that I am a little confused ,because the only explanation for this would be the fact that guild id is not a number but I hardly belive it.
If anyone could take a look on it and explain me why it doesn't want to work in that way that would be great
Last edited by a moderator: