![]() |
Adding clientr variables via weapons
Hello, I was just wondering if maybe someone could help me, I seem to be having a lot of trouble adding a clientr variable to a player via the weapon he holds. Is there any way to accomplish this? So far I've tried clientr.[variablenamehere].add(0) but it thinks its an array so it automatically adds a comma after the number. I've also tried just clientr.[variablename] = 0 but it doesnt add the variable because it doesn't exist yet. Any help would be greatly appreciated :)
Note: Also tried clientr.[variablenamehere].add(0) and then using clientr.[variablenamehere] = 0 in the same script but it refuses to add it because clientr.[variablenamehere] = 0 seems to be faulty in some way. |
An example of the current script I'm referring to (weapon script)
Quote:
|
Hopefully you're doing this on serverside.
When you do player.clientr.whatever = null; it shouldn't appear in your players attributes unless the value is anything other than null. So if you were to add the following within any serverside function: player.clientr.whatever = "supercoolvar"; echo(player.clientr.whatever); I'd expect to see supercoolvar output on RC. The reason you're able to see an output for player.clientr.whatever.add(0); is because you're creating an array which adds another null value every time the function is called. Actually scrach that, are you trying to verify a tree has been cut down before you can chop it? |
Ah so question: If I add a clientr variable they wont always appear in a player's script flags under attributes?
Because I tried echo, it echo'd the value correctly but its not displayed under script flags. As of now I'm just trying to figure out how to get the clientr variables to work correctly so I can keep track of how many trees have been cut down. |
Quote:
Also make sure to use player.clientr.flag, not just clientr.flag |
Ah, now it shows up when I changed it to 1. So how would I set a clientr variable to the number 0 then? Or should I just get it to detect that there's none and have a default conditional to go to if that's the case?
As clarification I'm trying to get it to actively read the clientr variable so that the player can keep track of how many trees he's cut down. But when the clientr variable is set to 0, it can't effectively keep track of it. Are clientr variables 0 by default? Is 0 the equivelant of null? |
Quote:
|
But I'm trying to get this script to display the clientr value in a say2, but when it's set to 0, it's blank.
|
Quote:
PHP Code:
|
Okay with the collection of yougize's help I have in fact solved the problem. The problem wasnt that the value wasnt being assigned, it's that I was assigned the variable a null value so it just wasnt being displayed. I have now added an if conditional to detect if the treescut variable is 0 and if so perform accordingly. Thank you both for your assistance :)
|
| All times are GMT +2. The time now is 02:38 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.