SA-MP Forums Archive
/whisper [ID] [message] help! - 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: /whisper [ID] [message] help! (/showthread.php?tid=630496)



/whisper [ID] [message] help! - Imbalo - 15.03.2017

i saw many server makes whisper chat, like /whisper [ID] [message] and this chat only use in range 5m, Can you give me this script with sscanf?


Re: /whisper [ID] [message] help! - Toroi - 15.03.2017

I can give you the needed tools to make it

https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint
https://sampwiki.blast.hk/wiki/Control_S...res#for_.28.29
https://sampwiki.blast.hk/wiki/Fast_Commands


Re: /whisper [ID] [message] help! - Imbalo - 15.03.2017

Quote:
Originally Posted by Troydere
Посмотреть сообщение
thank for this solution but, i can't create this command because i newbie . I do not know much about it, Can you give me example this command please. So that I can learn to makes. Thank you


Re: /whisper [ID] [message] help! - Kane - 15.03.2017

Add this to get the players names;
Код:
stock GetName(playerid)
{
    new Name[MAX_PLAYER_NAME];

    if(IsPlayerConnected(playerid))
    {
		GetPlayerName(playerid, Name, sizeof(Name));
		strreplace(Name, '_', ' ');
	}
	else
	{
	    Name = "Disconnected/Nothing";
	}

	return Name;
}
Add these at the top of the script for the colors;
Код:
#define WHITE 			0xFFFFFFFF
#define SERVER            0xFF6347FF
#define YELLOW 			0xFFFF00FF
Command;
Код:
command(w, playerid, params[])
{
	new id, string[128], message[128];
	if(sscanf(params, "uz", id, message))
	{
		SendClientMessage(playerid, SERVER, "SERVER:{FFFFFF} /w(hisper) [Playerid] [Message]");
	}
	else
	{
 		if(IsPlayerConnectedEx(id) && GetDistanceBetweenPlayers(playerid, id))
		{
		    format(string, sizeof(string), "Whisper sent to %s: %s", GetName(id), message);
		    SendClientMessage(playerid, YELLOW, string);
		    format(string, sizeof(string), "%s whispers: %s", GetName(playerid), message);
		    SendClientMessage(id, YELLOW, string);
		}
		else
		{
		    SendClientMessage(playerid, WHITE, "You're too far away from that player.");
		}
	}
	return 1;
}
I'm also a beginner, sorry if it doesn't work right.


Re: /whisper [ID] [message] help! - Imbalo - 15.03.2017

I have 2 error
Quote:

D:\Server\filterscripts\RP_Commands.pwn(201) : error 017: undefined symbol "strreplace"
D:\Server\filterscripts\RP_Commands.pwn(219) : error 017: undefined symbol "IsPlayerConnectedEx"

how to fix this error ?


Re: /whisper [ID] [message] help! - Flamehaze7 - 15.03.2017

Quote:
Originally Posted by Imbalo
Посмотреть сообщение
I have 2 error


how to fix this error ?
You need to define what is "IsPlayerConnectedEx"

and for strreplace just go there: https://sampforum.blast.hk/showthread.php?tid=362764

I recommend you to not use the other people script but just make yourself one, you'll understand more by doing it yourself than copy-paste everything


Re: /whisper [ID] [message] help! - YouHack - 15.03.2017

Enjoy it
PHP код:
CMD:wisper(playeridparams[])
{
        new 
string[128],id,mess[250],giveplayer[25],sendername[25];
        if(
sscanf(params"us[250]",id,mess)) return SendClientMessage(playerid, -1"{FFFFFF}Syntax: {FFFFFF}/w <Name/Playerid> <Message>");
          if(
id != INVALID_PLAYER_ID)
          {
                if(
GetDistanceBetweenPlayers(playerid,id) > 5) return SendClientMessage(playerid,-1,"{FFFFCC}This player is not near you.");
                if(
id == playerid) return SendClientMessage(playerid, -1,"{FFB870}You can not send a message to yourself.");
                
GetPlayerName(playeridsendernamesizeof(sendername));
                
GetPlayerName(idgiveplayersizeof(giveplayer));
                
format(stringsizeof(string), "{00DBDB}%s whispers: %s"sendernamemess);
                
SendClientMessage(id, -1string);
                
format(stringsizeof(string), "{00DBDB}Whisper to %s: %s"giveplayermess);
                
SendClientMessage(playerid,  -1string);
                return 
1;
        }
}
alias:wisper("w"); 



