Using cache_get_row_float and other questions
#3

Quote:
Originally Posted by Parallax
Посмотреть сообщение
1.
Код:
    cache_get_row(0, 0, strr); pData[playerid][ID] = strval(strr);
    cache_get_row(0, 4, strr); pData[playerid][Level] = strval(strr);
    cache_get_row(0, 5, strr); pData[playerid][Colour] = strval(strr);
    cache_get_row(0, 6, strr); pData[playerid][RegTime] = strval(strr);
    cache_get_row(0, 7, strr); pData[playerid][OnlineTime] = strval(strr);
    cache_get_row(0, 8, strr); pData[playerid][Score] = strval(strr);
    cache_get_row(0, 9, strr); pData[playerid][Money] = strval(strr);
    
    pData[playerid][pX] = cache_get_row_float(0, 10);
    pData[playerid][pY] = cache_get_row_float(0, 11);
    pData[playerid][pZ] = cache_get_row_float(0, 12);
Are those correct? Anything off or missing?

2. How would I make a player spawn, wherein the data would be taken from the MySQL database? Should it be in :-
  • Under the same stock (stock which contains code being executed after player logs in after password check)?
or
  • Under OnPlayerSpawn or any other callback?
Thanks.
You should use cache_get_row_int or cache_get_field_content_int to get integer from MySQL.
Код:
pData[playerid][ID] = cache_get_row_int(0, 0);
pData[playerid][Level] = cache_get_row_int(0, 4);
pData[playerid][Colour] = cache_get_row_int(0, 5);
pData[playerid][RegTime] = cache_get_row_int(0, 6);
pData[playerid][OnlineTime] = cache_get_row_int(0, 7);
pData[playerid][Score] = cache_get_row_int(0, 8);
pData[playerid][Money] = cache_get_row_int(0, 9);
If you save it as integer in MySQL database, you should.
Reply


Messages In This Thread
Using cache_get_row_float and other questions - by Parallax - 15.04.2015, 09:05
Re: Using cache_get_row_float and other questions - by JeaSon - 15.04.2015, 09:27
Re: Using cache_get_row_float and other questions - by Awdratai - 15.04.2015, 10:13
Re: Using cache_get_row_float and other questions - by Konstantinos - 15.04.2015, 10:14
Re: Using cache_get_row_float and other questions - by Parallax - 15.04.2015, 11:10
Re: Using cache_get_row_float and other questions - by Konstantinos - 15.04.2015, 11:18
Re: Using cache_get_row_float and other questions - by Parallax - 15.04.2015, 12:01

Forum Jump:


Users browsing this thread: 1 Guest(s)