_HoMeR_ 1 Odesláno: 20. Listopad, 2017 Share Odesláno: 20. Listopad, 2017 Popis problému: Zdravím, mám urobené, že sa mi načíta číslo farby a naformátujem si to v tvare 0x ..... Neustále mi to píše argument type mismatch Chyby/varování kompilátoru a při běhu: -- Kód: format(string, sizeof(string), "0x%dFF", c_color_1[vehicleid]); -> error riadok SetDynamicObjectMaterial(c_object1, 0, -1, "none", "none", string); Dodatečné poznámky: -- Link to comment Share on other sites More sharing options...
0 ATomas 291 Odesláno: 20. Listopad, 2017 Share Odesláno: 20. Listopad, 2017 (upraveno) protoze parametr barvy je ocekavan jako integer (hex) a ty mu predavas string format(string, sizeof(string), "FF%06X", c_color_1[vehicleid]);//%06X znamena ze to chces v hex a na 6 mist (doplnit nulama) SetDynamicObjectMaterial(c_object1, 0, -1, "none", "none", HexToInt(string)); You MUST use ARGB color format, not RGBA like used in client messages etc http://wiki.sa-mp.com/wiki/SetObjectMaterial stock HexToInt(text[]) { new num; for(new i;text[i];i++) { switch(text[i]) { case 'x','X': num = 0; case '0' .. '9': num = (num << 4) | (text[i] - '0'); case 'a' .. 'f': num = (num << 4) | (text[i] - ('a' - 10)); case 'A' .. 'F': num = (num << 4) | (text[i] - ('A' - 10)); } } return num; } Edited 20. Listopad, 2017 by ATomas Link to comment Share on other sites More sharing options...
Dotaz
_HoMeR_ 1
Popis problému:
Zdravím,
mám urobené, že sa mi načíta číslo farby a naformátujem si to v tvare 0x .....
Neustále mi to píše argument type mismatch
Chyby/varování kompilátoru a při běhu:
--
Kód:
Dodatečné poznámky:
--
Link to comment
Share on other sites
1 odpověd na tuto otázku
Recommended Posts