View Single Post
  #13  
Old 05-01-2009, 01:00 AM
Raelyn Raelyn is offline
the Professional.
Raelyn's Avatar
Join Date: Sep 2003
Location: Zormite
Posts: 964
Raelyn will become famous soon enough
Quote:
Originally Posted by cbk1994 View Post
clientr. can only be changed serverside, so you'll have to change your existing code. clientr. vars can be read clientside, though.

player.vars can be added serverside or clientside (and changed), but there are some disadvantages (and advantages).

For serverside, you can add a player.var. This is not synchronized with clientside. For example, "player.staffLevel = 4".

On clientside, you can use it for storing objects or something. However, they are cleared when the player logs off. You can do stuff like "player.equippedItem = this" for equipping standard weapons.


Just use it like

PHP Code:
putnpc2(xyscript);

// You can also do

putnpc2(3232"join block;");

// but that's GS1 and poor scripting
// instead, you can use GS2

putnpc2(3232"join(\"block\");");

// but that's a mess and hard to read
// which is why I prefer to do

temp.npc putnpc2(3232"");
npc.join("block");

// and it's also easier to set attributes this way, such as

npc.spawned true

Try this:

PHP Code:
function onKeyPressed(codekeychar) {
  if (
key == "p") {
    
temp.img findImg(200);
    
img.visible = ! img.visible;
  }

Awesome.

Another thing, I was under the impression that variable type is automatically detected, but it seems like setting a variable to a string of text doesn't work?

Trying to do something like this:

PHP Code:
clientr.weapon_img weaponname.png;

if (
trigger){
   
showimg index,clientr.weapon_img,,,;

Also, I tried using:

PHP Code:
function onKeyPressed(codekeychar) {
  if (
key == "p") {
    
temp.img findImg(200);
    
img.visible = ! img.visible;
  }

Not sure how to implement this, as a function, isn't it redundant to do this?:

PHP Code:
if (keypressed){
  
onKeyPressed(,p,);

Hrrm, am I doing this properly?


Doesn't this work?

PHP Code:
showimg 200,imagename.png,,,;
hideimg 200;

if (
keypressed) {
  if (
strequals(#p(1),p)) {
    
temp.img findImg(200);
    
img.visible = ! img.visible;
  }

__________________
*Don't let the door hit you on the way out.*

Last edited by Raelyn; 05-01-2009 at 01:29 AM.. Reason: Ohsnap, another edit.
Reply With Quote