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

can anyone see why this script wont work?

calum69

New Member
Joined
Aug 12, 2007
Messages
346
Reaction score
3
Location
Great Britain
LUA:
function onKill(cid, target, lastHit)
	local humanStorage, vampireStorage = 10001, 20002
	local kill_human_storage, kill_vampire_storage = 1000, 5000
	if getPlayerStorageValue(cid, kill_human_storage) == -1 then
		setPlayerStorageValue(cid, kill_human_storage, 0)
	if getPlayerStorageValue(cid, kill_vampire_storage) == -1 then
		setPlayerStorageValue(cid, kill_vampire_storage, 0)
	end
	if getPlayerStorageValue(cid, humanStorage) ~= -1 then
		setPlayerStorageValue(cid, kill_human_storage, getPlayerStorageValue(cid, kill_human_storage)+1)
	elseif getPlayerStorageValue(cid, vampireStorage) ~= -1 then
		setPlayerStorageValue(cid, kill_vampire_storage, getPlayerStorageValue(cid, kill_vampire_storage)+1)
	end
	doPlayerSetSpecialDescription(cid, getCreatureName(cid) .. " has killed " .. getPlayerStorageValue(cid, kill_vampire_storage) .. " vampires & " .. getPlayerStorageValue(cid, kill_human_storage) .. " humans.")
	return true
end
 
PHP:
  function onKill(cid, target, lastHit)
        local humanStorage, vampireStorage = 10001, 20002
        local kill_human_storage, kill_vampire_storage = 1000, 5000
        if getPlayerStorageValue(cid, kill_human_storage) == -1 then
                setPlayerStorageValue(cid, kill_human_storage, 0)
        end
        if getPlayerStorageValue(cid, kill_vampire_storage) == -1 then
                setPlayerStorageValue(cid, kill_vampire_storage, 0)
        end
        if getPlayerStorageValue(cid, humanStorage) ~= -1 then
                setPlayerStorageValue(cid, kill_human_storage, getPlayerStorageValue(cid, kill_human_storage)+1)
        elseif getPlayerStorageValue(cid, vampireStorage) ~= -1 then
                setPlayerStorageValue(cid, kill_vampire_storage, getPlayerStorageValue(cid, kill_vampire_storage)+1)
        end
        doPlayerSetSpecialDescription(cid, getCreatureName(cid) .. " has killed " .. getPlayerStorageValue(cid, kill_vampire_storage) .. " vampires & " .. getPlayerStorageValue(cid, kill_human_storage) .. " humans.")
        return true
end
 
The second problem that there is no error :/

2.jpg
 
ok let me take a guess you want this to be like players with storage 10001
is human and 20002 is vampire and player who kill either will show on look
[Name Here] has killed [X] vampires and [x] humans. Right?
well if so you have to specify who is the 'target'

Edit:
Here try this and see if it works:
Code:
function onKill(cid, target, lastHit)
    local humanStorage, vampireStorage = 10001, 20002
    local kill_human_storage, kill_vampire_storage = 1000, 5000
        if getPlayerStorageValue(cid, kill_human_storage) == -1 and getPlayerStorageValue(cid, kill_vampire_storage) == -1 then
            setPlayerStorageValue(cid, kill_human_storage, 0)
            setPlayerStorageValue(cid, kill_vampire_storage, 0)
        end
        if getPlayerStorageValue(target, humanStorage) ~= -1 then
            setPlayerStorageValue(cid, kill_human_storage, getPlayerStorageValue(cid, kill_human_storage)+1)
        elseif getPlayerStorageValue(target, vampireStorage) ~= -1 then
            setPlayerStorageValue(cid, kill_vampire_storage, getPlayerStorageValue(cid, kill_vampire_storage)+1)
        end
        doPlayerSetSpecialDescription(cid, getCreatureName(cid) .. " has killed " .. getPlayerStorageValue(cid, kill_vampire_storage) .. " vampires & " .. getPlayerStorageValue(cid, kill_human_storage) .. " humans.")
    return true
end
I don't know if "doPlayerSetSpecialDescription" works
 
ok nice work man i havent got time to test it, but if it doesnt work how else can i show it onlook?

rep for the help :)

hopefully you can find the answer thanks Rep++
 
well if it does not work on the script, you can make another, onLook, it will
be like this:
Code:
function onLook(cid, thing, position, lookDistance)
local kill_human_storage, kill_vampire_storage = 1000, 5000
	if isPlayer(thing.uid) then
		return doPlayerSendTextMessage(cid, 25, (cid, getCreatureName(thing.uid) .. " has killed " .. math.max(0, getPlayerStorageValue(thing.uid, kill_vampire_storage)) .. " vampires & " .. math.max(0, getPlayerStorageValue(thing.uid, kill_human_storage)) .. " humans.")
	end
end
test it since I'm not sure if thing.uid will work, since I saw someone use
it and it worked but I'm not sure. :P
 
well if it does not work on the script, you can make another, onLook, it will
be like this:
Code:
function onLook(cid, thing, position, lookDistance)
local kill_human_storage, kill_vampire_storage = 1000, 5000
	if isPlayer(thing.uid) then
		return doPlayerSendTextMessage(cid, 25, (cid, getCreatureName(thing.uid) .. " has killed " .. math.max(0, getPlayerStorageValue(thing.uid, kill_vampire_storage)) .. " vampires & " .. math.max(0, getPlayerStorageValue(thing.uid, kill_human_storage)) .. " humans.")
	end
end
test it since I'm not sure if thing.uid will work, since I saw someone use
it and it worked but I'm not sure. :P

Yes, we had a script onLook and it works fine but this line "He killed..." wasnt together with "You see Wesoly136(Level 1). He is a sorcerer blala...". It was detached message :/
For better look I added delay for script onLook and it was fine, but we want to have it solid:D


And I saw repsystem writed in sources so I think its the best way, but I'm so weak in sorces :/

EDIT
Ok, SpecialDesc works but after logout its disappear, We must make onLogin to set description every login :S
 
Last edited:
Back
Top