Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-16-2008, 10:33 AM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
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 ?

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);
}

Reply With Quote
  #2  
Old 11-16-2008, 10:45 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
On the mute weapon, you don't need to do anything serverside... simply:
PHP Code:
//#CLIENTSIDE
function onPlayerChats() {
  
player.chat "";

Reply With Quote
  #3  
Old 11-16-2008, 10:50 AM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
Hm..
If I don't do anything serverside on the MuteWeapon isn't the chat of the Player muted for himself only o_O?
Reply With Quote
  #4  
Old 11-16-2008, 11:22 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally Posted by Pelikano View Post
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.
Reply With Quote
  #5  
Old 11-16-2008, 11:35 AM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
Thanks
Reply With Quote
  #6  
Old 11-16-2008, 08:47 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
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.
__________________
Reply With Quote
  #7  
Old 11-16-2008, 10:44 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
Awesome.
Thank you
Reply With Quote
  #8  
Old 11-16-2008, 10:47 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally Posted by cbk1994 View Post
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.
Reply With Quote
  #9  
Old 11-16-2008, 10:49 PM
Cloven Cloven is offline
Delteria
Cloven's Avatar
Join Date: Dec 2006
Location: Florida, United States
Posts: 542
Cloven has a spectacular aura about
Send a message via AIM to Cloven
Quote:
Originally Posted by DustyPorViva View Post
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.
Reply With Quote
  #10  
Old 11-16-2008, 10:49 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally Posted by Cloven View Post
Though of course that can easily be remedied as well.
Sure, by adding checks for all commands... but at what benefit?
Reply With Quote
  #11  
Old 11-16-2008, 10:54 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
Quote:
Originally Posted by DustyPorViva View Post
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
Reply With Quote
  #12  
Old 11-17-2008, 12:30 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally Posted by Pelikano View Post
That's exactly what I wanted to happen in the first place :P
Then you should have mentioned that :P
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:05 PM.


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