Qlimaxowy
New Member
- Joined
- Jul 3, 2013
- Messages
- 22
- Reaction score
- 3
I want to add that nothing is shown in the console now, you can enter the server.
OTX 2.x Engine
Protocol - 7.6-7.72
Config.lua
useFragHandler = false
worldType = "Hardcore"
How does this system work?
permanent_skull.lua it data/creaturescripts/scripts/
Then it records the event in
creaturescripts.xml
Then it adds the register to
Login.lua
What am I doing wrong?? Who can help me .
Consola + Video
OTX 2.x Engine
Protocol - 7.6-7.72
Config.lua
useFragHandler = false
worldType = "Hardcore"
How does this system work?
- After 2 kills - the player gets a white skull permanently.
- If he logs out and logs in again - the skull remains.
- The skull cannot be removed by death or loss of PZ (pzone).
- The number of kills is saved in storage, so it works even after restarting the server.
permanent_skull.lua it data/creaturescripts/scripts/
LUA:
local STORAGE_KILLS = 50000 -- ID storing the number of kills
local STORAGE_PERMA_SKULL = 50001 -- ID storing skull status
local KILL_THRESHOLD = 2 -- Kill count to get permanent white skull
-- A function that assigns a white skull after a kill
function onKill(cid, target, lastHit)
if isPlayer(cid) and isPlayer(target) then
local kills = getPlayerStorageValue(cid, STORAGE_KILLS)
if kills < 0 then kills = 0 end
-- Kill Count Update
kills = kills + 1
setPlayerStorageValue(cid, STORAGE_KILLS, kills)
-- Checks if player has reached kill limit
if kills >= KILL_THRESHOLD then
if getPlayerStorageValue(cid, STORAGE_PERMA_SKULL) ~= 1 then
setPlayerStorageValue(cid, STORAGE_PERMA_SKULL, 1) -- We mark a player as having a permanent skull
doCreatureSetSkullType(cid, SKULL_WHITE) -- Giving the skull a white color
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You got a permanent white skull for 2 kills!")
end
end
end
return true
end
-- Skull checker after login
function onLogin(cid)
if getPlayerStorageValue(cid, STORAGE_PERMA_SKULL) == 1 then
doCreatureSetSkullType(cid, SKULL_WHITE) -- White skull setting after login
end
return true
end
Then it records the event in
creaturescripts.xml
XML:
<event type="login" name="PermaSkullLogin" script="permanent_skull.lua"/>
<event type="kill" name="PermaSkullKill" script="permanent_skull.lua"/>
Then it adds the register to
Login.lua
LUA:
registerCreatureEvent(cid, "PermaSkullLogin")
registerCreatureEvent(cid, "PermaSkullKill")
What am I doing wrong?? Who can help me .
Consola + Video
Attachments
-
51C852DC-9CE0-4CB6-918B-DCFCB983491B.webp28.1 KB · Views: 9 · VirusTotal
Last edited: