Saving text into files then loading them up afterwards
#1

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.
Reply
#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
#3

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

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?
Reply
#5

*BUMP BUMP
Sorry for bumping but I need this
Reply
#6

OnPlayerCommandText:

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

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.
Reply
#8

youre using dcmd or something like that?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)