Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Players on RC HELP! (https://forums.graalonline.com/forums/showthread.php?t=134263041)

Emera 04-29-2011 05:38 PM

Rc chat system. HELP!
 
Hi i am trying to make a script where normal players can chat on RC by starting there message with //

PHP Code:

//#CLIENTSIDE 

function onPlayerChats() {
    if (
player.chat.starts("//")) {
        
SendToRc(temp.player.chat);
    }
} 

i think its the temp.player.chat bit but can somebody help please?

thanks in advance!

scriptless 04-29-2011 07:29 PM

I thought SendToRc was serverside? Also have you tried player.chat instead of temp.player.chat? And It's been years since I used starts(""); .. have you tries "// test" AND "//test" ?

Emera 04-29-2011 07:31 PM

I have used player.chat and i get "unknown command" on RC so i know im doing something. Also, how do i issue sendToRC serverside then?

Emera 04-29-2011 07:33 PM

Ah there its fixed thanks guys.

scriptless 04-29-2011 07:35 PM

I am just asumming you removed the "//#CLIENTSIDE" ? or did you impliment

PHP Code:

triggerServer( "gui", this.name, "action" ); 


Emera 04-29-2011 07:51 PM

Ok know how can i get other RC's to see the chat. I can only see mine and not other players. And yes, they all have the weapon.

Emera 04-29-2011 07:52 PM

Im new to scripting and i dont quite know what you man by the trigger action.

scriptless 04-29-2011 07:56 PM

To my knowledge all rc's should be seeing the chat.. if you mean all players seeing the rc chat? or all players that do not have an rc seeing the chat you are sending to rc?

Emera 04-29-2011 07:57 PM

The staff on rc. I let a player use the weapon and i couldnt see his chat on RC. I used it and i could see mine.

scriptless 04-29-2011 08:00 PM

Hmm.. I would have to login to testbed and play around with it myself then.

Emera 04-29-2011 08:01 PM

Sure go ahead.

Tigairius 04-29-2011 08:08 PM

Quote:

Originally Posted by Emera (Post 1646395)
Hi i am trying to make a script where normal players can chat on RC by starting there message with //

PHP Code:

//#CLIENTSIDE 

function onPlayerChats() {
    if (
player.chat.starts("//")) {
        
SendToRc(temp.player.chat);
    }
} 

i think its the temp.player.chat bit but can somebody help please?

thanks in advance!

I know you said you fixed it, but just for future reference, you can fix this by removing the "temp." prefix to inside of "sendtorc" and also by changing it to: player.chat.substring(2).

Quote:

Originally Posted by Emera (Post 1646423)
Ok know how can i get other RC's to see the chat. I can only see mine and not other players. And yes, they all have the weapon.

You have to be logged into client-rc for your chat to display to other RCs in the RC chat. If you are logged into client-rc it should work fine.

scriptless 04-29-2011 08:10 PM

Having issues connecting to graal right now.. Either its taking forever or my connection isnt working properly.

However, you might want to take into consideration that doing a script like this risks flooding the rc. Players would be able to make RC useless for staff by spamming it non-stop.

Alternatively, to fix the non-displayed message problem. You could give the weapon to all the players and use something similar to this.


This would tell all players to trigger the action to send message to rc, this would be under "//#CLIENTSIDE"
PHP Code:

for ( temp.p : allplayers ) {
  
with (temp.p) {
    
triggerServer( "gui", this.name, "sendtorc", message );
  }
} 

This would be above "//#CLIENTSIDE", it would receive the trigger.
PHP Code:

function ActionServerSide() {
  if ( 
params[0] == "senttorc" ) {
    
SendToRc(params[1]);
  }
} 

You might need to play around with this but that is what I would probably do.

When sending an action to the server param[#] refers to each param after "this.name" in the command.

Make sure that the actionserverside is ABOVE any part of the script that is //#CLIENTSIDE.. and the first code I mentioned..


EDIT:
Damn Tig, you beat me to the substring part.. To explain why Tig posted that tho, substring(#) means to take everything from the second character all the wat to the end.. This would eliminate "//" at the beginning of the message.

Emera 04-29-2011 08:14 PM

Ah thanks tig and thanks scriptless. I got it workin mighty fine now. :D


All times are GMT +2. The time now is 10:57 PM.

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