Quote:
Originally Posted by ♣ Joker ♠
pawn Код:
if(dialogid == NAME_COLOR3) { if(response == 1) { if(inputtext[0] == EOS) { SendClientMessage(playerid, COLOR_RED, "You left the input field blank."); return ShowPlayerDialog(playerid, NAME_COLOR3, DIALOG_STYLE_INPUT, "Write color", " Write a color in hex notation format:", "Apply", "Cancel"); } new c; for( ; inputtext[c]; c++) if(('A' <= inputtext[c] && inputtext[c] <= 'F' && '0' <= inputtext[c] && inputtext[c] <= '9') == false) break; if(inputtext[c] != EOS) return SendClientMessage(playerid, COLOR_RED, "Invalid character (Hex notation 0 - 9, A - F)"); if(c != 9) return SendClientMessage(playerid, COLOR_RED, "Invalid format (Example: CCAA8866 [Red/Green/Blue/Visibility])"); new color, Float:h; for(c--; c != -1; c--, h++) if(inputtext[c] >= 'A') color += ((inputtext[c] - 'A' + 10) * floatpower(16.0, h)); else color += ((inputtext[c] - '0') * floatpower(16.0, h)); return SetPlayerColor(playerid, color); } } }
|
WOW! Much more complicated than i thought.
Thanks!