White text OnPlayerText - + rep.
#1

PHP код:
public OnPlayerText(playeridtext[])
{
    new 
pname[24], str[128];
    
GetPlayerName(playeridpname24);
    
format(strsizeof(str), "%s: %s"pnametext);
    
ProxDetector(10.0playeridstr,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
    return 
0;

Look i want to get the white color off, so the players color shows instead.

but when i do i get errors.

PHP код:
forward ProxDetector(Float:radiplayeridstring[],col1,col2,col3,col4,col5);
public 
ProxDetector(Float:radiplayeridstring[],col1,col2,col3,col4,col5)
{
    if(
IsPlayerConnected(playerid))
    {
        new 
Float:posxFloat:posyFloat:posz;
        new 
Float:oldposxFloat:oldposyFloat:oldposz;
        new 
Float:tempposxFloat:tempposyFloat:tempposz;
        
GetPlayerPos(playeridoldposxoldposyoldposz);
        
//radi = 2.0; //Trigger Radius
        
for(new 0MAX_PLAYERSi++)
        {
            if(
IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
            {
                
GetPlayerPos(iposxposyposz);
                
tempposx = (oldposx -posx);
                
tempposy = (oldposy -posy);
                
tempposz = (oldposz -posz);
                
//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
                
if (((tempposx radi/16) && (tempposx > -radi/16)) && ((tempposy radi/16) && (tempposy > -radi/16)) && ((tempposz radi/16) && (tempposz > -radi/16)))
                {
                    
SendClientMessage(icol1string);
                }
                else if (((
tempposx radi/8) && (tempposx > -radi/8)) && ((tempposy radi/8) && (tempposy > -radi/8)) && ((tempposz radi/8) && (tempposz > -radi/8)))
                {
                    
SendClientMessage(icol2string);
                }
                else if (((
tempposx radi/4) && (tempposx > -radi/4)) && ((tempposy radi/4) && (tempposy > -radi/4)) && ((tempposz radi/4) && (tempposz > -radi/4)))
                {
                    
SendClientMessage(icol3string);
                }
                else if (((
tempposx radi/2) && (tempposx > -radi/2)) && ((tempposy radi/2) && (tempposy > -radi/2)) && ((tempposz radi/2) && (tempposz > -radi/2)))
                {
                    
SendClientMessage(icol4string);
                }
                else if (((
tempposx radi) && (tempposx > -radi)) && ((tempposy radi) && (tempposy > -radi)) && ((tempposz radi) && (tempposz > -radi)))
                {
                    
SendClientMessage(icol5string);
                }
            }
            else
            {
                
SendClientMessage(icol1string);
            }
        }
    }
//not connected
    
return 1;

Reply
#2

Someone?
Reply
#3

what errors?
and use GetPlayerColor, but GetPlayerColor will return nothing if u don't use SetPlayerColor before!
Reply
#4

You can use 'GetPlayerColor' and make it work as view like ordinary chat. You must also use 'SetPlayerColor' when a player connects or it will be black.
pawn Код:
public OnPlayerText(playerid, text[])
{
 new str[128], Lname[MAX_PLAYER_NAME];
 GetPlayerName(playerid, Lname, sizeof(Lname));
 new Lcol[MAX_PLAYERS];
 format(str, sizeof(str), "%s:{FFFFFF} %s", Lname, text);
 Lcol[playerid] = GetPlayerColor(playerid);
 new col = Lcol[playerid];
 SendClientMessageToAll(col, str);
 //Other functions.
 return 0;
}
Reply
#5

I made some SetPlayerColor, but i just need to put that code in? No edit in the Proxdectector?
Reply
#6

It doesn't need all the above when there is a function that returns the name with the color.
SendPlayerMessageToAll
Quote:
Originally Posted by SA:MP Wiki
This function can be used to send a message from a player to everyone else player. The line will start with the sender's name in his color, followed by the message in white.
pawn Код:
public OnPlayerText(playerid, text[])
{
    new output[128];
    format(output, sizeof(output), "%s", text);
    SendPlayerMessageToAll(playerid, output);
    return 0;
}
Reply
#7

guys this is for a rp local chat, not a TDM or something.

Please i added this and removed SendPlayerMessageToAll

ProxDetector(10.0, playerid, col, str);

Now i getting this error:

error 035: argument type mismatch (argument 3)
Reply
#8

Quote:
Originally Posted by Lynet
Посмотреть сообщение
error 035: argument type mismatch (argument 3)
Look better at the parameters.
pawn Код:
ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
Reply
#9

The white color shouldnt be there...........

The players team color should show there, but it doesnt.
Reply
#10

You must set it when a player connects.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)