Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Change player var with player chat (https://forums.graalonline.com/forums/showthread.php?t=134262064)

Trakan 02-12-2011 12:06 AM

Change player var with player chat
 
Ok i make a Humor script (viewable at profile rights click).

Here is my script :
PHP Code:

// Scripted by *Trakan (Admin)
//#CLIENTSIDE
function onWeaponFired() {
say2("For change humor say #b /humor <your humor>");
}

function 
onPlayerChats(){ 
if(
player.chat.starts("/humor")){
[
U]triggerserver("gui", name, "tagOn", clientr.humor);[/U]
player.chat = "Humor changed !";
 } 
} 

My problem is :
i need to set se variable clientr.humor with the player.chat

exemple :
the player say /humor test
The variable changed to test.

Thanks for future help.

cbk1994 02-12-2011 12:12 AM

There's no reason to use a clientr variable here since it looks like you're not doing any validating:

PHP Code:

//#CLIENTSIDE 
function onWeaponFired() { 
say2("For change humor say #b /humor <your humor>"); 
} 

function 
onPlayerChats(){  
  if (
player.chat.starts("/humor ")){ 
    
player.client.humor = player.chat.substring(7);
    
player.chat = "Humor changed!"; 
  }
} 


Trakan 02-12-2011 08:08 AM

Thanks but what the difference between client. & clientr. ?

fowlplay4 02-12-2011 08:30 AM

Quote:

Originally Posted by Trakan (Post 1630331)
Thanks but what the difference between client. & clientr. ?

clientr - read-only to the client-side, you can change the value temporarily on the client-side but it won't be reflected on the serverside.

client - read and writable on the client-side and changes made will be reflected on the serverside as well.

Trakan 02-12-2011 08:44 AM

Thanks


All times are GMT +2. The time now is 01:15 AM.

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