[Pedido] Sistemas de cores VIP.
#2

PHP Code:
if(dialogid == sua_dialog):
        {
            if(
response)
            {
                if(
strlen(inputtext) != strlen("FFFFFF") || isnull(inputtext) || !isValidHexCode(inputtext))
                    return 
SendClientMessage(playerid0xff0000ff"* Vocк precisa digitar um cуdigo hex vбlido!");
                
String[0] = EOS;
                
format(Stringsizeof(String), "0x%sFF"inputtext), SetPlayerColor(playeridHexToInt(String));
                return 
SendClientMessage(playeridHexToInt(String), "Vocк setou sua cor!");
            }
            return 
true;
        } 

PHP Code:
stock isValidHexCode(code[])
{
    new 
checked;
    for(new 
istrlen(code); i++)
    {
        if(
code[i] >= '0' && code[i] <= '9')
            
checked+=1;
        else if((
code[i] == 'A' || code[i] == 'a') || (code[i] == 'B' || code[i] == 'b') || (code[i] == 'C' || code[i] == 'c') || (code[i] == 'D' || code[i] == 'd') || (code[i] == 'E' || code[i] == 'e') || (code[i] == 'F' || code[i] == 'f'))
            
checked+=1;
    }
    if(
checked == 6)
        return 
true;
    return 
false;

PHP Code:
stock HexToInt(string[])
{
    if(!
string[0]) return 0;
    new 
cur 1res 0;
    for(new 
strlen(string); 0i--)
    {
        
res += cur * (string[1] - ((string[1] < 58) ? (48) : (55)));
        
cur cur 16;
    }
    return 
res;

eu uso assim, agr adapte no seu servidor.
Reply


Messages In This Thread
Sistemas de cores VIP. - by DeusGrego - 03.12.2018, 18:56
Re: Sistemas de cores VIP. - by NelsonC - 03.12.2018, 19:03
Re: Sistemas de cores VIP. - by DeusGrego - 03.12.2018, 20:04
Re: Sistemas de cores VIP. - by Luiiiz - 03.12.2018, 20:33
Re: Sistemas de cores VIP. - by ipsLuan - 03.12.2018, 20:36
Re: Sistemas de cores VIP. - by DeusGrego - 04.12.2018, 06:13

Forum Jump:


Users browsing this thread: 1 Guest(s)