Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   addWeapon (https://forums.graalonline.com/forums/showthread.php?t=82793)

Pelikano 11-16-2008 10:33 AM

addWeapon
 
Hello,
I am currently learning GS2 and I tried to script something to mute a Player's chat, but it isn't working and I have no idea why, could you help me please :D?

NPC Code:
function onActionServerSide() {
if (params[0] == "MutePlayer")
findPlayer(params[1]).addWeapon("Pelikano/MutePlayers2");
}

//#CLIENTSIDE
function onPlayerChats() {
if (player.chat.starts(":mute"))
this.accountname = player.chat.substring(6);
triggerserver("gui",this.name, "MutePlayer", this.accountname);
}


And then:
NPC Code:


function onActionServerSide() {
if (params[0] == "Mute")
params[1] = "";
}

//#CLIENTSIDE
function onPlayerChats() {
triggerserver("gui",this.name,"Mute",player.chat);
}


DustyPorViva 11-16-2008 10:45 AM

On the mute weapon, you don't need to do anything serverside... simply:
PHP Code:

//#CLIENTSIDE
function onPlayerChats() {
  
player.chat "";



Pelikano 11-16-2008 10:50 AM

Hm..
If I don't do anything serverside on the MuteWeapon isn't the chat of the Player muted for himself only o_O?

DustyPorViva 11-16-2008 11:22 AM

Quote:

Originally Posted by Pelikano (Post 1442619)
Hm..
If I don't do anything serverside on the MuteWeapon isn't the chat of the Player muted for himself only o_O?

Shouldn't be. The chat on the serverside is reflective of the chat on the clientside. Stop the chat on the clientside and it never makes it to the serverside.

Pelikano 11-16-2008 11:35 AM

Thanks :D

cbk1994 11-16-2008 08:47 PM

Better to do this:

PHP Code:

//#CLIENTSIDE
function ChatBar.onAction()
{
  
ChatBar.text "";


Then the text won't display at all, like it would if using PlayerChats.

Pelikano 11-16-2008 10:44 PM

Awesome.
Thank you

DustyPorViva 11-16-2008 10:47 PM

Quote:

Originally Posted by cbk1994 (Post 1442724)
Better to do this:

PHP Code:

//#CLIENTSIDE
function ChatBar.onAction()
{
  
ChatBar.text "";


Then the text won't display at all, like it would if using PlayerChats.

Ya, I was going to post that, but it would also stop commands like sethead, setbody... so on and so forth.

Cloven 11-16-2008 10:49 PM

Quote:

Originally Posted by DustyPorViva (Post 1442782)
Ya, I was going to post that, but it would also stop commands like sethead, setbody... so on and so forth.

Though of course that can easily be remedied as well. :D

DustyPorViva 11-16-2008 10:49 PM

Quote:

Originally Posted by Cloven (Post 1442784)
Though of course that can easily be remedied as well. :D

Sure, by adding checks for all commands... but at what benefit?

Pelikano 11-16-2008 10:54 PM

Quote:

Originally Posted by DustyPorViva (Post 1442782)
Ya, I was going to post that, but it would also stop commands like sethead, setbody... so on and so forth.

That's exactly what I wanted to happen in the first place :P

DustyPorViva 11-17-2008 12:30 AM

Quote:

Originally Posted by Pelikano (Post 1442787)
That's exactly what I wanted to happen in the first place :P

Then you should have mentioned that :P


All times are GMT +2. The time now is 01:32 PM.

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