• 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 a creaturescript "login.lua" or "death.lua" like this

Ralfegor

New Member
Joined
Apr 6, 2008
Messages
297
Reaction score
1
i have this
custom vocations:
vocID = 11 = Master Sorcerer Jumper -- fromvoc="5"
vocID = 12 = Elder Druid Jumper -- fromvoc="6"
vocID = 13 = Royal Paladin Jumper -- fromvoc="7"
vocID = 14 = Elite Knight Jumper -- fromvoc="8"

when player1 die by a PLAYER2 and player1 was Vocation id 11(Master Sorcerer Jumper) then do player1 change vocation id to vocid 5(Master Sorcerer), or if get player1 voc id 12(Elder Druid Jumper) then do player1 change vocation id 6(Elder Druid), or if get player1 voc id 13(Royal Paladin Jumper) do player1 change voc id to 7(Royal Paladin), or if get player1 voc id 14(Elite Knight Jumper) then do player change voc id to 8(Elite Knight) and PLAYER2(the killer) if he is a master sorcerer(vocID 5) then PLAYER2 will become vocID 11 (Master Sorcerer Jumper), or if he is elder druid(vocID 6) then PLAYER2 will become Elder Druid Jumper (vocID 12), or if PLAYER2 is Royal Paladin(vocID 7) then he will be now Royal Paladin Jumper = vocID 13, or if he is elite knight(vocID 8) he will be now Elite Knight Jumper


I want only 1 people have this "Jumper", so it would be player1 but when PLAYER2 kill player1, now PLAYER2 he is the special vocacion "Jumper" and player1 of course he will be normal voc again
 
