Cloow
Active Member
- Joined
- May 10, 2010
- Messages
- 1,086
- Reaction score
- 35
Can someone please fix my broken script?
I have factions, faction 1 is used by group id 2 and faction 2 is used by group id 3
this script should make so if faction 1 kill faction 1 player he gets whiteskull and removes 1 "pvp token" but if he kills a faction 2 member he instead gain 1 pvp token and gets no skull.
This is my attempt.
This script will give 3x pvp tokens for killing a player with white skull and 5 for red and 8 for black. But im getting console error
Rep for the one who can fix up my scripts :>
I guess I need to disable skull system in config?
I have factions, faction 1 is used by group id 2 and faction 2 is used by group id 3
this script should make so if faction 1 kill faction 1 player he gets whiteskull and removes 1 "pvp token" but if he kills a faction 2 member he instead gain 1 pvp token and gets no skull.
This is my attempt.
Lua:
local cfg = {
rewardt1 = 4845,
rewardt2 = 9020,
}
local playerKiller = isPlayer(cid) and getPlayerGroupId(cid)
function onKill(cid, target, lastHit)
if isPlayer(lastHit) and getPlayerGroupId(cid) == 2 then
doPlayerAddItem(cid, cfg.rewardt1, 1)
doSendAnimatedText(cid, 'FRAG +1', TEXTCOLOR_GOLD)
elseif playerKiller == 2 then
doCreatureSetSkullType(cid, 3)
doSendAnimatedText(cid, 'TEAM KILLER -1', TEXTCOLOR_RED)
elseif isPlayer(lastHit) and getPlayerGroupId(cid) == 3 then
doPlayerAddItem(cid, cfg.rewardt2, 1)
doSendAnimatedText(cid, 'FRAG +1', TEXTCOLOR_GOLD)
elseif playerKiller == 3 then
doCreatureSetSkullType(cid, 3)
doSendAnimatedText(cid, 'TEAM KILLER -1', TEXTCOLOR_RED)
end
return TRUE
end
This script will give 3x pvp tokens for killing a player with white skull and 5 for red and 8 for black. But im getting console error
Lua:
local loot = 9020
Skulls = {}
Skulls[3] = {Skull = 3}
Skulls[4] = {Skull = 5}
Skulls[5] = {Skull = 8}
function onKill(cid, target, lastHit)
doPlayerAddItem(cid, loot, Skulls[getCreatureSkullType(lastHit)].Skull)
return true
end
Rep for the one who can fix up my scripts :>
I guess I need to disable skull system in config?