One Question
#1

Hi all i want to ask how to make command that write and save text in some file in scriptfiles.
Ex.I want to make command /whish and when type /whish {text} to save that text in some file in scriptfiles.
Reply
#2

Wiki / y_INI or else
Reply
#3

I know how to save just playername, but how to make to save text that write in cmd ?
Reply
#4

This is from my Admin FilterScript : [FMGS]Admin

Quote:

if (strcmp(cmd, "/suggest", true) == 0)
{
new Usage[144] = "[USAGE] -|{FFFFFF} /suggest [{8F8F8F} message {FFFFFF}] {FF9900}|-";
new DONE[144] = "[FMGS]Admin -|{FFFFFF} Your suggest has been sent to the server owner {F6F600}| Thanks for your help |-";

new SpawnFile[128] = "/[FMGS]Admin/suggestions.sug";
new tmp[512]; tmp = strtok(cmdtext, idx);

if(!strlen(tmp)) return SendClientMessage(playerid, 0xFF9900FF, Usage);

strdel(cmdtext, 0, 9);
new Date[32] = "%02d/%02d/%02d", Day , Mounth, Year ;
new Time[32] = "%02d:%02d:%02d", Hour, Minute, Second;

getdate(Year, Mounth, Day),
gettime(Hour, Minute, Second);

format(Date, sizeof(Date), Date, Day , Mounth, Year );
format(Time, sizeof(Time), Time, Hour, Minute, Second );

new Entry[1024] = "From: %s | [%s][%s] | %s\n";
format(Entry, sizeof(Entry), Entry, GetName(playerid,1), Date, Time, cmdtext);

new File:FileID = fopen(SpawnFile, io_append);

if(FileID)
{
fwrite(FileID, Entry);
fclose(FileID);
}

return SendClientMessage(playerid, COLOR_YELLOW, DONE);
}

You need to edit some stuff REP++ please
Reply
#5

Can someone help me and make this command in ZCMD and sscanf i dont understand strcmp
Reply
#6

Код:
YCMD:whish(playerid, params[], help)
{
    #pragma unused help
    new whish[128-MAX_PLAYER_NAME-10]; // 5 cells lower cuz of extra chars
    if(sscanf(params, "s[128]", whish)) return SendClientMessage(playerid, -1, "Usage: /whish [text]");
    else if(strlen(whish) <= 10) return SendClientMessage(playerid, -1, "Please input more than 10 characters!");
    new pNm[24];
    GetPlayerName(playerid, pNm, 24);
    new string[128];
    format(string, 128, "|%s suggest: %s\n", pNm, whish);
    new File:sFile;
    sFile = fopen("whishes.txt", io_append);
    fwrite(sFile, string);
    fclose(sFile);
    return true;
}
Reply
#7

This is too easy.
pawn Код:
CMD:whish(playerid, params[])
{
    if(!strlen(params)) return 1;
    new str[150], File:myfile = fopen("file.txt", io_append);
    format(str, sizeof(str), "%s\r\n", params);
    fwrite(myfile, str);
    SendClientMessage(playerid, 0xFFFF00FF, "Input has been saved to a text file.");
    return 1;
}
Includes needed:
a_samp
zcmd
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)