How can i create a message like...
#1

Well i want to make it so when someone talks it will display: Note(its global chat)

Код:
CSMajor: [5] <--- this is what i want it to display (Then the text goes right after the id)
i cannot figure out how to do this stupid thing.


The checkpoints are getting on my nervers -.- how do i make them?
Reply
#2

It depends what kind of chat - global / local.

Look under OnplayerText, and see if there is a format command you can change.

eg
pawn Код:
public OnPlayerText(playerid,text[])
{
     new string[164],name[24];
     GetPlayerName(playerid, name, sizeof(name));
     format(string,sizeof(string),"%s [%d] : %s",name,playerid,text);
     ProxDetector(20.0,playerid,string,0xAFAFAFAA);
     return 0;
}
and you will need these in your script too

pawn Код:
stock ProxDetector(Float:radi, playerid, string[],color)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerVirtualWorld(i) == virtualworld)
            {
                if(GetPlayerInterior(i) == interior)
                {
                    new Float:dist = GetDistanceBetweenPlayers(i,playerid);
                    if(dist < radi && dist > 0)
                    {
                        SendClientMessage(i, color, string);
                    }
                }
            }
        }
    }
    return 1;
}

stock Float:GetDistanceBetweenPlayers(p1,p2)
{
    new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
    if(!IsPlayerConnected(p1) || !IsPlayerConnected(p2))
    {
        return -1.00;
    }
    if(!GetPlayerInterior(p1) != !GetPlayerInterior(p2))
    {
        return -1.00;
    }
    GetPlayerPos(p1,x1,y1,z1);
    GetPlayerPos(p2,x2,y2,z2);
    return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
I have not tested any of this but you should be able to get it working.
Reply
#3

there is an easier way. I know because another server owner only needed about 5 lines to complete it.
Reply
#4

pawn Код:
new string[128];
format(string, sizeof(string), "[%i] %s",playerid, text);
SendPlayerMessageToAll(playerid,string);
Reply
#5

I think you are talking about SendPlayerMessageToAll
https://sampwiki.blast.hk/wiki/SendPlayerMessageToAll

I don't use this command, but something like this may work.
pawn Код:
public OnPlayerText(playerid,text[])
{
     new string[164];
     format(string,sizeof(string),"[%d] : %s",playerid,text);
     SendPlayerMessageToAll(playerid,string);
     return 0;
}
Reply
#6

that does not work, the output is:


CSMajor: [hi] [0] <-- this is right
CSMajor: hi <-- this displays right below it.
Reply
#7

Also can someone help me fix my map icon problem?

I have this code right here in the onplayerconnect callback :

Код:
SetPlayerMapIcon( playerid, 12, 1939.7401, 2076.4077, 10.8203, 55, 0 );
    SetPlayerMapIcon( playerid, 13, 2204.9468, 1986.2877, 16.7380, 52, 0 );
yet if i go in game and go to the map. It shows diddo -.- how can i get this to work?
Reply
#8

Also is there an id for a red chekcpoint? not an un textured one....
Reply
#9

Quote:
Originally Posted by Seven.
Посмотреть сообщение
pawn Код:
new string[128];
format(string, sizeof(string), "[%i] %s",playerid, text);
SendPlayerMessageToAll(playerid,string);
Mine did..
Reply
#10

Quote:
Originally Posted by CSMajor
Посмотреть сообщение
Also is there an id for a red chekcpoint? not an un textured one....
......

pawn Код:
SetPlayerCheckpoint
Heres the wiki link SetPlayerCheckpoint


But to view more than 1 checkpoint a player, your going to need a checkpoint streamer.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)