if(strcmp(cmd, "/pm", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "Type: /pmtoplayer [ID] [text]"); return 1; } giveplayerid = strval(tmp); if (IsPlayerConnected(giveplayerid)) { if(giveplayerid!= INVALID_PLAYER_ID) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[256]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /pm [playerid/PartOfName] [text]"); return 1; } for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(PlayerInfo[i][aigm] == 1) { format(string, sizeof(string), "* Pm from %s(ID: %d): %s", PlayerName(playerid), playerid, (result)); SendClientMessage(giveplayerid, COLOR_YELLOW, string); } } } format(string, sizeof(string), "* Pm for %s(ID: %d): %s", giveplayer, giveplayerid, (result)); SendClientMessage(playerid, COLOR_YELLOW, string); return 1; } } } return 1; }
When someone sent me a PM, I sent him 3 times, not as they should, 1. This happened after I put JunkBuster 11 and 0.3d
Edit: and I remove AllowAdminTeleport(1); Код:
if(strcmp(cmd, "/pm", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "Type: /pmtoplayer [ID] [text]"); return 1; } giveplayerid = strval(tmp); if (IsPlayerConnected(giveplayerid)) { if(giveplayerid!= INVALID_PLAYER_ID) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[256]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /pm [playerid/PartOfName] [text]"); return 1; } for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(PlayerInfo[i][aigm] == 1) { format(string, sizeof(string), "* Pm from %s(ID: %d): %s", PlayerName(playerid), playerid, (result)); SendClientMessage(giveplayerid, COLOR_YELLOW, string); } } } format(string, sizeof(string), "* Pm for %s(ID: %d): %s", giveplayer, giveplayerid, (result)); SendClientMessage(playerid, COLOR_YELLOW, string); return 1; } } } return 1; } |
if(strcmp(cmd, "/pm", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Type: /pmtoplayer [ID] [text]");
return 1;
}
giveplayerid = strval(tmp);
if (IsPlayerConnected(giveplayerid))
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[256];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /pm [playerid] [text]");
return 1;
}
if(PlayerInfo[giveplayerid][aigm] == 1)
{
format(string, sizeof(string), "* Pm from %s(ID: %d): %s", PlayerName(playerid), playerid, (result));
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
}
format(string, sizeof(string), "* Pm for %s(ID: %d): %s", giveplayer, giveplayerid, (result));
SendClientMessage(playerid, COLOR_YELLOW, string);
return 1;
}
}
return 1;
}