Quote:
Originally Posted by Jiroxys7
I believe im fairly familiar with using the serverside <=> clientside stuff. didnt know the difference between temp.var and this.var though =3
so if i want to create an important clientr.var, i should do something like this?:
example:
<snip>
clientr.num should equal 3.
now, I'm wondering though, are people able to hack and edit this.num1 and this.num2 to change the outcome of clientr.num? or is it just harder to hack compared to client.vars?
|
The
values of this.num1 and this.num2 are being passed as parameters, not the actual variables themselves. It would look like this:
PHP Code:
function onActionServerSide(cmd, p1, p2) { // you can call these whatever you want
if (temp.cmd == "calc_math") {
// p1 and p2 hold the values 1 and 2
doMakeMathVar_S(temp.p1, temp.p2);
}
}
function doMakeMathVar_S(num1, num2){ // again, call these parameters whatever you want
clientr.num = temp.num1 + temp.num2; // parameters are temp.vars -- only accessible within the function block
}
//#CLIENTSIDE
function doMakeMathVar_C() {
// There's really no reason to use this.vars here because you
// only need them within this function block
// for sake of learning, I'll leave it as you had it
this.num1 = 1;
this.num2 = 2;
triggerServer("weapon", this.name, "calc_math", this.num1, this.num2);
}