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);
<parallx> what's the difference between cache_get_row_float and cache_get_field_content_float?
pData[playerid][pX] = cache_get_row_float(0, 10); // row number is 10 its an example
pData[playerid][pX] = cache_get_field_content_float(0,"px");
public OnPlayerSpawn(playerid)
{
SetPlayerPos(playerid, pData[playerid][pX], pData[playerid][pY], pData[playerid][pZ]);
return 1;
}
|
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);
2. How would I make a player spawn, wherein the data would be taken from the MySQL database? Should it be in :-
|
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);

// assigning..
...
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);
SetSpawnInfo(playerid, ..., pData[playerid][pX], pData[playerid][pY], pData[playerid][pZ], ...);
SpawnPlayer(playerid);
|
In the public function you assign the data to the player's variables.
pawn Код:
|