22.06.2014, 08:52
i need a pawn code for whisper command /w
and for goto command
and for goto command
CMD:whisper(playerid,params[]) { new message,sendername[MAX_PLAYER_NAME],string[128]; if (sscanf(params, "s", message)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /(w)hisper [message]"); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, MAX_CHATBUBBLE_LENGTH, "Says: %s", message); SetPlayerChatBubble(playerid,string,MESSAGE_COLOR,35.0,10000); return 1; } CMD:w(playerid,params[]) { return cmd_whisper(playerid,params[]); }
CMD:whisper(playerid,params[])
{
new name[MAX_PLAYER_NAME],string[128],msg[128]; //Taking string arrays to store name, message and to format text.
if (sscanf(params, "s[128]", message)) //using sscanf to store the whispered text.
{
SendClientMessage(playerid, -1, "USAGE: /(w)hisper [message]"); //if the text is not stored in message.
return 1;
}
else
{
new Float:x,Float:y,Float:z; //variables to get player's position
GetPlayerPos(playerid, x, y, z); //getting the position
GetPlayerName(playerid, name, sizeof(name)); //getting the player's name
format(string,sizeof(string), "%s whispers: %s",name, message); //formating the text
for(new i=0;i<MAX_PLAYERS;i++) //looping
{
if(IsPlayerConnected(i)) //checking if players are connected.
{
if(IsPlayerInRangeOfPoint(i, 10.0, x, y, z); //checking the range so that we can display the whispered message
{
SendClientMessage(i,-1,string); //displaying the message to the players who are nearby to the sender.
}
}
}
}
return 1;
}
CMD:w(playerid, params[])
{
return cmd_whisper; //adding this, so that you can also whisper by using /w
}
try this for whisper
Код:
CMD:whisper(playerid,params[]) { new message,sendername[MAX_PLAYER_NAME],string[128]; if (sscanf(params, "s", message)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /(w)hisper [message]"); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, MAX_CHATBUBBLE_LENGTH, "Says: %s", message); SetPlayerChatBubble(playerid,string,MESSAGE_COLOR,35.0,10000); return 1; } CMD:w(playerid,params[]) { return cmd_whisper(playerid,params[]); } |