[Ajuda] Nick's colorido (ramdom)
#1

Como posso fazer algo do tipo: quando um player que entrar no server receber uma cor diferente randomicamente

Player 1 - Vermelho
Player 2- Azul
Player 3 - Verde
Reply
#2

http://pastebin.com/0zhm6Yfx

fonte https://sampforum.blast.hk/showthread.php?tid=210743
Reply
#3

vlw fernando +rep

#Edit .> Fernando este seta cores somente no Chat, Preciso de um que seta a cor do player realmente.
Reply
#4

Caso queira o SetPlayerColor
PHP код:
#define FILTERSCRIPT 
#include <a_samp> 
new PlayerColors[88] = {
0xFF8C13FF,0xC715FFFF,0x20B2AAFF,0xDC143CFF,0x6495EDFF,0xf0e68cFF,0x778899FF,0xFF1493FF,0xF4A460FF,
0xEE82EEFF,0xFFD720FF,0x8b4513FF,0x4949A0FF,0x148b8bFF,0x14ff7fFF,0x556b2fFF,0x0FD9FAFF,0x10DC29FF,
0x534081FF,0x0495CDFF,0xEF6CE8FF,0xBD34DAFF,0x247C1BFF,0x0C8E5DFF,0x635B03FF,0xCB7ED3FF,0x65ADEBFF,
0x5C1ACCFF,0xF2F853FF,0x11F891FF,0x7B39AAFF,0x53EB10FF,0x54137DFF,0x275222FF,0xF09F5BFF,0x3D0A4FFF,
0x22F767FF,0xD63034FF,0x9A6980FF,0xDFB935FF,0x3793FAFF,0x90239DFF,0xE9AB2FFF,0xAF2FF3FF,0x057F94FF,
0xB98519FF,0x388EEAFF,0x028151FF,0xA55043FF,0x0DE018FF,0x93AB1CFF,0x95BAF0FF,0x369976FF,0x18F71FFF,
0x4B8987FF,0x491B9EFF,0x829DC7FF,0xBCE635FF,0xCEA6DFFF,0x20D4ADFF,0x2D74FDFF,0x3C1C0DFF,0x12D6D4FF,
0x48C000FF,0x2A51E2FF,0xE3AC12FF,0xFC42A8FF,0x2FC827FF,0x1A30BFFF,0xB740C2FF,0x42ACF5FF,0x2FD9DEFF,
0xFAFB71FF,0x05D1CDFF,0xC471BDFF,0x94436EFF,0xC1F7ECFF,0xCE79EEFF,0xBD1EF2FF,0x93B7E4FF,0x3214AAFF,
0x184D3BFF,0xAE4B99FF,0x7E49D7FF,0x4C436EFF,0xFA24CCFF,0xCE76BEFF,0xA04E0AFF
};
public 
OnPlayerSpawn(playerid)
{
    
SetPlayerColor(playeridPlayerColors[random(88)]);
    return 
1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if(!
strcmp(cmdtext"/Color"true))
    {
        for(new 
0MAX_PLAYERSi++)
        {
          
SetPlayerColor(iPlayerColors[random(88)]);
        }
        return 
1;
    }
    return 
0;



Caso queira o nome da cor
PHP код:
#define FILTERSCRIPT
#include <a_samp>
new Color[MAX_PLAYERS];
new 
PlayerColors[5] = {
1,2,3,4,5
};
public 
OnPlayerConnect(playerid)
{
    
Color[playerid] = PlayerColors[random(5)];
    return 
1;
}
public 
OnPlayerText(playeridtext[])
{
    new 
pText[144];
    if(
Color[playerid]==1)
    {
        
format(pTextsizeof (pText), "- {FF002B}Vermelho (%d) %s "playeridtext);
        
SendPlayerMessageToAll(playeridpText);
    }
    if(
Color[playerid]==2)
    {
        
format(pTextsizeof (pText), "- {3DE3B1}Verde (%d) %s "playeridtext);
        
SendPlayerMessageToAll(playeridpText);
    }
    if(
Color[playerid]==3)
    {
        
format(pTextsizeof (pText), "- {FAF623}Amarelo (%d) %s "playeridtext);
        
SendPlayerMessageToAll(playeridpText);
    }
    if(
Color[playerid]==4)
    {
        
format(pTextsizeof (pText), "- {69670C}Preto (%d) %s"playeridtext);
        
SendPlayerMessageToAll(playeridpText);
    }
    if(
Color[playerid]==5)
    {
        
format(pTextsizeof (pText), "- {F2C80C}Laranja (%d) %s"playeridtext);
        
SendPlayerMessageToAll(playeridpText);
    }
    return 
0;

Reply
#5

Use SetPlayerColor

Fonte;
Reply
#6

Код:
public OnPlayerConnect(playerid)
{
	SetPlayerColor(playerid, random(0xffffff));
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)