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

if you kill

Lbtg

Intermediate OT User
Joined
Nov 22, 2008
Messages
2,332
Reaction score
143
could someone make a script , if player with same ip kills player with same IP , the player who kills it gets -10 levels


posible ?
 
Creature script.

Lua:
function onKill(cid, target)
if isPlayer(target) then
if getPlayerIp(target) == getPlayerIp(cid) then
doPlayerAddLevel(cid, -10)
doPlayerSendTextMessage(cid, 22, "You have been de-leveled for trying to cheat.")
end
end
end
 
can you fully explain how to put it and so on ?
do i need a line on login.lua ?

sorry im nobish
 
To xml you have to add
Lua:
	<event type="kill" name="name1" event="script" value="name2.lua"/>

Name1 - how you have registered it in login.lua
Name2 - name of file.

BTW. I tried this, and my lvl was 350, now I'm 1 xd Player who theoretically shoul "died", lost his all amount of hp, and he still is alive xd
For every hit it is de-leveled.
 
Last edited:
Gigastar forgot about "return true" (or doesn't know about it) .
Code:
function onKill(cid, target)
if isPlayer(target) then
if getPlayerIp(target) == getPlayerIp(cid) then
doPlayerAddLevel(cid, -10)
doPlayerSendTextMessage(cid, 22, "You have been de-leveled for trying to cheat.")
end
end
return true
end
 
More Explain:
here we are :)
in your data/creaturescripts/creaturescripts.xml paste the following code:
XML:
<event type="kill" name="anticheat" event="script" value="anticheat.lua"/>

Now go to your data/creaturescripts/scripts open file name login.lua and
After:

Lua:
registerCreatureEvent(cid, "GuildMotd")

post this code in next line:

Lua:
registerCreatureEvent(cid, "anticheat")

Now in your data/creaturescripts/scripts make file name "anticheat.lua" and paste the following code:
Lua:
local sirion = 10 -- How many levels you want the player to lose.
local sirionmsg = "You have lost 10 levels for cheating." -- the message when cheat lvls
function onKill(cid, target)
if isPlayer(target) and getPlayerIp(target) == getPlayerIp(cid) then
doPlayerAddLevel(cid, -sirion)
doCreatureSay(uid, sirionmsg, TALKTYPE_ORANGE_1)
doSendMagicEffect(getCreaturePosition(cid), 65)
        end
   return true
end

Please any errors report back here and tell if works , i had 2 months no scripting :) just retired today M3
 
Back
Top