Reading and setting colours?
#9

Quote:
Originally Posted by [SAP
Ycto ]
Hai,

Make sure that the Color[playerid] is a string, then use SetPlayerColor(playerid,HexToInt(Color[playerid]));
Search the forums for the HexToInt function (I think it's somewhere in a big include, with various useful functions.)
Cheers mate! Works perfectly.

Here's the function for people searching when they need it.

pawn Код:
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]<58) res=res+cur*(string[i-1]-48); else res=res+cur*(string[i-1]-65+10);
  cur=cur*16;
 }
 return res;
}
Reply


Messages In This Thread
Reading and setting colours? - by Norn - 15.02.2009, 19:07
Re: Reading and setting colours? - by rensfromrpas - 15.02.2009, 19:15
Re: Reading and setting colours? - by Norn - 15.02.2009, 19:17
Re: Reading and setting colours? - by Nimphious - 15.02.2009, 19:17
Re: Reading and setting colours? - by AlExAlExAlEx - 15.02.2009, 19:19
Re: Reading and setting colours? - by Ycto - 15.02.2009, 19:20
Re: Reading and setting colours? - by Backwardsman97 - 15.02.2009, 19:21
Re: Reading and setting colours? - by AlExAlExAlEx - 15.02.2009, 19:22
Re: Reading and setting colours? - by Norn - 15.02.2009, 19:29
Re: Reading and setting colours? - by Ycto - 15.02.2009, 19:30

Forum Jump:


Users browsing this thread: 1 Guest(s)