Quote:
Originally Posted by cbk1994
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(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;
Try this:
PHP Code:
function onKeyPressed(code, key, char) { 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(code, key, char) {
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;
}
}