for(new i = 0, len = strlen(text); i < len; i++)
{
if(text[i] == '#')
{
i++;
if(text[i] == 'R')
{
text[i-1] = '{';
text[i] = 'F';
strins(text, "F0000}", i+1, 128);
}
else if(text[i] == 'G')
{
text[i-1] = '{';
text[i] = '0';
strins(text, "0FF00}", i+1, 128);
}
else if(text[i] == 'Y')
{
text[i-1] = '{';
text[i] = 'F';
strins(text, "FFF00}", i+1, 128);
}
else if(text[i] == 'B')
{
text[i-1] = '{';
text[i] = '0';
strins(text, "000FF}", i+1, 128);
}
print(text);
}
}
[16:46:05] [debug] Run time error 10: "Native function failed" [16:46:05] [debug] strins [16:46:05] [debug] AMX backtrace:
CMD:fakechat(playerid, params[])
{
new playa, cmd[128];
if(Admin(playerid) < 8) return SendClientMessage(playerid, COLOR_ERROR, "You are not allowed to use this command.");
if(sscanf(params, "us[128]", playa, cmd)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /fakechat [playerid/ part of name] [text]");
OnPlayerText(playa, cmd);
return 1;
}
You can't use "strins" on "text" - the variable isn't large enough to hold new data.
|