Re: /whisper [ID] [message] help! - Imbalo - 15.03.2017

Thank's, Rep + for you all

But, have 2 error
Quote:

D:\Server\filterscripts\RP_Commands.pwn(192) : error 017: undefined symbol "GetDistanceBetweenPlayers"
D:\Server\filterscripts\RP_Commands.pwn(202) : warning 209: function "cmd_w" should return a value

how fix ?


Re: /whisper [ID] [message] help! - Dayrion - 15.03.2017

Quote:
Originally Posted by YouHack
Посмотреть сообщение
Enjoy it
PHP код:
CMD:wisper(playeridparams[])
{
        new 
string[128],id,mess[250],giveplayer[25],sendername[25];
        if(
sscanf(params"us[250]",id,mess)) return SendClientMessage(playerid, -1"{FFFFFF}Syntax: {FFFFFF}/w <Name/Playerid> <Message>");
          if(
id != INVALID_PLAYER_ID)
          {
                if(
GetDistanceBetweenPlayers(playerid,id) > 5) return SendClientMessage(playerid,-1,"{FFFFCC}This player is not near you.");
                if(
id == playerid) return SendClientMessage(playerid, -1,"{FFB870}You can not send a message to yourself.");
                
GetPlayerName(playeridsendernamesizeof(sendername));
                
GetPlayerName(idgiveplayersizeof(giveplayer));
                
format(stringsizeof(string), "{00DBDB}%s whispers: %s"sendernamemess);
                
SendClientMessage(id, -1string);
                
format(stringsizeof(string), "{00DBDB}Whisper to %s: %s"giveplayermess);
                
SendClientMessage(playerid,  -1string);
                return 
1;
        }
}
alias:wisper("w"); 
Quote:
Originally Posted by Imbalo
Посмотреть сообщение
Thank's, Rep + for you all

But, have 2 error


how fix ?
Well..
PHP код:
CMD:whisper(playeridparams[])
{
    new 
string[128],
        
playerName[MAX_PLAYER_NAME],
        
target,
        
Float:x,
        
Float:y,
        
Float:z;
    if(
sscanf(params"us[128]"targetstring))
        return 
SendClientMessage(playerid, -1"Syntax: /w <Name/Playerid> <Message>"); 
    if(!
IsPlayerConnected(target))
        return 
SendClientMessage(playerid, -1"This player is not connected.");
    if(
target == playerid)
        return 
SendClientMessage(playerid0xFFB870ff"You can not send a message to yourself.");
    
GetPlayerPos(playeridxyz);
    if(!
IsPlayerInRangeOfPoint(target3.0xyz))  
        return 
SendClientMessage(playerid0xFFFFCCff"This player is not near you.");
    
GetPlayerName(playeridplayerNamesizeof(playerName));
    
format(stringsizeof(string), "%s whispers: %s"playerNamestring); 
    
SendClientMessage(target0x00DBDBffstring);
    
GetPlayerName(targetplayerNamesizeof(playerName));
    
format(stringsizeof(string), "Whisper to %s: %s"playerNamestring); 
    
SendClientMessage(playerid0x00DBDBffstring);
    return 
1;

EDIT: Dutheil was faster than me >.<
Depuis quand Dutheil parcourt le forum de SAMP Anglais?


Re: /whisper [ID] [message] help! - Dutheil - 15.03.2017

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Depuis quand Dutheil parcourt le forum de SAMP Anglais?
Depuis toujours hйhй