SA-MP Forums Archive
@ID - SCM PlayerName - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: @ID - SCM PlayerName (/showthread.php?tid=528383)



@ID - SCM PlayerName - NiKi123 - 27.07.2014

Hi,
I have a problem.
I need that to chat write player name with his color name
I work but not work.

Код:
public OnPlayerText(playerid, text[])
{
               new str[150];
                strcat(str, text);
                printf("str:{x} %s{FFFFFF}",GetPlayerColor(playerid),str);
                for(new i; i < strlen(str); i++){
            if(str[i] == '@'){
                new findID[55];
                new pos = strfind(str[i]," ");

                if(pos == -1){
                if(str[i] >= strlen(str)-4){
                                pos = -2;
                        }
                }

                if(pos == -1) continue;
                if(pos == -2){
                        strmid(findID,str,i+1,strlen(str));
                        strdel(str, i,strlen(str));
                }else{
                        strmid(findID,str,i+1,i+strfind(str[i]," "));
                        strdel(str, i,i+strfind(str[i]," "));
                }
                        //strins(text, Nicks[strval(findID)], i,200);
                        new id = strval(findID);
                        if(IsPlayerConnected(id)){
                            new name[30];
                            GetPlayerName(id,name,30);
                            strins(str, name, i,30);
                        }
            }
        }
        SendPlayerMessageToAll(playerid, str);
        }



Re: @ID - SCM PlayerName - NiKi123 - 28.07.2014

Reff


Re: @ID - SCM PlayerName - BroZeus - 28.07.2014

can u give an example of what u want


Re: @ID - SCM PlayerName - zSuYaNw - 28.07.2014

pawn Код:
new pName[24], string[128];
format(string, sizeof(string), "%s{0000}: %s", (GetPlayerName(playerid, pName, 24), pName), text);
SendClientMessageToAll(GetPlayerColor(playerid), string);



Re: @ID - SCM PlayerName - NiKi123 - 28.07.2014

Quote:
Originally Posted by zSuYaNw
Посмотреть сообщение
pawn Код:
new pName[24], string[128];
format(string, sizeof(string), "%s{0000}: %s", (GetPlayerName(playerid, pName, 24), pName), text);
SendClientMessageToAll(GetPlayerColor(playerid), string);
Doesnґt not work


Re: @ID - SCM PlayerName - NiKi123 - 28.07.2014

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
can u give an example of what u want
This is.... In message @ID change it to Player Name a I want a change it to player name with player color name.


Re: @ID - SCM PlayerName - Ihateyou - 28.07.2014

please use some fking proper english i cant understand

i think my IQ dropped 100 points since i joined this forum and started looking in scripting help section


Re: @ID - SCM PlayerName - zSuYaNw - 28.07.2014

pawn Код:
public OnPlayerText(playerid, text[])
{
               new str[150];
                strcat(str, text);
                printf("str:{x} %s{FFFFFF}",GetPlayerColor(playerid),str);
                for(new i; i < strlen(str); i++){
            if(str[i] == '@'){
                new findID[55];
                new pos = strfind(str[i]," ");

                if(pos == -1){
                if(str[i] >= strlen(str)-4){
                                pos = -2;
                        }
                }

                if(pos == -1) continue;
                if(pos == -2){
                        strmid(findID,str,i+1,strlen(str));
                        strdel(str, i,strlen(str));
                }else{
                        strmid(findID,str,i+1,i+strfind(str[i]," "));
                        strdel(str, i,i+strfind(str[i]," "));
                }
                        //strins(text, Nicks[strval(findID)], i,200);
                        new id = strval(findID);
                        if(IsPlayerConnected(id)){
                            new name[30];
                            GetPlayerName(id,name,30);
                           
                            format(findid, 50, "{%h}", GetPlayerColor(id) >>> 8);
                            strins(str, findid, i, 7);
                            strins(str, name, i + 6,30);
                            strins(str, "{FFFFFF}", i + (sizeof(name) + 6), 6);
                        }
            }
        }
        SendPlayerMessageToAll(playerid, str);
        }
PS: Don't tested.


Re: @ID - SCM PlayerName - NiKi123 - 28.07.2014

Now when I write @0 so to chat write normally @0.


Re: @ID - SCM PlayerName - NiKi123 - 28.07.2014

Reff..