15.01.2015, 17:51
Hello im using Quick Stringsm and i got bug in it some pictures are given below.
when i type /me $loc

result..

it shows message to times.. but i want to send one time also with Player Name and ID.
when i type /me $loc

result..

it shows message to times.. but i want to send one time also with Player Name and ID.
My Code..
strings code..
pawn Код:
CheckQuickStrings(playerid, text[])
{
new idx = strfind(text, "$");
if(idx != -1)
{
new string[144];
strcat(string, text);
do
{
if(strcmp(string[idx], "$loc", true, 4) == 0)
{
new zone[MAX_ZONE_NAME];
GetPlayer2DZone(playerid, zone, MAX_ZONE_NAME);
strdel(string, idx, idx + 4);
strins(string, zone, idx);
continue;
}
else
if(strcmp(string[idx], "$cash", true, 5) == 0)
{
new pmoney[70];
format(pmoney, sizeof(pmoney), "$%d",GetPlayerCash(playerid));
strdel(string, idx, idx + 5);
strins(string, pmoney, idx);
continue;
}
else
if(strcmp(string[idx], "$ply", true, 4) == 0)
{
new closeststr[100], closestplayer = GetPlayerWhoIsClosest(playerid);
if(IsPlayerConnected(closestplayer))
format(closeststr, sizeof(closeststr), "%s (%d)",PlayerInfo[closestplayer][pName],closestplayer);
else
format(closeststr, sizeof(closeststr), "%s (%d)",PlayerInfo[playerid][pName], playerid);
strdel(string, idx, idx + 4);
strins(string, closeststr, idx);
continue;
}
}
while((idx = strfind(string, "$", false, idx + 1)) != -1);
SendPlayerMessageToAll(playerid, string);
}
return 1;
}
pawn Код:
COMMAND:me(playerid, params[])
{
return cmd_say(playerid, params);
}
COMMAND:say(playerid, params[])
{
if (PlayerInfo[playerid][pSpawned] == 1)
{
new idx,string[256],length = strlen(params);
while ((idx < length) && (params[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[512];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = params[idx];
idx++;
}
result[idx - offset] = EOS;
if(stringContainsIP(result))
{
SendClientMessage(playerid,COLOR_ERROR,"Invalid Message.");
return 1;
}
if (PlayerInfo[playerid][pMuted] == 1)
{
SendClientMessage(playerid,COLOR_ERROR,"#Error: You Muted.");
return 1;
}
if (!strlen(result))
{
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /me (message).");
return 1;
}
format(string, sizeof(string), "%s (%d): %s",PlayerInfo[playerid][pName], playerid, result);
CheckQuickStrings(playerid, result);
SendClientMessageToAll(GetPlayerColor(playerid), string);
}else{
SendClientMessage(playerid, COLOR_ERROR, "You Cannot Use This Command When You're Dead.");
}
return 1;
}
helper will get +rep