Quote:
Originally Posted by Raelyn
Ok, I used clientr. not sure why, but that's what I saw everyone else using so I thought it appropriate to follow suit, what is the difference between clientr. and player. ?
|
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.
Quote:
|
I will have to lookup putnpc2 since I have never used it.
|
Just use it like
PHP Code:
putnpc2(x, y, script);
// You can also do
putnpc2(32, 32, "join block;");
// but that's GS1 and poor scripting
// instead, you can use GS2
putnpc2(32, 32, "join(\"block\");");
// but that's a mess and hard to read
// which is why I prefer to do
temp.npc = putnpc2(32, 32, "");
npc.join("block");
// and it's also easier to set attributes this way, such as
npc.spawned = true;
Quote:
Also, if I wanted to do something like a toggle, say:
PHP Code:
if (keypressed){
if (strequals()){
if (showimgIsAlreadyShown){
hideimg;
} else {
showimg;
}
}
}
How would I detect if said image is shown already?
|
Try this:
PHP Code:
function onKeyPressed(code, key, char) {
if (key == "p") {
temp.img = findImg(200);
img.visible = ! img.visible;
}
}