CLEO Help [HELP] Decimal to RGBA

CLEO related
Status
Not open for further replies.

PopandaulX

Active member
Joined
Jul 15, 2013
Messages
189
Reaction score
1
Hello. I'm trying to make a script that writes a text (someone's name, who has the mod) in his color from TAB, but it's not going well....

0B37: samp 16@ = get_player_color $PLAYER_ACTOR
008A: $DECIMAL = 16@ // (int)
0010: $DECIMAL *= -1
0084: $R = $DECIMAL // (int)
0014: $R /= 65536
0084: $Rcopy = $R // (int)
0010: $Rcopy *= 65536
0060: $DECIMAL -= $Rcopy // (int)
0084: $G = $DECIMAL // (int)
0014: $G /= 256
0084: $Gcopy = $G // (int)
0010: $Gcopy *= 256
0060: $DECIMAL -= $Gcopy // (int)
0084: $B = $DECIMAL // (int)

Could you tell me what's wrong, please?
P.S. I thinked that algorithm using http://www.mathsisfun.com/hexadecimal-d ... olors.html
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,492
Reaction score
236
Location
( ͡° ͜ʖ ͡°)
You better use this;

0B2B: samp 0@ = get_player_id_by_actor_handle $PLAYER_ACTOR

0AB1: call @get_player_color 1 id 0@ to 1@ 2@ 3@





/// Paste this at the bottom of the code:
:get_player_color
{
Params:
In: 0@ - playerID
Out: 1@, 2@, 3@ - RGB Player Color
}
0AF7: get_samp_base_to 3@ // IF and SET
3@ += 0x1FA348// SAMP_COLOR_OFFSET
0@ *= 4
005A: 3@ += 0@ // (int)
3@ += 3
0A8D: 1@ = read_memory 3@ size 1 virtual_protect 1 // Red
3@ -= 1
0A8D: 2@ = read_memory 3@ size 1 virtual_protect 1 // Green
3@ -= 1
0A8D: 3@ = read_memory 3@ size 1 virtual_protect 1 // Blue
0AB2: ret 3 1@ 2@ 3@
///
 
Status
Not open for further replies.
Top