Help [+1 rep]
#1

Hey guys,

I'm kinda puzzled here. I'm currently scripting a Zombie Apocalypse server and I have two teams which are
Zombie and Survivor. I want something like this for both teams. I want the player names in the same color
as their team color with the ID like this:

Survivor: Player Name [ID:0]: Text (Text and ID will be white and the player name will be their team color.)
Zombie: Player Name [ID:0]: Text (Text and ID will be white and the player name will be their team color.)

Can anyone make this for me ? I've tried so many methods but no success.. I really need this like right now..

Thanks,

Sean aka sniperwars
Reply
#2

Use GetPlayerColor
Reply
#3

That's it ?
That wasn't helpful :/
Reply
#4

Ex:
pawn Код:
format(BornString,sizeof(BornString),"Zombie: {%h}%s [ID:%d] %s",(GetPlayerColor(playerid) >>> 8),PlayerName,playerid,text);
SendClientMessageToAll(-1,BornString);
Adapt for your script
Reply
#5

Didn't work. Can you make it simple and do both teams ?
I really need this now..
Reply
#6

Here you go:

PHP код:
#define ZOMBIE 0
#define ZOMBIE_COLOR 0x33AA33AA //Green
new gTeam[MAX_PLAYERS]; 
PHP код:
public OnGameModeInit()
{
    
AddPlayerClass(1051958.37831343.157215.3746269.1425000000);
    return 
1;

PHP код:
public OnPlayerRequestClass(playeridclassid)
{
    if (
classid == 0)
    {
    
GameTextForPlayer(playerid"~g~Zombie"40006);
    
SetPlayerTeam(playerid,Zombie);
    
gTeam[playerid] = ZOMBIE;
    
//Position, one interior!
    
SetPlayerPos(playerid,2490.5049,-1993.8779,17.2266);
    
SetPlayerInterior(playerid0);
    
SetPlayerCameraPos(playerid,2489.5247,-1992.0553,17.2266);
    
SetPlayerCameraLookAt(playerid,2490.5049,-1993.8779,17.2266);
    
SetPlayerFacingAngle(playerid,33.2244);
    
ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1);
    }
    return 
1;

PHP код:
public OnPlayerSpawn(playerid)
{
    
SetPlayerToTeamColour(playerid);
    return 
1;

PHP код:
SetPlayerTeamFromClass(playeridclassid)
{
    if(
classid == 0)
    {
        
gTeam[playerid] = ZOMBIE;
    }
}
SetPlayerToTeamColour(playerid)
{
    if(
gTeam[playerid] == ZOMBIE)
    {
        
SetPlayerColor(playerid,ZOMBIE_COLOR);
    }

Same for surivor
Reply
#7

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
Ex:
pawn Код:
format(BornString,sizeof(BornString),"Zombie: {%h}%s [ID:%d] %s",(GetPlayerColor(playerid) >>> 8),PlayerName,playerid,text);
SendClientMessageToAll(-1,BornString);
Adapt for your script
%h isn't a format specifier. It's %x for hexadecimal notation.

On topic.

You don't need to format a new string for the text. SAMP automatically sends the message this way with whatever color the player is. Just use SetPlayerColor, and whenever they type, voila.
Reply
#8

You guys have obviously misunderstood what I need.
The color is fine, I just wanted the ID's but I have a
friend helping me now..
Reply
#9

Okay, that didn't work. Anyone ?
Reply
#10

it's simple
in your OnPlayerText
pawn Код:
format(str,sizeof(str),"{FFFFFF}Zombie: {%06x}%s {FFFFFF}[ID:%d] %s",(GetPlayerColor(playerid) >>> 8),/*w/e your enum/vars are -- >*/pname,playerid,text);
SendClientMessageToAll(-1,str);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)