elitepvpers

elitepvpers (https://www.elitepvpers.com/forum/)
-   CO2 PServer Guides & Releases (https://www.elitepvpers.com/forum/co2-pserver-guides-releases/)
-   -   [Release] Activate/Un-Activate NPC by Command. (https://www.elitepvpers.com/forum/co2-pserver-guides-releases/191907-release-activate-un-activate-npc-command.html)

_Emme_ 12/09/2008 21:17

[Release] Activate/Un-Activate NPC by Command.
 
So ive seen alot of you wanted this, well here it is, coded this in about 4minutes total and never tested it,so you will probably be the first one.

So, all you actually do is to make the server check if xxx is activated, if it is, it shows the real npc chat, if it isnt, it tells you that it isnt. And you activate/unactivate the xxx with a command. Well here you are:



In General.cs , under : public static System.Timers.Timer Thetimer;

Code:

public static bool CanTalkToNPC = false;

Search for : if (Splitter[0] == "/ServerRestart")

Above that , add:


Code:

if (Splitter[0] == "/startnpc")
                                        {
                                            string K = "";
                                            if (General.CanTalkToNPC)
                                            {
                                            K = "un-activated!";
                                          General.CanTalkToNPC = false;
                                            }
                                            if (!General.CanTalkToNPC)
                                            {
                                            K = "activated!";
                                            General.CanTalkToNPC = true;
                                            }
                                            World.SendMsgToAll("The xxxx NPC has been " + K, "NPCHandeler", 2005);
                                        }

This is how the command works:
If you type /startnpc , it will check if the npc is activated. If the npc(s) is activated, they will be un activated, and vice versa. Also it announce the status of the npc.





And this is an example of how to NPC code work:

Search for : if (CurrentNPC == 12)

Until you get to the NPC TALK


Above, add this:



Code:

if (CurrentNPC == 1339)
                            {
                                if (!General.CanTalkToNPC)
                                {
                                    SendPacket(General.MyPackets.NPCSay("This NPC is not started yet. Please wait for an announcment!"));
                                    SendPacket(General.MyPackets.NPCLink("Okay.", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                                else
                                {
                                    SendPacket(General.MyPackets.NPCSay("Hello there! Want me to teleport you to xxxx?"));
                                    SendPacket(General.MyPackets.NPCLink("Sure", 1));
                                    SendPacket(General.MyPackets.NPCLink("Just passing by..", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                            }

Now that is an example how it could look like.



Hope it gave you any ideas or/and knowledge. Atleast I hope I helped someone.


Emme

Incariuz 12/10/2008 02:02

Hmmm... I never thought of doing something like this. Probably won't test this itself, but it gives me an idea. Setting NPC's to some sort of timer, in which at certain times they'll appear for quests or what not, and the rest of the time, have their location switched to an unreachable map.

!DeX! 12/10/2008 08:55

Thanks emme So Much

damianpesta 12/10/2008 09:14

Quote:

Originally Posted by E*PvPers (Post 1681526)
Thanks emme So Much

Im still Waiting to get hacked Mr.(Hacker) lol And Still i didnt Get it ... hmm lets see ,maybe your just full of shit?

!DeX! 12/10/2008 09:18

Quote:

Originally Posted by damianpesta (Post 1681544)
Im still Waiting to get hacked Mr.(Hacker) lol And Still i didnt Get it ... hmm lets see ,maybe your just full of shit?

wanne try Give me ur IP and tell Bye bye to ur PC

_Emme_ 12/10/2008 09:58

Press thanks if you liked this, e.x used it, got ideas, or just like it.

And for the timer, thats very easy. Add a timer in the SingleNPC class as I call it, of lets say 10 minutes. Now, start the NPC + the timer by using a command, like this:

if (Splitter[0] == "/start")
{
SingleNPC G = new SingleNPC(INFO HERE, ALSO THE TIMER HERE);
Spawn G;
}

Now a timer is started, on what time you defined it to in the code above. Now you can do like this for the timer:


if (Timer_Elapsed)
{
foreach (DictionaryEntry DE in NPCs.AllNPCs)
{
SingleNPC Npc = (SingleNPC)DE.Value;

if (Npc.UID == NPCUIDHERE)
Npc.X == 999;
Npc.Y == 999;
Npc.Map == 999;
}
}



Well something like that, I never actually did this and it was directly coded in e*pvp

~jochemke~ 12/10/2008 14:56

Emme i love u so much
that was much easier then i thought
i thought it was so difficult xD

_Emme_ 12/10/2008 15:06

press thanks then..

~jochemke~ 12/10/2008 15:07

rofl forgot to do that
tnx for remembering
keep up the good work

ps: u gonna release more these days?

_Emme_ 12/10/2008 15:34

Sure,just gimme ideas.

~jochemke~ 12/10/2008 15:40

well about the treasure hunt when the box drops something u can't pick it up
how to fix that?

_Emme_ 12/10/2008 19:06

You cant pick it up? Wierd, well lets see if someone else got that error. Besides, post in the thread for that subject.

damianpesta 12/10/2008 19:14

Quote:

Originally Posted by E*PvPers (Post 1681549)
wanne try Give me ur IP and tell Bye bye to ur PC

What Kind of Hacker Needs IP to Pwn Someones Comp? I lol'd now ... seriously get a life rather than talking shit just like 10 year old kid

~jochemke~ 12/10/2008 22:17

Quote:

Originally Posted by EmmeTheCoder (Post 1682670)
You cant pick it up? Wierd, well lets see if someone else got that error. Besides, post in the thread for that subject.

kk posted in treasure hunt topic

tao4229 12/10/2008 22:30

You can't do shit with only an IP.
The only way you can even connect to the host is through an open port, or a bridging program. If they're blocking their router, you have no access.
Even then, you can't connect unless a program is running on the port, which means you'd have to install it some way.

© Haydz 12/10/2008 22:49

What they can do is scan for open ports on an ip address. Match the programs that commonly use that port, then use a specific site begging with 'm' and ending in 'm' to check for vulnerabilities/exploits within that program, and go from there :P

tao4229 12/10/2008 22:51

Quote:

Originally Posted by © Haydz (Post 1683086)
What they can do is scan for open ports on an ip address. Match the programs that commonly use that port, then use a specific site begging with 'm' and ending in 'm' to check for vulnerabilities/exploits within that program, and go from there :P

No open ports or server programs running ftw?:confused:

Kiyono 12/10/2008 23:04

Quote:

Originally Posted by © Haydz (Post 1683086)
What they can do is scan for open ports on an ip address. Match the programs that commonly use that port, then use a specific site begging with 'm' and ending in 'm' to check for vulnerabilities/exploits within that program, and go from there :P

Is the 2nd letter a "I" ?

© Haydz 12/10/2008 23:23

Maybe

InfamousNoone 12/10/2008 23:53

Quote:

Originally Posted by © Haydz (Post 1683138)
Maybe

You lie, it starts with "http://" :)

tao4229 12/11/2008 00:10

Quote:

Originally Posted by InfamousNoone (Post 1683182)
You lie, it starts with "http://" :)

And ends with '\0'


All times are GMT +2. The time now is 15:15.

Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.