1. Every second the timer is supposed to execute, it only executes once on lapper start.
2. $mList - It reports as 0 entries even though I'm online.
3. Even if I remove every line except the first one ( to report the time ) it only runs once.
#. Error logs say nothing
Has anyone encountered this problem before? it works for me for scheduled actions of 1 minute tho...
Hey, sorry for the late reply I just got back to this post. I'm using global Set/GetStoredValue( "UserName_Cash_" . $userName ) as a 'reserve' so when player's connect it goes into their wallet. On the plus side I can also use it to store mail for when they come online.
Nevertheless thank you very much for the script, I will be sure to use it when I need to change UserStoredValue(s) again, and I'm sure it'll be very helpful for other users to implement into their server, as it has done wonders for mine.
I know I can't always depend on global stored values as the table has to make a new row every time I name a new variable. I'm planning on scripting player contracts, memberships and insurance soon and I can't imagine how many more variables I have to name.
## This part of the code is within a FOR loop, algorithm works, SetUserStoredValue doesn't. ## $IDUser = GetStoredValue( "UserName_Number_" . $i ) ## from FOR loop ## writeline( "attempting to give user " . $IDUser . " cash from " . GetUserStoredValue( $IDUser, "Cash" ) ); SetUserStoredValue( $IDUser , "Cash", Round(ToNum( GetUserStoredValue( $IDUser, "Cash" ) + $Dividend ),2) ); writeline( "attempted to give user " . $IDUser . " cash to " . GetUserStoredValue( $IDUser, "Cash" ) );
SetUserStoredValue cannot be used on an offline user...If you can GET why shouldn't you be able to SET? For the record GetUserStoredValue works...
I've tried it with other stored values other than "Cash" too, but it just can't Set stored values for any offline users.
Does this mean I have to resort to using SetStoredValue( "UserName_Cash_" . $IDUser ) instead?
Sorry I forgot to mention it, but it actually starts with:
[b]CatchEvent OnConnect ( $userName )[/b] ....does some stuff.... IF ( GetStoredValue( "REGISTER_COUNTER" ) == "" ) ... # see my previous post for whole section of relevant code # .... ENDFOR ... some other stuff ... EndCatchEvent
I haven't altered anything except added those lines of code (see previous reply) to my Event OnConnect. I think those pieces of code are enough, it's just that the algorithm seems to be wrong and I'm having trouble applying the right algorithm (just can't wrap my head around it ) so it only registers unique usernames. As far as error logs go it doesn't say anything's wrong (from the ERR.log file in bin/default/logs).
Also $userName is already declared in the beginning, and should not be the problem as it returns my username when registered (it basically registers me as a new user every reload )
Regarding starting with 2:
I had trouble with it starting at $i = 0 so I just moved up 1. The problem isn't where it starts but how it executes. I think the main problem might be the parameters, or the order of the IF statements...
I also manually set the stored-values "REGISTER_COUNTER" and "UserName_Number_" . $i
if I find duplicates after connecting/reloading.
CONTEXT: (If it helps...)
I need a script that runs at 5pm, everyday, that distributes the player's dividend (gives them some money from the total profit) relative to their shareholding from the companies they have partial ownership of, even when they're offline. This is where listing all usernames from storedvalue.dbs comes in: (All in a WHILE Loop with $i = 1 and $register_counter = "REGISTER_COUNTER")
IF ( GetStoredValue( "UserName_Number_" . $i ) != "" ) THEN IF ( GetPlayerVar( GetStoredValue( "UserName_Number_" . $i ), "NickName" ) == "" ) # Offline THEN # distribute dividend by set/getuserstoredvalue. # ELSE IF ( GetPlayerVar( GetStoredValue( "UserName_Number_" . $i ), "NickName" ) != "" ) # Online THEN # distribute dividend normally by set/getplayervar. # ENDIF ENDIF ENDIF
If they're offline, I can send them a mail by a:
IF ( GetUserStoredValue("HAVEMAIL") == 1 ) THEN PrivMsg GetStoredValue("MAIL_" . $userName)
if they do receive dividends while offline. These investors have every right to know how much dividend they receive at 5pm, even if they come online at 6pm.
Problem 2: This is the code so far, but it keeps registering the same user (me) every !reload. The "REGISTER_COUNTER" also increases by 1 as a consequence too. And yes, some of it is from your reg_system.txt.
IF ( GetStoredValue( "REGISTER_COUNTER" ) == "" ) THEN SetStoredValue( "REGISTER_COUNTER" , ToNum("2") ); ENDIF $register_counter = ToNum( GetStoredValue( "REGISTER_COUNTER" ) ); IF ($register_counter == "") THEN $register_counter=2; ENDIF
FOR ( $i = 1; $i < $register_counter; $i = $i + 1 ) ### Set $i as 1 unit under $register_counter. ### IF ( ToString(GetStoredValue( "UserName_Number_" . $i )) == ToString(GetPlayerVar( $userName , "UserName" )) ) THEN GlobalMsg( "User already registered on system" ); GlobalMsg( "^7User ID: ^6" . $i ); writeline( "User already registered on system" ); $i = $i + $register_counter; ELSE IF (( GetStoredValue( "UserName_Number_" . $i ) != "" ) && ( GetStoredValue( "UserName_Number_" . $i ) != "0" )) THEN GlobalMsg( "^7Stored User/ID " . GetStoredValue( "UserName_Number_" . $i ) . "/" . $i . "." ); ELSE IF ( ( GetStoredValue( "UserName_Number_" . $i ) == "" ) || ( GetStoredValue( "UserName_Number_" . $i ) == "0" ) ) THEN SetStoredValue( "UserName_Number_" . ToString( $register_counter ) , $userName ); SetStoredValue( "REGISTER_COUNTER" , ToNum( GetStoredValue( "REGISTER_COUNTER" ) + 1 ) ); GlobalMsg( "^7New User (^6" . $userName . "^7) has been registered." ); GlobalMsg( "^7New User ID: ^6" . ToNum( $register_counter ) ); writeline( "^7New User (^6" . $userName . "^7) has been registered." ); ENDIF ENDIF ENDIF ENDFOR
As the title says, Problem:
I need to distribute a large sum of money (which occurs on a regular interval) for all players (users) in my server whether they are online or offline. One of the problems is that all the users' and server data are stored in storedvalue.dbs (located in "./bin/default/Databases" ).
GetListOfPlayers() - only returns list of all players online ... GetListOfUsersGroup - doesn't work for storedvalue.dbs ...
Is there a way to retrieve all usernames of players in storedvalue.dbs so I can #do something# with their stored data?
e.g.: (This is what I'm trying to do)
Sub < this sub > $mList = [b]< Get List of All Players' "UserNames" from storedvalue.dbs >[/b] ; FOREACH ( $maVar IN $mList ) IF ( <they are online, their nickname != "" > ) THEN # Distribute moneys # SetPlayerVar( $maVar["value"] , "<var>" , <change> ); ELSE # Rest aren't online, so distribute moneys to remaining (offline) players too # SetUserStoredValue( $maVar["value"] , "<var>" , <change> ); ENDIF ENDFOREACH EndSub
Note: No, I am not asking for a full script lol, I just need a function that can draw all usernames from the current storedvalue.dbs database.
I can confirm that I get the same error with GetPlayerVarByUcid. I removed it, and it returns the $Days value. The second problem is that it needs to execute a command that bans a specific user, which is where the Ucid of the player comes in...
The private button doesn't close even with closebuttonregex. It has infinite duration...
Nothing happens after I enter text.
P.S. I read your ban script but the problem is I can't create new files in the directory (LFS hosting). This means I can't retrieve offline banned players... so I have to do it under the original ban system. The openprivtextbutton should allow user input for # days for execute by cmdLFS.
I can't seem to find the answer to this anywhere so...
I'm making a hotlap server, but has some rpg elements to it for people who are spectating/parking/fooling around in car park.
So I'm trying to write a script that pitlanes on wrong way at a certain point (see image for wrong way direction). At the moment, I can RegisterNodeAction and can execute a "pitlane" command, the problem is, I cannot specify a direction...
1. For LFSLazy dashboards, (specifically on XRG) would it be possible to have oil and engine temp needles next to the dials?
When I try move them they only show either between the dials, or above the shifter (middle of car - XRG).
2. If it is not possible to fix (1.), would it be possible to add linear oil and engine temp gauges? (so they can be used as OilLin and TempLin, displayed where the dials typically are in XRG).
Screenshots of the WIP (with permission from Vano Paniashvili):
a.) as you can see the oil and engine temp gauges underneath the RPM dial doesn't have the respective needles. I'm trying to either add needles to both of them, or make them lin-gauges.
b.) I don't want to have to edit the .dds files as well, as its nice to keep the whole mod within one gauges folder.