- Skarbnica OTS http://www.skrypty28.pun.pl/index.php - Skrypty http://www.skrypty28.pun.pl/viewforum.php?id=3 - [8.0]Wasp pilnujący porządku... http://www.skrypty28.pun.pl/viewtopic.php?id=8 |
Max Dragon - 03-03-2008 20:42:52 |
Działa to na takie zasadzie-Wasp(tzw."porządkowy"), który po usłyszeniu przekleństwa pozostawia gracza z ilością życia równą 1. Gdy graczowi pozostanie 1hp, a nadal będzie używał nieprzyzwoitych słów-zostanie zabity :). Kod:<npc name="Wasp Security" script="data/npc/scripts/wasphp.lua" access="3" lookdir="2"> <mana now="800" max="800"/> <health now="200" max="200"/> <look type="44" head="20" body="30" legs="40" feet="50" corpse="2131"/> </npc> 2.Nastepnie tworzymy plik wasphp.lua w data/npc/scripts i wklejamy to: Kod:-----NPC by Max Dragon----- local focus = 0 local talk_start = 0 local target = 0 local following = false local attacking = false function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) end function onCreatureTurn(creature) end function msgcontains(txt, str) return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)')) end function onCreatureSay(cid, type, msg) msg = string.lower(msg) if ((string.find(msg, '(%a*)kurw(%a*)')) or (string.find(msg, '(%a*)dziwk(%a*)')) or (string.find(msg, '(%a*)suk(%a*)')) or (string.find(msg, '(%a*)debil(%a*)')) or (string.find(msg, '(%a*)h**(%a*)')) or (string.find(msg, '(%a*)spierd(%a*)')) or (string.find(msg, '(%a*)jeb(%a*)')) or (string.find(msg, '(%a*)pierdol(%a*)')) or (string.find(msg, '(%a*)qrw(%a*)')) or (string.find(msg, '(%a*)pizd(%a*)')) or (string.find(msg, '(%a*)fuck(%a*)')) or (string.find(msg, '(%a*)bitch(%a*)')) or (string.find(msg, '(%a*)qurw(%a*)')) and (focus == 0)) and getDistanceToCreature(cid) < 8 then selfSay('' .. creatureGetName(cid) ..' nie przeklinaj wiecej...!!') hp = getPlayerHealth(cid)-1 mana = getPlayerMana(cid) doPlayerAddMana(cid,-mana) doPlayerAddHealth(cid,-hp) end if ((string.find(msg, '(%a*)kurw(%a*)')) or (string.find(msg, '(%a*)dziwk(%a*)')) or (string.find(msg, '(%a*)suk(%a*)')) or (string.find(msg, '(%a*)debil(%a*)')) or (string.find(msg, '(%a*)h**(%a*)')) or (string.find(msg, '(%a*)spierd(%a*)')) or (string.find(msg, '(%a*)jeb(%a*)')) or (string.find(msg, '(%a*)pierdol(%a*)')) or (string.find(msg, '(%a*)qrw(%a*)')) or (string.find(msg, '(%a*)pizd(%a*)')) or (string.find(msg, '(%a*)fuck(%a*)')) or (string.find(msg, '(%a*)bitch(%a*)')) or (string.find(msg, '(%a*)qurw(%a*)')) and (focus == 0)) and mana == 0 and hp <= 1 and getDistanceToCreature(cid) < 8 then selfSay('' .. creatureGetName(cid) ..' nie przeklinaj wiecej...!!') doPlayerAddHealth(cid,-(hp+1)) focus = cid talk_start = os.clock() end end function onCreatureChangeOutfit(creature) end function onThink() doNpcSetCreatureFocus(focus) if (os.clock() - talk_start) > 0 then focus = 0 end if focus == 0 then randsay = math.random(1,60) if randsay == 1 then selfSay('Nie przeklinaj...') end if randsay == 2 then selfSay('Nie uzywaj wulgaryzmow...') end end end Mam nadzieję że NPC komuś się przyda ;] |