This is mine.
//==========================================//
Command. You need to change the accent variable to what suites your server.
pawn Код:
CMD:accent(playerid,params[])
{
new accent;
if(sscanf(params,"i",accent))
{
SendClientMessage(playerid,COLOR_LIGHTGRAY,"USAGE: /accent [number]");
SendClientMessage(playerid,COLOR_LIGHTGRAY,"1:[American] 2:[Mexican] 3:[Russian]");
return 1;
}
if(accent > 3 || accent < 1)
{
SendClientMessage(playerid,COLOR_LIGHTGRAY,"Invalid number.");
return 1;
}
else
{
pInfo[playerid][pAccent] = accent;
if(accent == 1) return SendClientMessage(playerid,COLOR_WHITE,"You have switched to an American accent.");
else if(accent == 2) return SendClientMessage(playerid,COLOR_WHITE,"You have switched to a Mexican accent.");
else if(accent == 3) return SendClientMessage(playerid,COLOR_WHITE,"You have switched to a Russian accent.");
return 1;
}
}
OnPlayerText. (This is what does the Playername [Accent]: text)
pawn Код:
public OnPlayerText(playerid, text[])
{
new pname[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, pname, sizeof(pname));
strreplace(pname,'_',' ');
switch(pInfo[playerid][pAccent])
{
case 0:format(str, sizeof(str), "%s says: %s", pname, text);
case 1:format(str, sizeof(str), "[American Accent] %s says: %s", pname, text);
case 2:format(str, sizeof(str), "[Mexican Accent] %s says: %s", pname, text);
case 3:format(str, sizeof(str), "[Russian Accent] %s says: %s", pname, text);
}
ProxDetector(30.0, playerid, str, COLOR_WHITE);
return 0;
}
ProxDetector Function add this anywhere on the top of your script.
pawn Код:
stock ProxDetector(Float:radi, playerid, string[],color)
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
for(new player;player<MAX_PLAYERS;player++)
{
if(!IsPlayerConnected(playerid))continue;
if(IsPlayerInRangeOfPoint(player,radi,x,y,z)) SendClientMessage(player,color,string);
}
}