i make this one but when i kill the player i dont change to jumper :( whats wrong?
Code:
local config = {
	deathListEnabled = getBooleanFromString(getConfigInfo('deathListEnabled')),
	sqlType = getConfigInfo('sqlType'),
	maxDeathRecords = getConfigInfo('maxDeathRecords')
}

function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
   [COLOR="Red"] if getPlayerVocation(cid) >= 11  and getPlayerVocation(lastHitKiller) == 5 then
       doPlayerSetVocation(lastHitKiller, 11)
       end
    if getPlayerVocation(cid) >= 11  and getPlayerVocation(lastHitKiller) == 6 then
       doPlayerSetVocation(lastHitKiller, 12)
       end
    if getPlayerVocation(cid) >= 11  and getPlayerVocation(lastHitKiller) == 7 then
       doPlayerSetVocation(lastHitKiller, 13)
       end
    if getPlayerVocation(cid) >= 11  and getPlayerVocation(lastHitKiller) == 8 then
       doPlayerSetVocation(lastHitKiller, 14)
       end
       
    if getPlayerVocation(cid) == 11 and isPlayer(lastHitKiller) == TRUE then
       doPlayerSetVocation(cid, 5)
       end
    if getPlayerVocation(cid) == 12 and isPlayer(lastHitKiller) == TRUE then
       doPlayerSetVocation(cid, 6)
       end
    if getPlayerVocation(cid) == 13 and isPlayer(lastHitKiller) == TRUE then
       doPlayerSetVocation(cid, 7)
       end
    if getPlayerVocation(cid) == 14 and isPlayer(lastHitKiller) == TRUE then
       doPlayerSetVocation(cid, 8)
       end[/COLOR]
	if(config.deathListEnabled == TRUE) then
		local hitKillerName = "field item"
		local damageKillerName = ""
		if(lastHitKiller ~= FALSE) then
			if(isPlayer(lastHitKiller) == TRUE) then
				hitKillerName = getPlayerGUID(lastHitKiller)
			else
				hitKillerName = getCreatureName(lastHitKiller)
			end

			if(mostDamageKiller ~= FALSE and mostDamageKiller ~= lastHitKiller and getCreatureName(mostDamageKiller) ~= getCreatureName(lastHitKiller)) then
				if(isPlayer(mostDamageKiller) == TRUE) then
					damageKillerName = getPlayerGUID(mostDamageKiller)
				else
					damageKillerName = getCreatureName(mostDamageKiller)
				end
			end
		end

		db.executeQuery("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `altkilled_by`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", " .. db.escapeString(hitKillerName) .. ", " .. db.escapeString(damageKillerName) .. ");")
		local rows = db.getResult("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";")
		if(rows:getID() ~= -1) then
			local amount = (rows:numRows(true) - config.maxDeathRecords)
			if(amount > 0) then
				if(config.sqlType == "sqlite") then
					for i = 1, amount do
						db.executeQuery("DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1);")
					end
				else
					db.executeQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT " .. amount .. ";")
				end
			end
		end
	end
end
 
Code:
local config = {
	deathListEnabled = getBooleanFromString(getConfigInfo('deathListEnabled')),
	sqlType = getConfigInfo('sqlType'),
	maxDeathRecords = getConfigInfo('maxDeathRecords')
}

function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
	if(config.deathListEnabled == TRUE) then
		local hitKillerName = "field item"
		local damageKillerName = ""
		if(lastHitKiller ~= FALSE) then
			if(isPlayer(lastHitKiller) == TRUE) then
				hitKillerName = getPlayerGUID(lastHitKiller)
			else
				hitKillerName = getCreatureName(lastHitKiller)
			end

			if(mostDamageKiller ~= FALSE and mostDamageKiller ~= lastHitKiller and getCreatureName(mostDamageKiller) ~= getCreatureName(lastHitKiller)) then
				if(isPlayer(mostDamageKiller) == TRUE) then
					damageKillerName = getPlayerGUID(mostDamageKiller)
				else
					damageKillerName = getCreatureName(mostDamageKiller)
				end
			end
		end

		db.executeQuery("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `altkilled_by`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", " .. db.escapeString(hitKillerName) .. ", " .. db.escapeString(damageKillerName) .. ");")
		local rows = db.getResult("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";")
		if(rows:getID() ~= -1) then
			local amount = (rows:numRows(true) - config.maxDeathRecords)
			if(amount > 0) then
				if(config.sqlType == "sqlite") then
					for i = 1, amount do
						db.executeQuery("DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1);")
					end
				else
					db.executeQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT " .. amount .. ";")
				end
			end
		end
	end

    if getPlayerVocation(cid) >= 11  and getPlayerVocation(lastHitKiller) == 5 then
       doPlayerSetVocation(lastHitKiller, 11)
    elseif getPlayerVocation(cid) >= 11  and getPlayerVocation(lastHitKiller) == 6 then
       doPlayerSetVocation(lastHitKiller, 12)
    elseif getPlayerVocation(cid) >= 11  and getPlayerVocation(lastHitKiller) == 7 then
       doPlayerSetVocation(lastHitKiller, 13)
    elseif getPlayerVocation(cid) >= 11  and getPlayerVocation(lastHitKiller) == 8 then
       doPlayerSetVocation(lastHitKiller, 14)
    end

    if getPlayerVocation(cid) == 11 and isPlayer(lastHitKiller) == TRUE then
       doPlayerSetVocation(cid, 5)
    elseif getPlayerVocation(cid) == 12 and isPlayer(lastHitKiller) == TRUE then
       doPlayerSetVocation(cid, 6)
    elseif getPlayerVocation(cid) == 13 and isPlayer(lastHitKiller) == TRUE then
       doPlayerSetVocation(cid, 7)
    elseif getPlayerVocation(cid) == 14 and isPlayer(lastHitKiller) == TRUE then
       doPlayerSetVocation(cid, 8)
    end
return TRUE
end

i am not in my computer so the code is improvised and when i have time i will recode that :D
 
BUMP
i just need when a player kill another player set killer voc

i tried like this
Code:
       doPlayerSetVocation(lastHitKiller, 11)
im editing playerdeath.lua why is not working? Killer is not getting the voc:(
 
Back
Top