if (strcmp("/report", cmdtext, true, 10) == 0) { new str[200]; new idx; GetPlayerName(playerid, str, 24); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[96]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /report [ID] [Reason]"); format(str, sizeof str, "Report from [%d] %s: %s", playerid, str, result); for(new i = 0; i < MAX_PLAYERS; i ++) { if(IsPlayerAdmin(i)) SendClientMessage(i, 0xFFFF00FF, str); } SendClientMessage(playerid, 0xFFFF00FF, "Your report message was sent to online administrators, thank you."); SendClientMessage(playerid, 0xFFFF00FF, "We will find a solution soon. We will let you know what we did."); return 1; }
if(strcmp(cmd, "/report", true) == 0)
{
new str[256], idx, n[24], n2[24];
str = strtok(cmdtext, idx);
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[96];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result) || !strlen(str)) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /report [id] [reason]");
if(!IsPlayerConnected(strval(str) || strval(str) == INVALID_PLAYER_ID) return SendClientMessage(plaeyrid, 0xFF0000FF, "INVALID ID.");
GetPlayerName(playerid, n, 24);
GetPlayerName(strval(str), n2, 24);
format(str, sizeof str, "%s [%d] was reported by %s [%d] | Reason: %s", n2, strval(str), str, playerid, result);
for(new i = 0; i < MAX_PLAYERS; i ++) { if(IsPlayerAdmin(i)) SendClientMessage(i, 0xFFFF00FF, str); }
SendClientMessage(playerid, 0xFFFF00FF, "Your report message was sent to online administrators, thank you.");
return 1;
}
b) Do not bump Some people apparently think they are important enough to bump their own topic after 10 minutes. You can bump topics when the last reply is at least 48 hours old, and it needs to have useful information about your problem. |
#include <sa-mp>
#include <zcmd>
OnPlayerCommandText(..........)
{
return 1;
}
////// MY COMMANDS
CMD:report(playerid, params[])
{
new targetid, reason,message[50];
if(!sscanf(params, "is", targetid,reason))
format(message, sizeof message, "Report from [%i] %i: %s", playerid, targetid, reason);
SendClientMessage(playerid, 0xFFFF00FF, "Your report message was sent to online administrators, thank you.");
SendClientMessage(playerid, 0xFFFF00FF, "We will find a solution soon. We will let you know what we did.");
return 1;
}
CMD:.....
CMD:.....
if(strcmp(cmd, "/report", true) == 0)
{
new str[256], idx, n[24], n2[24];
str = strtok(cmdtext, idx);
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[96];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result) || !strlen(str)) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /report [id] [reason]");
if(!IsPlayerConnected(strval(str)) || strval(str) == INVALID_PLAYER_ID) return SendClientMessage(plaeyrid, 0xFF0000FF, "INVALID ID.");
GetPlayerName(playerid, n, 24);
GetPlayerName(strval(str), n2, 24);
format(str, sizeof str, "%s [%d] was reported by %s [%d] | Reason: %s", n2, strval(str), str, playerid, result);
for(new i = 0; i < MAX_PLAYERS; i ++) { if(IsPlayerAdmin(i)) SendClientMessage(i, 0xFFFF00FF, str); }
SendClientMessage(playerid, 0xFFFF00FF, "Your report message was sent to online administrators, thank you.");
return 1;
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}