/* * Patch for filter_var() */ if(!function_exists('filter_var')){ define('FILTER_VALIDATE_IP', 'ip'); define('FILTER_FLAG_IPV4', 'ipv4'); define('FILTER_FLAG_IPV6', 'ipv6'); define('FILTER_VALIDATE_EMAIL', 'email'); define('FILTER_FLAG_EMAIL_UNICODE', 'unicode'); function filter_var($variable, $filter, $option = false){ if($filter == 'ip'){ if($option == 'ipv4'){ if(preg_match("/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/", $variable, $matches)){ $variable = $matches[1]; return $variable; } } if($option == 'ipv6'){ if(preg_match("/\s*(([:.]{0,7}[0-9a-fA-F]{0,4}){1,8})\s*/", $variable, $matches)){ $variable = $matches[1]; return $variable; } } } if($filter == 'email'){ if($option == 'unicode' || $option == false){ if(preg_match("/\s*(\S*@\S*\.\S*)\s*/", $variable, $matches)){ $variable = $matches[1]; return $variable; } } } } }
INSERT INTO `walker_routes` (`route_id`, `npc_id`, `move_point`, `chatText`, `move_x`, `move_y`, `move_z`, `delay`, `running`) VALUES
(43, 888823, 1, 'Please ! Vote for Us now !', 82718, 149312, -3471, 10, 1),
(43, 888823, 2, 'Prosze ! Glosuj na nasz server !', 82713, 147899, -3471, 10, 1),
(43, 888823, 3, 'Please ! Vote for Us now !', 81153, 147904, -3471, 10, 1),
(43, 888823, 4, 'Prosze ! Glosuj na nasz server !', 81158, 149316, -3471, 10, 1);
43- jest to ID 'walker_routes' , czyli jeśli dodajemy nowego NPC walkera to podajemy ID wyższe o jeden niż wyżej w tabeli
888823- w tym przypadku jest to ID NPC , do którego owy walker się odnośi
1,2,3,4- są to kolejne ruchy , teksty - zaczynamy od 1 , dodając kolejne
'Please ! Vote for Us now !'- tutaj podajemy jaki test ma napisać NPC
82718, 149312, -3471,- lokacja , do której ma przejść NPC
10- odstęp w sekundach , po których NPC wykona nową czynność ( napisze tekst lub przejdzie do innego miejsca )
1- tu dajemy zawsze jedynke
(43, 888823, 1, 'null', 82718, 149312, -3471, 10, 1),
Your IP address 89.78.xx.xxx is already downloading a file. Please wait until the download is completed.
Takiego często-mówiącego, to do jaila i niech regulamin krzyczy :D
package ai.individual;
import java.util.Calendar;
import java.util.List;
import javolution.util.FastList;
import net.sf.l2j.Config;
import net.sf.l2j.gameserver.ThreadPoolManager;
import net.sf.l2j.gameserver.instancemanager.TownManager;
import net.sf.l2j.gameserver.model.actor.L2Character;
import net.sf.l2j.gameserver.model.actor.L2Npc;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.quest.Quest;
import net.sf.l2j.gameserver.model.zone.type.L2TownZone;
import net.sf.l2j.gameserver.network.clientpackets.Say2;
import net.sf.l2j.gameserver.network.serverpackets.NpcSay;
import net.sf.l2j.util.Rnd;
public class VoteNpc extends Quest
{
private static final int VoteNpc_GLUDIO = 9999991; // Gludio
private static final int VoteNpc_DION = 9999992; // Dion
private static final int VoteNpc_GIRAN = 9999993; // Giran
private static final int VoteNpc_OREN = 9999994; // Oren
private static final int VoteNpc_ADEN = 9999995; // Aden
private static final int VoteNpc_INNADRIL = 9999996; // Innadril
private static final int VoteNpc_GODDARD = 9999997; // Goddard
private static final int VoteNpc_RUNE = 9999998; // Rune
private static final int VoteNpc_SCHUTTGART = 9999999; // Schuttgart
List<L2Npc> _npcs = new FastList<L2Npc>();
private static final String[] dlog =
{
"Vote for our server!"
};
public VoteNpc(int questId, String name, String descr)
{
super(questId, name, descr);
// Register Events
addEventId(VoteNpc_GLUDIO, Quest.QuestEventType.ON_SPAWN);
addEventId(VoteNpc_DION, Quest.QuestEventType.ON_SPAWN);
addEventId(VoteNpc_GIRAN, Quest.QuestEventType.ON_SPAWN);
addEventId(VoteNpc_OREN, Quest.QuestEventType.ON_SPAWN);
addEventId(VoteNpc_ADEN, Quest.QuestEventType.ON_SPAWN);
addEventId(VoteNpc_INNADRIL, Quest.QuestEventType.ON_SPAWN);
addEventId(VoteNpc_GODDARD, Quest.QuestEventType.ON_SPAWN);
addEventId(VoteNpc_RUNE, Quest.QuestEventType.ON_SPAWN);
addEventId(VoteNpc_SCHUTTGART, Quest.QuestEventType.ON_SPAWN);
scheduleBroadcast();
}
@Override
public String onSpawn(L2Npc npc)
{
if (!_npcs.contains(npc))
_npcs.add(npc);
return super.onSpawn(npc);
}
private void scheduleBroadcast()
{
Calendar cal = Calendar.getInstance();
int tfhTime = cal.get(Calendar.HOUR_OF_DAY);
long currTime = tfhTime*3600000 + cal.get(Calendar.MINUTE)*60000 +
cal.get(Calendar.SECOND)*1000 + cal.get(Calendar.MILLISECOND);
long nextTime = 0;
if ((tfhTime + 1) > 24) nextTime = 6900000;
else if (cal.get(Calendar.MINUTE) < 55) nextTime = tfhTime*3600000 + 3300000;
else nextTime = (tfhTime + 1)*3600000 + 3300000;
long initial = nextTime-currTime;
ThreadPoolManager.getInstance().
scheduleGeneralAtFixedRate(new BroadcastToZone(), initial, 3600000L);
}
public static void main(String[] args)
{
new VoteNpc(-1,"VoteNpc","ai");
}
class BroadcastToZone implements Runnable
{
@Override
public void run()
{
for (L2Npc npc : _npcs)
{
if (npc != null)
{
if (Config.DEBUG)
_log.info("Broadcasting VoteNpc Message to Zone");
int dg = Rnd.get(0, 2);
NpcSay ns = new NpcSay(npc.getObjectId(), Say2.SHOUT, npc.getNpcId(), dlog[dg]);
L2TownZone town = TownManager.getTown(npc.getX(), npc.getY(), npc.getZ());
{
if (town.getCharactersInside() != null && !town.getCharactersInside().isEmpty())
{
for (L2Character obj : town.getCharactersInside().values())
{
if (obj == null)
continue;
if (obj instanceof L2PcInstance)
obj.sendPacket(ns);
}
}
}
}
}
}
}
}
Postaw npcki w miastach beda krzyczec zeby glosowali w kazdym z miast
@ Matim z tego co ja pamietam ten npc ktorego tutaj przedstawiles z " Coded by Matim " zostal dawno temu napisany przez kogos z for l2jfree, nice credit stealing :dw_3_2:Kod: [Zaznacz]package ai.individual;
import java.util.Calendar;
import java.util.List;
import javolution.util.FastList;
import net.sf.l2j.Config;
import net.sf.l2j.gameserver.ThreadPoolManager;
import net.sf.l2j.gameserver.instancemanager.TownManager;
import net.sf.l2j.gameserver.model.actor.L2Character;
import net.sf.l2j.gameserver.model.actor.L2Npc;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.quest.Quest;
import net.sf.l2j.gameserver.model.zone.type.L2TownZone;
import net.sf.l2j.gameserver.network.clientpackets.Say2;
import net.sf.l2j.gameserver.network.serverpackets.NpcSay;
import net.sf.l2j.util.Rnd;
public class VoteNpc extends Quest
{
private static final int VoteNpc_GLUDIO = 9999991; // Gludio
private static final int VoteNpc_DION = 9999992; // Dion
private static final int VoteNpc_GIRAN = 9999993; // Giran
private static final int VoteNpc_OREN = 9999994; // Oren
private static final int VoteNpc_ADEN = 9999995; // Aden
private static final int VoteNpc_INNADRIL = 9999996; // Innadril
private static final int VoteNpc_GODDARD = 9999997; // Goddard
private static final int VoteNpc_RUNE = 9999998; // Rune
private static final int VoteNpc_SCHUTTGART = 9999999; // Schuttgart
List<L2Npc> _npcs = new FastList<L2Npc>();
private static final String[] dlog =
{
"Vote for our server!"
};
public VoteNpc(int questId, String name, String descr)
{
super(questId, name, descr);
// Register Events
addEventId(VoteNpc_GLUDIO, Quest.QuestEventType.ON_SPAWN);
addEventId(VoteNpc_DION, Quest.QuestEventType.ON_SPAWN);
addEventId(VoteNpc_GIRAN, Quest.QuestEventType.ON_SPAWN);
addEventId(VoteNpc_OREN, Quest.QuestEventType.ON_SPAWN);
addEventId(VoteNpc_ADEN, Quest.QuestEventType.ON_SPAWN);
addEventId(VoteNpc_INNADRIL, Quest.QuestEventType.ON_SPAWN);
addEventId(VoteNpc_GODDARD, Quest.QuestEventType.ON_SPAWN);
addEventId(VoteNpc_RUNE, Quest.QuestEventType.ON_SPAWN);
addEventId(VoteNpc_SCHUTTGART, Quest.QuestEventType.ON_SPAWN);
scheduleBroadcast();
}
@Override
public String onSpawn(L2Npc npc)
{
if (!_npcs.contains(npc))
_npcs.add(npc);
return super.onSpawn(npc);
}
private void scheduleBroadcast()
{
Calendar cal = Calendar.getInstance();
int tfhTime = cal.get(Calendar.HOUR_OF_DAY);
long currTime = tfhTime*3600000 + cal.get(Calendar.MINUTE)*60000 +
cal.get(Calendar.SECOND)*1000 + cal.get(Calendar.MILLISECOND);
long nextTime = 0;
if ((tfhTime + 1) > 24) nextTime = 6900000;
else if (cal.get(Calendar.MINUTE) < 55) nextTime = tfhTime*3600000 + 3300000;
else nextTime = (tfhTime + 1)*3600000 + 3300000;
long initial = nextTime-currTime;
ThreadPoolManager.getInstance().
scheduleGeneralAtFixedRate(new BroadcastToZone(), initial, 3600000L);
}
public static void main(String[] args)
{
new VoteNpc(-1,"VoteNpc","ai");
}
class BroadcastToZone implements Runnable
{
@Override
public void run()
{
for (L2Npc npc : _npcs)
{
if (npc != null)
{
if (Config.DEBUG)
_log.info("Broadcasting VoteNpc Message to Zone");
int dg = Rnd.get(0, 2);
NpcSay ns = new NpcSay(npc.getObjectId(), Say2.SHOUT, npc.getNpcId(), dlog[dg]);
L2TownZone town = TownManager.getTown(npc.getX(), npc.getY(), npc.getZ());
{
if (town.getCharactersInside() != null && !town.getCharactersInside().isEmpty())
{
for (L2Character obj : town.getCharactersInside().values())
{
if (obj == null)
continue;
if (obj instanceof L2PcInstance)
obj.sendPacket(ns);
}
}
}
}
}
}
}
}
nub napisal program kiedy ty na gowno mowiles papu
:*
Maniac bez urazy ale żeś się przy* :oops: obudził z tym marudzeniem o "coded by matim"... ten npc tu od marca wisi a nagle Ci to teraz przeszkadza... równie dobrze możesz iść na plac zabaw i oskarżyć dzieci o plagiat bo bałwana zrobiły...