14.05.2014, 19:53
Listed as a command:
Command:
And at the bottom of script:
If I delete the stock WriteReportsLog(string[]) then it will say the player has been reported but when i check there is no file for reports.
if I keep that code then when I /report id reason nothing happens.
Код:
public OnPlayerCommandText(playerid, cmdtext[]) { dcmd(parch, 5, cmdtext); dcmd(jetpack, 7, cmdtext); dcmd(report, 6, cmdtext); dcmd(randomcolor, 11, cmdtext); dcmd(stats, 5, cmdtext); dcmd(commands, 8, cmdtext); return 1; }
Код:
dcmd_report(playerid, params[]) { new tmp[256], idx; tmp = strtok(params, idx); if(!strlen(tmp)){ SendClientMessage(playerid, 0x555252AA, "/report [id] [reason]"); return 1; }else{ new pid = strval(tmp); tmp = strrest(params, idx); if(!IsPlayerConnected(pid)){ SendClientMessage(playerid, 0x555252AA, "Invalid Player"); return 1; }else{ if(!strlen(tmp)){ SendClientMessage(playerid, 0x555252AA, "/report [id] [reason]"); return 1; }else{ new name[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME], string[200]; GetPlayerName(playerid, name, sizeof(name)); GetPlayerName(pid, name2, sizeof(name2)); format(string, sizeof(string), "*%s(%d) reported %s(%d) for '%s'", name, playerid, name2, pid, tmp); for(new i=0; i<GetMaxPlayers(); i++){ if(IsPlayerConnected(i)){ if(IsPlayerAdmin(i)){ SendClientMessage(i, 0x555252AA, string); } } } } } } return 1; }
Код:
stock WriteReportsLog(string[]) { if(!fexist("Reports.log")) dini_Create("Reports.log"); // You need to change dini_Create to your file creating system. new entry[255], File: hFile; format(entry, sizeof(entry), "%s\r\n", string); hFile = fopen("Reports.log", io_append); fwrite(hFile, entry); fclose(hFile); }
if I keep that code then when I /report id reason nothing happens.