Help, quick question
#1

Hello.

How would I script so that when a player chooses grove, or the ballas that when you talk in the chat your name would be like the color of the gang.

Example:
DJTunes: Hello I'm in the Ballas Gang!
DJTunes: Hello I'm in the Grove Gang!

So yeah, when they talk if they were in grove their names would be green, and if they're ballas they would be purple.
Reply
#2

onplayertext

Edit:
pawn Код:
public OnPlayerText(playerid, text[])
{
  new string[256];
  if(PlayerTeam == 1)
  {
   format(string, sizeof(string), "%s",text);
   SendClientMessageToAll(COLOR_GROVE, string);
  }
  else if(PlayerTeam == 2)
  {
   format(string, sizeof(string), "%s",text);
   SendClientMessageToAll(COLOR_BALLAS, string);
  }
  return 0;
}
Reply
#3

You could use SetPlayerColor, which would use there player colour in the main chat too.

https://sampwiki.blast.hk/wiki/SetPlayerColor
Reply
#4

Quote:
Originally Posted by Stevee
Посмотреть сообщение
You could use SetPlayerColor, which would use there player colour in the main chat too.

https://sampwiki.blast.hk/wiki/SetPlayerColor
Yeah I'm wanting this. Could I have an exact pawn code so I could just copy and paste?

Also I get this when I compile:
Код:
C:\Users\Zach\Documents\SA-MP Testing Server\gamemodes\GangWars.pwn(184) : warning 217: loose indentation
C:\Users\Zach\Documents\SA-MP Testing Server\gamemodes\GangWars.pwn(193) : warning 217: loose indentation
C:\Users\Zach\Documents\SA-MP Testing Server\gamemodes\GangWars.pwn(209) : error 017: undefined symbol "PlayerTeam"
C:\Users\Zach\Documents\SA-MP Testing Server\gamemodes\GangWars.pwn(214) : error 017: undefined symbol "PlayerTeam"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Код:
public OnPlayerText(playerid, text[])
{
  new string[256];
  if(PlayerTeam == 1)
  {
   format(string, sizeof(string), "%s",text);
   SendClientMessageToAll(0x33AA33AA, string);
  }
  else if(PlayerTeam == 2)
  {
   format(string, sizeof(string), "%s",text);
   SendClientMessageToAll(0x9370DBFF, string);
  }
  return 0;
}
Reply
#5

pawn Код:
public OnPlayerSpawn(playerid)
{
 if(PlayerTeam == GROVE)
 {
 SetPlayerColor(playerid, COLOR_GROVE);
 }
 else if(PlayerTeam == BALLAS)
 {
 SetPlayerColor(playerid, COLOR_BALLAS);
 }
 return 1;
}
u can ..... Learn extra stuff here >>
https://sampforum.blast.hk/showthread.php?tid=160810
Reply
#6

Fopr copy pasting you need to show us which variable are you using for teams
Reply
#7

Quote:
Originally Posted by Glad2BeHere
Посмотреть сообщение
pawn Код:
public OnPlayerSpawn(playerid)
{
 if(PlayerTeam == GROVE)
 {
 SetPlayerColor(playerid, COLOR_GROVE);
 }
 else if(PlayerTeam == BALLAS)
 {
 SetPlayerColor(playerid, COLOR_BALLAS);
 }
 return 1;
}
u can ..... Learn extra stuff here >>
https://sampforum.blast.hk/showthread.php?tid=160810
Dont come here looking like hero talking about copy n paste........

FOLLOWING IS ALSO FOR THE BLINDED RYDER:
As u can see i was drawing and example and pointed him to a url that would help him ......
Reply
#8

Quote:
Originally Posted by Glad2BeHere
Посмотреть сообщение
Dont come here looking like hero talking about copy n paste........

FOLLOWING IS ALSO FOR THE BLINDED RYDER:
As u can see i was drawing and example and pointed him to a url that would help him ......
Why rage?
I was just telling him the truth..Even if he uses the code you gave him, he wills till get the playerteam undefined errors. that is why i was asking him to show the player variables.
understand?no need to rage...chill
Reply
#9

Probably, Are you using gTeam[MAX_PLAYERS];?
PHP код:
if(gTeam[playerid] == GROVE)
{
//
//
// 
Reply
#10

There's no need for the use of strings in OnPlayerText, especially when you're not adding anything that isn't already included, like the player ID for example.

pawn Код:
public OnPlayerText(playerid, text[])
{
  if(PlayerTeam[playerid] == 1) return SendClientMessageToAll(COLOR_GROVE, text);
  if(PlayerTeam[playerid] == 2) return SendClientMessageToAll(COLOR_BALLAS, text);
  return 1;
}
Without the use of player team based chat:

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(PlayerTeam[playerid] == TEAM_GROVE)
    {
        SetPlayerColor(playerid, GROVE_COLOR);
    }
    else if(PlayerTeam[playerid] == TEAM_BALLAS)
    {
        SetPlayerColor(playerid, BALLAS_COLOR);
    }
    return 1;
}
That's basically all you need to know, but if you're using a custom OnPlayerText such as using formatted strings to send player messages, this won't work, and you will have to use the first code as an example, with the format lines included. Otherwise, just make sure it returns 1 and you have no SendPlayerMessageToAll or SendClientMessageToAll functions in your OnPlayerText.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)