Im posting some War Scripts i made for my server. I know some of the coding may be "messy" or "bad" but bear with me and just try and make the code better instead of making fun of it.
First off this code Will set a storage value for Current Frags (untill u die), for a Total Storage for frags and a Storage for Total Deaths. It also broadcasts on certian storage value (Certian Frag ammount). And i also made it remove a Frag after you get a Frag So i can have the server Normal pvp.
This code just does a simple check and adds an Aol if you dont have one onLogin.
This is a code to make you go to Level 1 after death.
And this is the script to set you to level 100 when you log back in.
If you want to make it so people can donate so they start at a different level isntead of 100 you could use this script.
And heres a little Action script to set the donor storage value.
Heres another Action script you could use so if you only have a certian Frag count (storage Value) you can go to the certian Place
And heres a Talk Action that allows you to check a players Total Frags and Total Deaths, there ML and some other things.
Well theres all my newbie war scripts i hope itleast some people benefited from them =p
First off this code Will set a storage value for Current Frags (untill u die), for a Total Storage for frags and a Storage for Total Deaths. It also broadcasts on certian storage value (Certian Frag ammount). And i also made it remove a Frag after you get a Frag So i can have the server Normal pvp.
Lua:
function onKill(cid, target)
local config = {
item = 6500, -- Demonic Essence
store = getPlayerStorageValue(cid, 6000), -- storrage for Current frags
tstore = getPlayerStorageValue(cid, 7000), -- Total Storage value for kills
dstore = getPlayerStorageValue(cid, 8000), -- Total Storage value for deaths
rand = math.random(1,4),
pos = getPlayerPosition(cid)
}
local table = {
{"Smashed!", 189, 1},
{"Dead!", 190, 2},
{"Owned!", 18, 3},
{"Pwnt!", 215, 4}
}
if isPlayer(target) == true then
setPlayerStorageValue(cid, 6000, (config.store+1))
setPlayerStorageValue(cid, 7000, (config.tstore+1))
setPlayerStorageValue(target, 8000, (config.dstore+1))
doPlayerSetRedSkullTicks(cid, 0)
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, 6000) == 5) then
broadcastMessage(getCreatureName(cid) .. " is on killing spree! He killed 5 players!")
elseif(getPlayerStorageValue(cid, 6000) == 10) then
broadcastMessage(getCreatureName(cid) .. " is dominating! He killed 10 players!")
elseif(getPlayerStorageValue(cid, 6000) == 25) then
broadcastMessage(getCreatureName(cid) .. " is CRAZY! He killed 25 players!")
elseif(getPlayerStorageValue(cid, 6000) == 50) then
broadcastMessage(getCreatureName(cid) .. " is UNSTOPPABLE!! He killed 50 players! DO SOMETHING!")
elseif(getPlayerStorageValue(cid, 6000) == 100) then
broadcastMessage("Bow down to your new god " ..getCreatureName(cid).. " has 100 frags!")
end
return TRUE
end
end
This code just does a simple check and adds an Aol if you dont have one onLogin.
Lua:
function onLogin(cid)
if getPlayerItemCount(cid, 2173) == FALSE then
doPlayerAddItem(cid, 2173, 1)
return TRUE
end
This is a code to make you go to Level 1 after death.
Lua:
function onDeath(cid, corpse, killer)
local downgradeToLevel = 1
doPlayerAddExperience(cid, (getExperienceForLevel(downgradeToLevel) - getPlayerExperience(cid)))
end
And this is the script to set you to level 100 when you log back in.
Lua:
function onLogin(cid)
if(getPlayerLevel(cid) < 100) then
local setPlayerLevelOnLogin = 100
doPlayerAddExperience(cid, (getExperienceForLevel(setPlayerLevelOnLogin) - getPlayerExperience(cid)))
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Go kill someone!")
end
return TRUE
end
If you want to make it so people can donate so they start at a different level isntead of 100 you could use this script.
Lua:
function onLogin(cid)
local config = {
setPlayerLevelOnLogin = 130,
storage = 9000
}
if getPlayerStorageValue(cid, config.storage) and (getPlayerLevel(cid) < 130) then
doPlayerAddExperience(cid, (getExperienceForLevel(setPlayerLevelOnLogin) - getPlayerExperience(cid)))
end
return TRUE
end
And heres a little Action script to set the donor storage value.
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
doCreatureSay(cid, "You will now login at level 130 for ever. Thx for buying!", TALKTYPE_ORANGE_1)
doSendMagicEffect(fromPosition, 37)
doRemoveItem(item.uid)
setPlayerStorageValue(cid,9000,1)
return TRUE
end
Heres another Action script you could use so if you only have a certian Frag count (storage Value) you can go to the certian Place
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local depo = {x = 529, y = 207, z = 7}
if item.actionid == 1596 and (getPlayerStorageValue(cid, 7000) > 100) then
doTeleportThing(cid, depo)
doSendMagicEffect(depo, CONST_ME_GROUNDSHAKER)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need to have a total of 100 or more frags to go into the Depo.")
end
end
And heres a Talk Action that allows you to check a players Total Frags and Total Deaths, there ML and some other things.
Lua:
function onSay(cid, words, param)
if(param == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
return TRUE
end
local player = getPlayerByNameWildcard(param)
if getPlayerStorageValue(player, 7000) == -1 or getPlayerStorageValue(player, 8000) == -1 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Information about: " .. getCreatureName(player) .. ". \nHe has a total of 0 frags.\nHe has a total of 0 deaths.")
else
doPlayerPopupFYI(cid, " " .. getCreatureName(player) .. " \n\nTotal frags: " .. getPlayerStorageValue(player, 7000).. "\nTotal deaths: " .. getPlayerStorageValue(player, 8000).. "\nMagic Level: " .. getPlayerMagLevel(player) .. "\nCurrent Level: " .. getPlayerLevel(player) .. "\nMelee Skill: " .. getPlayerSkillLevel(player,2) .. "\nDistance Skill: " .. getPlayerSkillLevel(player,4) .. "")
end
end
Well theres all my newbie war scripts i hope itleast some people benefited from them =p
Last edited: