Help [+1 rep] -
sniperwars - 13.04.2012
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
Re: Help [+1 rep] -
ViniBorn - 13.04.2012
Use GetPlayerColor
Re: Help [+1 rep] -
sniperwars - 13.04.2012
That's it ?
That wasn't helpful :/
Re: Help [+1 rep] -
ViniBorn - 13.04.2012
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
Re: Help [+1 rep] -
sniperwars - 13.04.2012
Didn't work. Can you make it simple and do both teams ?
I really need this now..
Re: Help [+1 rep] -
Kakioshe22 - 13.04.2012
Here you go:
PHP код:
#define ZOMBIE 0
#define ZOMBIE_COLOR 0x33AA33AA //Green
new gTeam[MAX_PLAYERS];
PHP код:
public OnGameModeInit()
{
AddPlayerClass(105, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}
PHP код:
public OnPlayerRequestClass(playerid, classid)
{
if (classid == 0)
{
GameTextForPlayer(playerid, "~g~Zombie", 4000, 6);
SetPlayerTeam(playerid,Zombie);
gTeam[playerid] = ZOMBIE;
//Position, one interior!
SetPlayerPos(playerid,2490.5049,-1993.8779,17.2266);
SetPlayerInterior(playerid, 0);
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(playerid, classid)
{
if(classid == 0)
{
gTeam[playerid] = ZOMBIE;
}
}
SetPlayerToTeamColour(playerid)
{
if(gTeam[playerid] == ZOMBIE)
{
SetPlayerColor(playerid,ZOMBIE_COLOR);
}
}
Same for surivor
Re: Help [+1 rep] -
ReneG - 13.04.2012
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.
Re: Help [+1 rep] -
sniperwars - 13.04.2012
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..
Re: Help [+1 rep] -
sniperwars - 14.04.2012
Okay, that didn't work. Anyone ?
Re: Help [+1 rep] -
emokidx - 14.04.2012
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);