Posts: 162
Threads: 61
Joined: Aug 2010
hi i want to make a command so i can save text into a.cfg file so if i like type /setmessage it will save what i said in the .cfg or if i do /checkmessage it will tell me what i save.
i can script it my self but i just need some one to put me on the right track and tell me what i will need to do this.
Posts: 162
Threads: 61
Joined: Aug 2010
so i have done and try to make a command for it and i got one error this is my command:
Code:
if(strcmp(cmd, "/leaveanote", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 1337)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /leaveanote [Note(TEXT)]");
return 1;
}
new note;
note = strvalEx(tmp);
{
new File:log = fopen("/adminnotes.txt", io_write);
fwrite(log, note);// this is line 27006
fclose(log);
format(string, sizeof(string), " You have left the note %s", note);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
}
}
return 1;
}
and this is my error:
Code:
C:\Users\Ryan\Desktop\World Wide RolePlay\gamemodes\WWRP.pwn(27006) : error 035: argument type mismatch (argument 2)
Posts: 162
Threads: 61
Joined: Aug 2010
Quote:
Originally Posted by Battleman
Maybe this will fix the error..
Code:
if(strcmp(cmd, "/leaveanote", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 1337)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /leaveanote [Note(TEXT)]");
return 1;
}
new note[255];
note = strvalEx(tmp);
new File:log = fopen("/adminnotes.txt", io_write);
fwrite(log, note);// this is line 27006
fclose(log);
format(string, sizeof(string), " You have left the note %s", note);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
}
return 1;
}
|
When i try what you did it gives me this error........
Code:
C:\Users\Ryan\Desktop\World Wide RolePlay\gamemodes\WWRP.pwn(27003) : error 033: array must be indexed (variable "note")
Posts: 407
Threads: 101
Joined: Feb 2009
Reputation:
0
Which line is the error one?
Posts: 162
Threads: 61
Joined: Aug 2010
Quote:
Originally Posted by sekol
Which line is the error one?
|
i have made a comment on the code where the error is
Look at my reply under where JamesC posted.