06.07.2015, 22:14
The issue is caused by a flaw in "InGameChatRemoveUnderscore(playerid)".
pawn Код:
// [ DEVELOPMENT GAMEMODE ]
// INCLUDES:
#include <a_samp>
#include <zcmd>
// DEFINES:
#define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
// MAIN:
main()
{
print("Development Mode: rp_name.amx");
}
// CALLBACKS:
public OnGameModeInit()
{
return 1;
}
public OnGameModeExit()
{
return 1;
}
// COMMANDS:
CMD:b(playerid, params[])
{
new string[144];
if(isnull(params)) return SendClientMessage(playerid, -1, "Usage: /b (message).");
format(string, sizeof(string), "%s: (( %s ))", ReplaceString("_", " ", PlayerName(playerid)), params);
SendClientMessageToAll(-1, string);
return 1;
}
// FUNCTIONS:
stock PlayerName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
return name;
}
stock ReplaceString(search[], replace[], source[])
{
new string[256], length;
for(new i = 0; i < strlen(source); i ++)
{
if(strlen(search) > 1 && i != (strlen(source) - 1))
{
new bool:match = false, start = i;
for(new j = 0; j < strlen(search) && !match; j ++)
{
if(source[i] != search[j] && j == 0)
{
string[length] = source[i];
match = true;
}
else
{
if(source[i] == search[j]) i ++;
else match = true;
}
}
if(match == true)
{
while(start <= i)
{
string[length] = source[start];
length ++;
start ++;
}
}
else
{
for(new j; j < strlen(replace); j ++)
{
string[length] = replace[j];
length ++;
}
i = (start + (strlen(search) - 1));
}
}
else
{
if(strlen(search) == 1 && source[i] == search[0])
{
for(new j; j < strlen(replace); j ++)
{
string[length] = replace[j];
length ++;
}
}
else
{
string[length] = source[i];
length ++;
}
}
}
string[length] = EOS;
return string;
}