
)stock Log(const string[])
{
new File:log;
log = fopen("suggest.log",io_append);
fwrite(log, string);
fclose(log);
return 1;
}
|
Originally Posted by [MFC
Sylar [[::TheMafia::]] ]
thx but.. i don't know how to use it in dcmd ![]() |
dcmd_suggest(playerid, params[])
{
new string[128];
if (sscanf(params, "s", string)) SendClientMessage(playerid, 0xC0C0C0FF, "USAGE: /suggest [text]");
else
{
new File:handle = fopen("suggestions.txt", io_append);
format(string, 128, "%s\r\n", string);
fwrite(handle, string);
fclose(handle);
SendClientMessage(playerid, 0xC0C0C0FF, "Suggestion Send");
}
return 1;
}
dcmd_suggest(playerid, params[])
{
new string[128];
if (sscanf(params, "s", string))
{
new File:handle = fopen("suggestions.txt", io_append);
format(string, 128, "%s\r\n", string);
fwrite(handle, string);
fclose(handle);
SendClientMessage(playerid, 0xC0C0C0FF, "Suggestion Send");
}
else
{
SendClientMessage(playerid, 0xC0C0C0FF, "USAGE: /suggest [text]");
}
return 1;
}
dcmd_suggest(playerid, params[])
{
new string[128];
if (sscanf(params, "s", string))
{
new File:handle = fopen("suggestions.txt", io_append);
new Year, Month, Day, Hour, Min, Sec, pName[25], pIP[20];
GetDate(Month, Day, Hour);
GetTime(Day, Min, Sec);
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerIp(playerid, pIP, sizeof(pIP));
format(string, 128, "|%d/%d|%d:%d|%s: %s|(%s)|\r\n", Day, Month, Hour, Min, pName, string, pIP);
fwrite(handle, string);
fclose(handle);
SendClientMessage(playerid, 0xC0C0C0FF, "Suggestion Send");
}
else
{
SendClientMessage(playerid, 0xC0C0C0FF, "USAGE: /suggest [text]");
}
return 1;
}
://======[Script/GM Beggining]=======//
.....
//======[CommandText]===========//
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(suggest,7,cmdtext);
}
//======[DCMD Command]=========//
dcmd_suggest(playerid, params[])
{
new string[128];
if (sscanf(params, "s", string))
{
new File:handle = fopen("suggestions.txt", io_append);
new Month, Day, Hour, Minute, Second, Year, pName[25], pIP[20];
gettime(Hour, Minute, Second);
getdate(Year, Month, Day);
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerIp(playerid, pIP, sizeof(pIP));
format(string, 128, "|%d/%d|%d:%d|%s: %s |(%s)|\r\n", Day, Month, Hour, Minute, pName, string, pIP);
fwrite(handle, string);
fclose(handle);
SendClientMessage(playerid, 0xC0C0C0FF, "Suggestion Send!");
}
else
{
SendClientMessage(playerid, 0xC0C0C0FF, "USAGE: /suggest [suggestions/whatever]");
}
return 1;
}
//======[Script/GM End]=============//
|8/5|20:0|[MFC]Sylar: Thank You for the Help! |(127.0.0.1)| |8/5|20:1|[MFC]Sylar: blablablabla |(127.0.0.1)| |8/5|20:1|[MFC]Sylar: Goodbye |(127.0.0.1)|
, for example "GetTime(Day, Min, Sec)" has no sence at all, i changed it to "GetTime(Hour, Minute, Second);".|
Originally Posted by Cardinaal
Hey sorry for posting in this old topic.
I tried to use that script. It saves alright. The problem is when i type: /suggest.. It replies Suggestion Sent! and saves a empy suggestion in suggestions.txt but when i type /suggest Better streamer(example) it replies: USAGE: /suggest [text]. I don't know how to fix that, sorry. It should reply: USAGE /suggest [text] if you type only /suggest But now it replies USAGE /suggest [text] if you type /suggest You need this bla bla bla Help please? |
if(strcmp(cmd, "/suggest", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
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_BLUE, "USAGE: /suggest [text]");
return 1;
}
new ip[16]; GetPlayerIp(playerid, ip, sizeof(ip));
format(szstring, sizeof(szstring), "name: %s, IP: %s, Suggestion: %s.",sendername,ip,(result));
SendClientMessage(playerid, COLOR_YELLOW, szstring);
Suggestions(szstring);
}
return 1;
}