03.10.2013, 14:43
Hello, I'm mading some script and I have problems, I dunno, maybe that's SQL problem but all columns when player tries to load goes to default value
Код HTML:
stock MySQL_Load(playerid) { new Float: pos[3], // 0,1,2 - pozicija; fetch[16], Query[256]; format(Query, sizeof(Query), "SELECT * FROM `zaidejai` WHERE vardas = '%s'", GetPlayerNameEx(playerid)); mysql_query(Query); mysql_store_result(); mysql_retrieve_row(); mysql_fetch_field_row( fetch, "x" ); pos[0] = floatstr(fetch); mysql_fetch_field_row( fetch, "y" ); pos[1] = floatstr(fetch); mysql_fetch_field_row( fetch, "z" ); pos[2] = floatstr(fetch); SetPlayerPos( playerid, pos[0], pos[1], pos[2] + 0.75); mysql_fetch_field_row( fetch,"pLytis" ); playerData[playerid][pLytis] = strval(fetch); mysql_fetch_field_row( fetch,"pAdmin" ); playerData[playerid][pAdmin] = strval(fetch); mysql_fetch_field_row( fetch,"pVip" ); playerData[playerid][pVip] = strval(fetch); mysql_fetch_field_row( fetch,"pAdmin" ); playerData[playerid][pAdmin] = strval(fetch); mysql_fetch_field_row( fetch,"skin" ); playerData[playerid][pSkin] = strval(fetch); SetPlayerSkin(playerid, playerData[playerid][pSkin]); mysql_fetch_field_row( fetch,"pinigai" ); playerData[playerid][pPinigai] = strval(fetch); GivePlayerMoney(playerid, playerData[playerid][pPinigai]); mysql_fetch_field_row( fetch,"patirtis" ); playerData[playerid][pPatirtis] = strval(fetch); SetPlayerScore(playerid, playerData[playerid][pPatirtis]); new Float: HP, Float: ARM; mysql_fetch_field_row( fetch,"hp" ); HP = floatstr( fetch ); SetPlayerHealth( playerid, HP); mysql_fetch_field_row( fetch,"armour" ); ARM = floatstr( fetch ); SetPlayerArmour( playerid, ARM); mysql_free_result(); printf("Pakrautas юaidлjas. [%s]", GetPlayerNameEx(playerid)); return 1; }