15.03.2017, 08:14
Add this to get the players names;
Add these at the top of the script for the colors;
Command;
I'm also a beginner, sorry if it doesn't work right.
Код:
stock GetName(playerid) { new Name[MAX_PLAYER_NAME]; if(IsPlayerConnected(playerid)) { GetPlayerName(playerid, Name, sizeof(Name)); strreplace(Name, '_', ' '); } else { Name = "Disconnected/Nothing"; } return Name; }
Код:
#define WHITE 0xFFFFFFFF #define SERVER 0xFF6347FF #define YELLOW 0xFFFF00FF
Код:
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; }