"/report" command - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: "/report" command (
/showthread.php?tid=191151)
"/report" command -
Dolph - 18.11.2010
So I am trying to make a report command where the string gets saved in a text folder.
pawn Код:
dcmd_report(playerid, params[])
{
new pid,message[128];
if(sscanf(params,"us",pid,message)) return SendClientMessage(playerid, 0xF60000AA, "USAGE: /report [playerid] [message]");
if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, COLOUR_BROWN, "There is no player online with that id/name");
if(strlen(message) < 1 || strlen(message) > 128) return SendClientMessage(playerid, COLOUR_BROWN, "Invalid message length!");
else
{
new name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
GetPlayerName(pid,name2,sizeof(name2));
dini_Create("reports.txt");
dini_IntSet("reports.txt","%s reported %s for: %s",name,name2,message);
return 1;
}
}
I am pretty new at dini.
and I get this error btw
C:\GTA Server\gamemodes\MyDm.pwn(2165) : error 035: argument type mismatch (argument 3)
Re: "/report" command -
(SF)Noobanatior - 18.11.2010
have to format the message first then save it like
pawn Код:
new str[128];
if(!dini_Exists("reports.txt"))dini_Create("reports.txt");
format(str,sizeof(str),"reported %s for: %s",name2,message);
dini_Set("reports.txt",name,str);
something like that
but this way only one report per reportee but you get the idea
and dini_IntSet will set a intger
and dini_set is for a string i belive
and it should save a string that says
name=reported name2 for:message
with substitutions obviously