Re: nVault Tutorial
Quote:
ok, so why not like that: PHP Code:
??? |
Re: nVault Tutorial
You can do that, but MAX_PLAYERS is 32 so its not technically proper to set it to 33 directly.
|
Re: nVault Tutorial
Quote:
|
Re: nVault Tutorial
The maximum number of players that is supported is 32, hence MAX_PLAYERS = 32 is used.
The + 1 is done strictly for sizing an array. Like I said, you could set it directly to 33 but it is not technically proper. You could have other parts of code that need to loop from 1 to max players, in this case if you defined it at 33 you would then need to loop from 1 to MAX_PLAYERS - 1. I think we are getting off track here, if you want to continue a general scripting discussion please create a thread in scripting help. |
Re: nVault Tutorial
Quote:
It was my intention to do it that way. i just didn't test it properly. I do understand that converting it back is no use and in that case it's much better storing the string in the global array. I would however remove "STEAM_" from it. I'm not saying everyone has to do so. I used this code and figured it worked but of course the key is interpret in the same way even if it's not supported in that format and the data will be retrieved correctly. Code:
Code:
key: 2147483647, val: 127 |
Re: nVault Tutorial
With your code, Black Rose, it will appear to work correctly to users while in reality it is not.
It is storing the data in nVault with a single character as the key because it is using the right-most byte in the cell as the ascii character since it is expecting a string (which is normal for how Pawn stores/interprets strings). PHP Code:
Code:
nvault_get : [2298457] [Y] char 'Y' ascii val = 89 In binary: 2298457 = 0000 0000 0010 0011 0001 0010 0101 1001 0000089 = 0000 0000 0000 0000 0000 0000 0101 1001 So when passing a cell holding 2298457, Pawn is taking the right-most byte value of 89 and say's oh ok, this means character 'Y' is the key. https://dl.dropboxusercontent.com/u/...AMXX/Vault.PNG I know you already acknowledged this issue, but for anyone that may have tried your code and saw it working, I wanted to explain it more because it should not be used. Even with SQL, wouldn't you still need to convert it to a string in your SQL query? I think this would be useful in some type of hash lookup table where it takes an integer value as the input. |
Re: nVault Tutorial
Code:
create table if not exists inventory (SteamID int); I did try to confirm my code in the beginning by using the nVault editor but it wouldn't start on my system. More info on that in the nVault editor thread. |
Re: nVault Tutorial
Quote:
Quote:
|
Re: nVault Tutorial
Quote:
In this nVault situation it's better with the string. |
Re: nVault Tutorial
Quote:
"SELECT * FROM tblWhatever WHERE SteamID=123123" |
All times are GMT -4. The time now is 04:45. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.