04.08.2013, 01:42
A include Dutils
Quote:
109 - stock HexToInt(string[]) { if (string[0]==0) return 0; new i; new cur=1; new res=0; for (i=strlen(string);i>0;i--) { if (string[i-1]<5 res=res+cur*(string[i-1]-4; else res=res+cur*(string[i-1]-65+10); cur=cur*16; } return res; } /** * Return the int as string * @param number */ stock IntToHex(number) { new m=1; new depth=0; while (number>=m) { m = m*16; depth++; } depth--; new str[MAX_STRING]; for (new i = depth; i >= 0; i--) { str[i] = ( number & 0x0F) + 0x30; // + (tmp > 9 ? 0x07 : 0x00) str[i] += (str[i] > '9') ? 0x07 : 0x00; number >>= 4; } str[8] = '\0'; return str; } /** * Return the string as int * @param string */ stock StrToInt(string[]) { return strval(string); } /** * Return the value as string * @param value */ stock IntToStr(value) { new tmp[MAX_STRING]; valstr(tmp, value); return tmp; } /** * Return the truncated value * @param Float:value */ stock trunc(Float:value) { return floatround(value,floatround_floor); } /** * Sets money for player * @param playerid * howmuch */ stock SetPlayerMoney(playerid,howmuch) { PRIVATE_Last_Money[playerid]=howmuch; GivePlayerMoney(playerid,howmuch-GetPlayerMoney(playerid)); 179 - } |