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

Lua Add +1 frag if kill player

lostenhoz

New Member
Joined
Aug 31, 2020
Messages
29
Reaction score
0
I have this script to add frag when killing player, but it works in a rare way, I don't know if it's related to skulls
my server is war 0.4

local skulls = {SKULL_WHITE, SKULL_YELLOW, SKULL_RED, SKULL_BLACK}

function addPlayerFrag(cid, value)
db.executeQuery("UPDATE players SET frags_all = frags_all + " .. value .. " WHERE id = " .. getPlayerGUID(cid) .. ";")
return true
end

function onKill(cid, target)
if isPlayer(cid) and isPlayer(target) then
for i= 1, #skulls do
if getPlayerSkullType(target) == skulls then
addPlayerFrag(cid, 1)
break
end
end
end
return true
end

function onLogin(cid)
registerCreatureEvent(cid, "TopFrags")
return true
end
 

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,096
Solutions
34
Reaction score
182
Lua:
function addPlayerFrag(cid, value)
    db.executeQuery("UPDATE players SET frags_all = frags_all + " .. value .. " WHERE id = " .. getPlayerGUID(cid) .. ";")
    return true
end

function onKill(cid, target)
    if isPlayer(cid) and isPlayer(target) then
        addPlayerFrag(cid, 1)
    end
    return true
end

function onLogin(cid)
    registerCreatureEvent(cid, "TopFrags")
    return true
end
 
Top