Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   player.join() (https://forums.graalonline.com/forums/showthread.php?t=72304)

Rapidwolve 02-20-2007 06:14 AM

player.join()
 
On the Control-NPC under onActionPlayerOnline(), I added a line 'player.join("player");' In the class 'player' I made a public function we'll call it sayChat(message). In another player weapon I have player.sayChat("test"), but all I get is an error the F2 window saying function rapidwolve.sayChat() not found... blah blah...I searched forums on this and nothing worked. I know this can be done as I have seen it done before. Can anybody help?

napo_p2p 02-20-2007 06:28 AM

Since the error is outputting to your console, I'm assuming you are trying the player function clientside. In that case, the function must be declared as public in the class clientside as well.

Rapidwolve 02-20-2007 06:37 AM

It is public on both of them obviously. What sense would it make to have the serverside one public and the clientside one regular -_-

napo_p2p 02-20-2007 06:44 AM

Quote:

Originally Posted by Rapidwolve (Post 1279686)
It is public on both of them obviously. What sense would it make to have the serverside one public and the clientside one regular -_-

It kind of helps if you post your code too...

I was thinking more along the lines of you forgetting to add a copy of the function in the clientside portion of the class as well.

EDIT:
Ok, I played around with this. In some type of system NPC (onCreated), have the player join the class clientside too. Then it should work.

Chandler 02-20-2007 09:55 AM

You're aware that you can "say2" and "chat" serverside. It doesn't need to be clientside :o

cbk1994 02-21-2007 03:30 AM

Quote:

Originally Posted by Rapidwolve (Post 1279675)
On the Control-NPC under onActionPlayerOnline(), I added a line 'player.join("player");' In the class 'player' I made a public function we'll call it sayChat(message). In another player weapon I have player.sayChat("test"), but all I get is an error the F2 window saying function rapidwolve.sayChat() not found... blah blah...I searched forums on this and nothing worked. I know this can be done as I have seen it done before. Can anybody help?

There's no reason it shouldn't work. I have something like this in my Control-NPC ... player.join( "player-functions" );

I admit I've never done anything on it clientside, but I don't see why it shouldn't work. I'll post some examples for you to look at ...

in control NPC
PHP Code:

function onActionPlayerOnline()
{
  
player.join"player" );


in the class 'player'
PHP Code:

//#CLIENTSIDE
public function setChatsetchat )
{
  
player.chat setchat;


in some script
PHP Code:

//#CLIENTSIDE
function onCreated()
{
  
player.setChat"blah" );


[Edit: If this doesn't work, maybe you could try joining clientside in a system NPC?]

napo_p2p 02-21-2007 08:08 AM

Quote:

Originally Posted by Chandler (Post 1279728)
You're aware that you can "say2" and "chat" serverside. It doesn't need to be clientside :o

Obviously, but if you're writing some clientside code for a script, it is nice to be able to call clientside functions (instead of having to trigger).

Quote:

Originally Posted by cbkbud
If this doesn't work, maybe you could try joining clientside in a system NPC?

That should do it.


All times are GMT +2. The time now is 05:06 AM.

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