Saving text into files then loading them up afterwards
#2

Well heres a /suggest command i have in my script.




Code:
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;
}

It saves the Players name, there IP and the suggestion into a textfile in scriptfiles folder.


Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)