SA-MP Forums Archive
Saving text into files then loading them up afterwards - 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: Saving text into files then loading them up afterwards (/showthread.php?tid=140636)



Saving text into files then loading them up afterwards - Cardinaal - 09.04.2010

Hello.
I would like to have a system when a player does /report (id) (reason).. it saves in a file, then after an admin comes ingame he can check /reports.
Also it would be used for /idea (The idea).

If somebody could make me a little script it would be really appriciated.
Thanks.


Re: Saving text into files then loading them up afterwards - ruckfules99 - 09.04.2010

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.





Re: Saving text into files then loading them up afterwards - Cardinaal - 09.04.2010

That is usefull, thanks.
How could I redirect it for admins to see ingame?
So it would be /showsuggestions.


Re: Saving text into files then loading them up afterwards - Cardinaal - 10.04.2010

Quote:
Originally Posted by ruckfules99
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.


pawn Code:
C:\Users\USER\Desktop\Pawno\gamemodes\script.pwn(665) : error 017: undefined symbol "cmd"
C:\Users\USER\Desktop\Pawno\gamemodes\script.pwn(672) : error 017: undefined symbol "idx"
C:\Users\USER\Desktop\Pawno\gamemodes\script.pwn(674) : error 017: undefined symbol "idx"
C:\Users\USER\Desktop\Pawno\gamemodes\script.pwn(674) : warning 215: expression has no effect
C:\Users\USER\Desktop\Pawno\gamemodes\script.pwn(676) : error 017: undefined symbol "idx"
C:\Users\USER\Desktop\Pawno\gamemodes\script.pwn(678) : error 017: undefined symbol "idx"
C:\Users\USER\Desktop\Pawno\gamemodes\script.pwn(680) : error 017: undefined symbol "idx"
C:\Users\USER\Desktop\Pawno\gamemodes\script.pwn(681) : error 017: undefined symbol "idx"
C:\Users\USER\Desktop\Pawno\gamemodes\script.pwn(681) : warning 215: expression has no effect
C:\Users\USER\Desktop\Pawno\gamemodes\script.pwn(683) : error 017: undefined symbol "idx"
C:\Users\USER\Desktop\Pawno\gamemodes\script.pwn(690) : error 017: undefined symbol "szstring"
C:\Users\USER\Desktop\Pawno\gamemodes\script.pwn(690) : error 017: undefined symbol "szstring"
C:\Users\USER\Desktop\Pawno\gamemodes\script.pwn(690) : error 029: invalid expression, assumed zero
Can you add your defines please?


Re: Saving text into files then loading them up afterwards - Cardinaal - 10.04.2010

*BUMP BUMP
Sorry for bumping but I need this


Re: Saving text into files then loading them up afterwards - Cank - 10.04.2010

OnPlayerCommandText:

Code:
new idx;
new cmd=strtok(cmdtext, idx);
most of the errors should disappear.


Re: Saving text into files then loading them up afterwards - Cardinaal - 10.04.2010

Quote:
Originally Posted by Cank
OnPlayerCommandText:

Code:
new idx;
new cmd=strtok(cmdtext, idx);
most of the errors should disappear.
When I add that my pawno won't compile and crashes.


Re: Saving text into files then loading them up afterwards - Cank - 10.04.2010

youre using dcmd or something like that?