Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Adding weapons (https://forums.graalonline.com/forums/showthread.php?t=60340)

alissalee 08-03-2005 09:13 PM

Adding weapons
 
How would i add a weapon though npc sever? i have no clue i forget i think is it addweapon weapon name or something like that

Bl0nkt 08-03-2005 09:27 PM

Quote:

Originally Posted by alissalee
How would i add a weapon though npc sever? i have no clue i forget i think is it addweapon weapon name or something like that

What do you mean?

Creating a weapon in NC or adding a weapon to a player?

alissalee 08-03-2005 09:28 PM

adding a weapon to player by using the npc sever message

URBANLEGEND 08-03-2005 09:40 PM

adweapon weaponname;

Velox Cruentus 08-09-2005 10:03 PM

You might want to make a player class, and put this in. (GS2 Required.)

PHP Code:

// player.addWeapons({weap1,weap2,weap3,and so on});
public function addWeapons(weaps)
{
  for (
weapweaps)
  {
    
this.addweapon(weap);
  }



Python523 08-10-2005 07:55 AM

Quote:

Originally Posted by Velox Cruentus
You might want to make a player class, and put this in. (GS2 Required.)

PHP Code:

// player.addWeapons({weap1,weap2,weap3,and so on});
public function addWeapons(weaps)
{
  for (
weapweaps)
  {
    
this.addweapon(weap);
  }



Don't confuse the poor kid.

alissalee 08-16-2005 12:57 AM

can i add a weapon to the player though a lvl npc like buying items how would i do that the same way?

Matt 08-16-2005 01:50 AM

Quote:

Originally Posted by alissalee
can i add a weapon to the player though a lvl npc like buying items how would i do that the same way?

Add the script to WEAPONS through NPC Control. Then open a level and put a script such as this in it:

//#CLIENTSIDE
if (playertouchsme){addweapon weaponnamehere';}

You'll have to get to known the scripting commands better if you want it to go to your attributes when you say something like 'buy 'weaponname'. Also i don't think it's a good idea to use Clientside anyways.

If you want an NPC to be added to everyones attributes once they logon put this in Control-NPC:

if (actionplayeronline){addweapon 'weaponnamehere';}

calani 08-16-2005 02:15 AM

addweapon does not work clientside.

NPC Code:

// npc called "-weaponadder"

if (actionserverside) {
if (strequals(#p(0),addw)) {
with(getplayer(#p(1))) addweapon #p(2);
}
}

//#CLIENTSIDE
if (weaponfired) {
triggeraction 0,0,serverside,-weaponadder,addw,#a,NPC/Thinger;
}



that npc, when fired, adds the weapon NPC/Thinger to the player.


a level npc (shop or suchlike) could also use that trigger, granted the player has a weapon on them like that one that accepts the addw trigger

Lance 08-16-2005 02:51 AM

Quote:

Originally Posted by Matt
Add the script to WEAPONS through NPC Control. Then open a level and put a script such as this in it:

//#CLIENTSIDE
if (playertouchsme){addweapon weaponnamehere';}

You'll have to get to known the scripting commands better if you want it to go to your attributes when you say something like 'buy 'weaponname'. Also i don't think it's a good idea to use Clientside anyways.

If you want an NPC to be added to everyones attributes once they logon put this in Control-NPC:

if (actionplayeronline){addweapon 'weaponnamehere';}

addweapon does not work clientside. Please do not give bad advice.

Lance 08-16-2005 02:51 AM

Quote:

Originally Posted by calani
addweapon does not work clientside.

NPC Code:

// npc called "-weaponadder"

if (actionserverside) {
if (strequals(#p(0),addw)) {
with(getplayer(#p(1))) addweapon #p(2);
}
}

//#CLIENTSIDE
if (weaponfired) {
triggeraction 0,0,serverside,-weaponadder,addw,#a,NPC/Thinger;
}



that npc, when fired, adds the weapon NPC/Thinger to the player.


a level npc (shop or suchlike) could also use that trigger, granted the player has a weapon on them like that one that accepts the addw trigger

If people were meant to be able to be able to add any weapon clientside, it would not be a serverside command. Please do not encourage the circumvention of this security measure.

calani 08-16-2005 03:05 AM

Quote:

Originally Posted by Lance
If people were meant to be able to be able to add any weapon clientside, it would not be a serverside command. Please do not encourage the circumvention of this security measure.

How else do you propose you make a shop that adds weapons, or a droppable inventory system?
A DB? That would confuse the poor person.
And besides, the only people that would know how to use the trigger would be staff. Players uploading a playerhouse with a script to add weapons wouldn't know how, plus, any player levels should be inspected and approved before uploading in the first place.
Nearly every server has a system npc with an addweapon function on it, so don't even go there.

Lance 08-16-2005 03:54 AM

Quote:

Originally Posted by calani
How else do you propose you make a shop that adds weapons, or a droppable inventory system?

Through a nifty serverside level NPC or DB NPC? Also: any decent inventory system would make sure the person should have something before adding it.

Quote:

A DB? That would confuse the poor person.
Moreso than a triggeraction? Take a moment and think about that.

Quote:

And besides, the only people that would know how to use the trigger would be staff.
Or clever trainer users. We don't need what happens on UN to happen on any other server.

Quote:

Players uploading a playerhouse with a script to add weapons wouldn't know how, plus, any player levels should be inspected and approved before uploading in the first place.
Irrelevant. We're talking about the security of a weapon NPC. One would not need to have any other scripts uploaded to exploit the security flaw in that weapon.

Quote:

Nearly every server has a system npc with an addweapon function on it, so don't even go there.
And nearly every server had an insecure Control-NPC triggeraction 'actionserverwarp' before we swept the servers and insisted they remove it. A lot of people doing a bad practice does not change the fact that it's a bad practice and insecure.

ChibiChibiLuc 08-16-2005 04:00 AM

Calani got own't!

The person you're talking to, however, most likely lacks the intelligence to understand the difference between 'secure' and 'insecure' triggeractions.

And every single server has insecure triggeractions like this, which are actively abused to do things such as reseting people, but the PWA could really care less about their existance.

Matt 08-16-2005 05:01 AM

Quote:

Originally Posted by Lance
addweapon does not work clientside. Please do not give bad advice.

If i knew it was 'bad' i would'nt have given it. As i stated before, i'm not great when it comes to scripting. My mistake though, i guess.


All times are GMT +2. The time now is 10:00 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.