SA-MP Forums Archive
Chat - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Chat (/showthread.php?tid=254431)



Chat - Admigo - 10.05.2011

Heey guys
I want to add the ip at the name if somebody chats.
Thanks admigo


Re: Chat - Nexotronix - 10.05.2011

If You need to see in chat like this take this code:

put it under OnPlayerText:

like this

pawn Код:
public OnPlayerText(playerid, text[])
{
    new newname[256], oldname[30], ip[16];
    GetPlayerIp(playerid,ip,16);
    GetPlayerName(playerid, oldname, 30);
    format(newname, 256, "%s[%s]", oldname, ip);
    SetPlayerName(playerid, newname);
    SendPlayerMessageToAll(playerid, text);
    SetPlayerName(playerid, oldname);
    return 1;
}



Re: Chat - SkizzoTrick - 10.05.2011

pawn Код:
public OnPlayerText(...)
{
     new IP[16];
     new string[512];
     new pname[MAX_PLAYER_NAME];
     GetPlayerName(playerid,pname,sizeof(pname));
     GetPlayerIp(playerid,IP,sizeof(IP));
     format(string,sizeof(string),"%s[%d][%d] says: %s",pname,IP,playerid,text);
     SendClientMessageToAll(COLOR_WHITE,string);
     return 0;
}
EDIT:
Quote:
Originally Posted by Nexotronix
Посмотреть сообщение
If You need to see in chat like this take this code:

put it under OnPlayerText:

like this

pawn Код:
public OnPlayerText(playerid, text[])
{
    new newname[256], oldname[30], ip[16];
    GetPlayerIp(playerid,ip,16);
    GetPlayerName(playerid, oldname, 30);
    format(newname, 256, "%s[%s]", oldname, ip);
    SetPlayerName(playerid, newname);
    SendPlayerMessageToAll(playerid, text);
    SetPlayerName(playerid, oldname);
    return 1;
}
O M F G ....
That's really really..hmm


Re: Chat - xRyder - 10.05.2011

Quote:
Originally Posted by Nexotronix
Посмотреть сообщение
If You need to see in chat like this take this code:

put it under OnPlayerText:

like this

pawn Код:
public OnPlayerText(playerid, text[])
{
    new newname[256], oldname[30], ip[16];
    GetPlayerIp(playerid,ip,16);
    GetPlayerName(playerid, oldname, 30);
    format(newname, 256, "%s[%s]", oldname, ip);
    SetPlayerName(playerid, newname);
    SendPlayerMessageToAll(playerid, text);
    SetPlayerName(playerid, oldname);
    return 1;
}
Oh God, what have you done!?


Re: Chat - coole210 - 10.05.2011

Код:
public OnPlayerText(playerid, text[])
{
	new string[500];
	new name[50];
	new IP[50];
	GetPlayerName(playerid,name,sizeof(name));
	GetPlayerIp(playerid,IP,sizeof(IP));
	format(string,sizeof(string),"[%s]%s[%d]: %s",IP,name,playerid,text);
	SendClientMessageToAll(GetPlayerColor(playerid),string);
	return 0;
}
@SkizzoTrick - %d is not used for IP's.

@xRyder - The post you made was just useless.


Re: Chat - SkizzoTrick - 10.05.2011

Quote:
Originally Posted by coole210
Посмотреть сообщение
@SkizzoTrick - %d is not used for IP's.
Yep,your right.My bad...


Re: Chat - Admigo - 10.05.2011

If i add the codes i get double chat lol;P


Re: Chat - SkizzoTrick - 10.05.2011

Quote:
Originally Posted by admigo
Посмотреть сообщение
If i add the codes i get double chat lol;P
I told you in the first post to set "return 0;"

This forum requires that you wait 120 seconds between posts. Please try again in 23 seconds.


Re: Chat - Admigo - 10.05.2011

I dont want the ip from internet. I want the playerid Sorry not good explain.


Re: Chat - SkizzoTrick - 10.05.2011

Quote:
Originally Posted by admigo
Посмотреть сообщение
I dont want the ip from internet. I want the playerid Sorry not good explain.
I did it in the first post,just delete the IP.
pawn Код:
public OnPlayerText(...)
{
     new string[512];
     new pname[MAX_PLAYER_NAME];
     GetPlayerName(playerid,pname,sizeof(pname));
     format(string,sizeof(string),"%s[%d] says: %s",pname,playerid,text);
     SendClientMessageToAll(COLOR_WHITE,string);
     return 0;
}
This forum requires that you wait 120 seconds between posts. Please try again in 14 seconds.