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

Need help with fragcounter script

legolas23

New Member
Joined
Jan 8, 2009
Messages
537
Reaction score
3
Hiho
I've written the frag counting script. It uses player's storage to count frags but it isn't working. Can any1 fix this?

Code:
function onKill(cid, target, lastHit)
	if(not isPlayer(target)) then
		return true
	end
	
	if(not lastHit) then
		return true
	end
	
	local storage = getPlayerStorageValue(cid, 16969)
	if(storage == -1) then
		storage = 0
	end
	
	setPlayerStorageValue(cid, 16969, (storage + 1))
	return true
end

Code:
<event type="kill" name="PlayerDeath" event="script" value="fragc.lua"/>

It doesn't give starage ++ to killers ,dunno why ;/

Rep ++ for help :)
 
PHP:
local storage = 16969
function onKill(cid, target, lastHit)
	if(isPlayer(target)) == FALSE then
		return TRUE
	end
	
	if(lastHit) == FALSE then
		return TRUE
	end

	if getPlayerStorageValue(cid, storage) == -1 then
		setPlayerStorageValue(cid, storage, 0)
	end
	
	setPlayerStorageValue(cid,storage,(getPlayerStorageValue(cid)+ 1))
	return TRUE
end
 
@up
u forgot the storage.
setPlayerStorageValue
(cid,storage,(getPlayerStorageValue(cid, storage)+ 1))

Lua:
local storage = getPlayerStorageValue(cid, 16969)
function onKill(cid, target, lastHit)
    if isPlayer(target) == true and lastHit == true then

    if(storage == -1) then
        storage = 0
    end

    setPlayerStorageValue(cid, 16969, (storage + 1))
    return true
end

try this one.
 
Last edited:
Lua:
local storage = getPlayerStorageValue(cid, 16969)
function onKill(cid, target, lastHit)
    if isPlayer(target) == true and lastHit == true then

    if(storage == -1) then
        storage = 0
    end

    setPlayerStorageValue(cid, 16969, (storage + 1))
    return true
end
end
 
ohh.. my bad -.- .. but if onKill works for monsters... u should add a isPlayer(cid) too.. thanks master-m for showing my mistake =]
 
u should start posting the errors that u got .. -.-
but ok..
Lua:
local storage = 16969
function onKill(cid, target, lastHit)
    if isPlayer(cid) == true and isPlayer(target) == true and lastHit == true then

    if(getPlayerStorageValue(cid, storage) == -1) then
        setPlayerStorageValue(cid, storage, 0)
    end

    setPlayerStorageValue(cid, storage, (getPlayerStorageValue(cid, storage) + 1))
    return true
end
end
if this doenst work .. I'll /suicide.
 
No bugs in console ,no effect i tried to use this script but not working too ;/

Code:
function onKill(cid, target)

local config = {
item = 6500, -- Demonic Essence
store = getPlayerStorageValue(cid, 16000),  -- storrage for Current frags
tstore = getPlayerStorageValue(cid, 17000), -- Total Storage value for kills
dstore = getPlayerStorageValue(cid, 18000),  -- Total Storage value for deaths 
rand = math.random(1,4),
pos = getPlayerPosition(cid)
}
	local table = {
	{"Smashed!", 189, 1},
	{"Dead!", 190, 1},
	{"Owned!", 18, 1},
	{"Pwnt!", 215, 1}
}

	if isPlayer(target) == true then
	setPlayerStorageValue(cid, 16000, (config.store+1))  
		setPlayerStorageValue(cid, 17000, (config.tstore+1))
            setPlayerStorageValue(target, 18000, (config.dstore+1))

local rand = math.random(1, #table)
doSendAnimatedText(config.pos, table[rand][1], tablica[rand][2])
doPlayerAddItem(cid, config.item, table[rand][3])
     
			if(getPlayerStorageValue(cid, 17000) == 50) then
                broadcastMessage(getCreatureName(cid) .. " is dominating! He killed 50 players!")
			elseif(getPlayerStorageValue(cid, 17000) == 100) then
			broadcastMessage(getCreatureName(cid) .. " is CRAZY! He killed 100 players!")
			elseif(getPlayerStorageValue(cid, 17000) == 200) then
				broadcastMessage(getCreatureName(cid) .. " is UNSTOPPABLE!! He killed 200 players! DO SOMETHING!")
			elseif(getPlayerStorageValue(cid, 17000) == 300) then
            	broadcastMessage("Bow down to your new god " ..getCreatureName(cid).. " has 300 frags!")
            end
            	return TRUE
               end	
                   end

Maybe I just add it incorrectly to creaturescripts?

Code:
<event type="kill" name="PlayerDeath" event="script" value="fragc.lua"/>
 
Last edited:
Back
Top