Skip to content

MySQL_GetValueInt

imshooter edited this page Nov 3, 2026 · 1 revision

A cell of the result read as an integer.

A cell that is NULL or does not exist leaves value as it was, so the variable can hold a default.

new
level = 1
;
MySQL_GetValueInt(0, "level", level);
native bool:MySQL_GetValueInt(row, const field[], &value);

Parameters

Parameter Description
row The row, from 0.
const field[] Name of the field.
&value Variable for the integer.

Returns

  • true when the integer was written.
  • false when the cell is NULL or does not exist.

Remarks

Names are found without regard to case. A name the result does not have is logged once, the first time it is asked for. A cell that is not a whole number, such as 2.5, is cut to 2. The variable keeps its value when the native returns false, so it can hold a default.

Example

forward OnPlayerRead(playerid);

public OnPlayerRead(playerid) {
    new
        skin = 26,
        money
    ;

    MySQL_GetValueInt(0, "skin", skin);

    if (MySQL_GetValueInt(0, "money", money)) {
        GivePlayerMoney(playerid, money);
    }

    SetPlayerSkin(playerid, skin);

    return 1;
}

Related

Clone this wiki locally