Report Administrator .txt Command?
#1

Ok, I wanna make a command that you type:


/reportadmin [id] [reason]

And it will save the reason in a .txt located in your script files.
Anyone have an idea on how to make a command like that?
Reply
#2

script request thread
Reply
#3

Quote:
Originally Posted by brett7
script request thread
?
Reply
#4

Quote:
Originally Posted by DeltaAirlines12
Quote:
Originally Posted by brett7
script request thread
?
http://forum.sa-mp.com/index.php?topic=114903.0
Reply
#5

....
Reply
#6

Quote:
Originally Posted by [TPG
Coole210 ]
pawn Code:
if(strcmp(cmd, "/report", true)==0) if(Logged[playerid] == 1)
{
    tmp = strtok(cmdtext,idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "[ ! ] USAGE: /report [playerid] [message]");
    new giveplayerid = strval(tmp);
    new length = strlen(cmdtext);
    while ((idx < length) && (cmdtext[idx] <= \' \'))
    {
    idx++;
    }
    new offset = idx;
    new result[64];
    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
    {
    result[idx - offset] = cmdtext[idx];
    idx++;
    }
    result[idx - offset] = EOS;
    if(!strlen(result))
    {
    SendClientMessage(playerid, COLOR_WHITE, "[ ! ] USAGE: /report [playerid] [message]");
    return 1;
    }
  new str[128];
  format(str, 128, "[REPORT] %s[%d] has reported %s[%d] for %s",PlayerName(playerid),playerid,PlayerName(giveplayerid),giveplayerid, result);
  for(new i; i<MAX_PLAYERS; i++){
  if(IsPlayerConnected(i) && IsPlayerAdmin(i)){
    SendClientMessage(i, COLOR_RED, str);
    new File: file = fopen("Reports.txt",io_read);
    if(!file){fcreate("Reports.txt");}
    format(str,sizeof(str),"[ ! ] %s has reported %s for %s
"
,PlayerName(playerid),PlayerName(giveplayerid),result);
    fwrite(file,str);
    fclose(file);
  }}
  SendClientMessage(playerid, COLOR_GREEN, "[ ! ] Report sent to online admins!");
  return 1;
}
Is that a basic report command that can be used to report people to admins normaly?
Reply
#7

Quote:
Originally Posted by DeltaAirlines12
Quote:
Originally Posted by [TPG
Coole210 ]
pawn Code:
if(strcmp(cmd, "/report", true)==0) if(Logged[playerid] == 1)
{
    tmp = strtok(cmdtext,idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "[ ! ] USAGE: /report [playerid] [message]");
    new giveplayerid = strval(tmp);
    new length = strlen(cmdtext);
    while ((idx < length) && (cmdtext[idx] <= \' \'))
    {
    idx++;
    }
    new offset = idx;
    new result[64];
    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
    {
    result[idx - offset] = cmdtext[idx];
    idx++;
    }
    result[idx - offset] = EOS;
    if(!strlen(result))
    {
    SendClientMessage(playerid, COLOR_WHITE, "[ ! ] USAGE: /report [playerid] [message]");
    return 1;
    }
  new str[128];
  format(str, 128, "[REPORT] %s[%d] has reported %s[%d] for %s",PlayerName(playerid),playerid,PlayerName(giveplayerid),giveplayerid, result);
  for(new i; i<MAX_PLAYERS; i++){
  if(IsPlayerConnected(i) && IsPlayerAdmin(i)){
    SendClientMessage(i, COLOR_RED, str);
    new File: file = fopen("Reports.txt",io_read);
    if(!file){fcreate("Reports.txt");}
    format(str,sizeof(str),"[ ! ] %s has reported %s for %s
"
,PlayerName(playerid),PlayerName(giveplayerid),result);
    fwrite(file,str);
    fclose(file);
  }}
  SendClientMessage(playerid, COLOR_GREEN, "[ ! ] Report sent to online admins!");
  return 1;
}
Is that a basic report command that can be used to report people to admins normaly?
Yes,if you read the code you will see that only admins will get the report
Reply
#8

Yes,if you read the code you will see that only admins will get the report
[/quote]

C:\Users\Dustin\Desktop\World War 3\gamemodes\WW3.pwn(195) : error 017: undefined symbol "Logged"
C:\Users\Dustin\Desktop\World War 3\gamemodes\WW3.pwn(195) : warning 215: expression has no effect
C:\Users\Dustin\Desktop\World War 3\gamemodes\WW3.pwn(195) : error 001: expected token: ";", but found "]"
C:\Users\Dustin\Desktop\World War 3\gamemodes\WW3.pwn(195) : error 029: invalid expression, assumed zero
C:\Users\Dustin\Desktop\World War 3\gamemodes\WW3.pwn(195) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#9

Quote:
Originally Posted by DeltaAirlines12
Yes,if you read the code you will see that only admins will get the report
C:\Users\Dustin\Desktop\World War 3\gamemodes\WW3.pwn(195) : error 017: undefined symbol "Logged"
C:\Users\Dustin\Desktop\World War 3\gamemodes\WW3.pwn(195) : warning 215: expression has no effect
C:\Users\Dustin\Desktop\World War 3\gamemodes\WW3.pwn(195) : error 001: expected token: ";", but found "]"
C:\Users\Dustin\Desktop\World War 3\gamemodes\WW3.pwn(195) : error 029: invalid expression, assumed zero
C:\Users\Dustin\Desktop\World War 3\gamemodes\WW3.pwn(195) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.
[/quote]

if(strcmp(cmd, "/report", true)==0) if(Logged[playerid] == 1)

Remove the bolded part.
Reply
#10

I removed the bolded part yet i get a TON of errors

C:\Documents and Settings\DAVID RAZ\Desktop\server\gamemodes\mine.pwn(19 : error 017: undefined symbol "tmp"
C:\Documents and Settings\DAVID RAZ\Desktop\server\gamemodes\mine.pwn(19 : error 017: undefined symbol "idx"
C:\Documents and Settings\DAVID RAZ\Desktop\server\gamemodes\mine.pwn(199) : error 017: undefined symbol "tmp"
C:\Documents and Settings\DAVID RAZ\Desktop\server\gamemodes\mine.pwn(200) : error 017: undefined symbol "tmp"
C:\Documents and Settings\DAVID RAZ\Desktop\server\gamemodes\mine.pwn(202) : error 017: undefined symbol "idx"
C:\Documents and Settings\DAVID RAZ\Desktop\server\gamemodes\mine.pwn(204) : error 017: undefined symbol "idx"
C:\Documents and Settings\DAVID RAZ\Desktop\server\gamemodes\mine.pwn(204) : warning 215: expression has no effect
C:\Documents and Settings\DAVID RAZ\Desktop\server\gamemodes\mine.pwn(206) : error 017: undefined symbol "idx"
C:\Documents and Settings\DAVID RAZ\Desktop\server\gamemodes\mine.pwn(20 : error 017: undefined symbol "idx"
C:\Documents and Settings\DAVID RAZ\Desktop\server\gamemodes\mine.pwn(210) : error 017: undefined symbol "idx"
C:\Documents and Settings\DAVID RAZ\Desktop\server\gamemodes\mine.pwn(211) : error 017: undefined symbol "idx"
C:\Documents and Settings\DAVID RAZ\Desktop\server\gamemodes\mine.pwn(211) : warning 215: expression has no effect
C:\Documents and Settings\DAVID RAZ\Desktop\server\gamemodes\mine.pwn(213) : error 017: undefined symbol "idx"
C:\Documents and Settings\DAVID RAZ\Desktop\server\gamemodes\mine.pwn(219) : warning 217: loose indentation
C:\Documents and Settings\DAVID RAZ\Desktop\server\gamemodes\mine.pwn(220) : error 017: undefined symbol "PlayerName"
C:\Documents and Settings\DAVID RAZ\Desktop\server\gamemodes\mine.pwn(225) : error 017: undefined symbol "fcreate"
C:\Documents and Settings\DAVID RAZ\Desktop\server\gamemodes\mine.pwn(226) : error 017: undefined symbol "PlayerName"

HELP
Reply
#11

....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)