Help makeing a /idea command -
robin13 - 09.01.2010
Hi guys... I have two dmcd commands, /idea and /ideas.
/idea:
pawn Код:
dcmd_idea(playerid,params[]) {
new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /Idea [Your Player ID] [YOUR IDEA]");
if(strlen(params) > 7) {
new ideaer[MAX_PLAYER_NAME], str[128], hour,minute,second; gettime(hour,minute,second);
GetPlayerName(playerid, ideaer, sizeof(ideaer));
format(str, sizeof(str), "|NEWIDEA| %s (%s) |%d:%d:%d|", ideaer,params[strlen(tmp)+1], hour,minute,second);
MessageToAdmins(COLOR_WHITE,str);
SaveToFile("IdeaLog",str);
format(str, sizeof(str), "Idea: %s (%s) |%d:%d:%d|", ideaer,params[strlen(tmp)+1], hour,minute,second);
for(new i = 1; i < MAX_IDEAS-1; i++) Ideas[i] = Ideas[i+1];
Ideas[MAX_IDEAS-1] = str;
return SendClientMessage(playerid,yellow, "Your Idea has been sent to online administrators.");
} else return SendClientMessage(playerid,red,"ERROR: Must be a valid Idea, /Idea [Your Player ID] [YOUR IDEA]");
}
/ideas:
pawn Код:
dcmd_ideas(playerid,params[]) {
#pragma unused params
if(PlayerInfo[playerid][Level] >= 1) {
new IdeaCount;
for(new i = 1; i < MAX_IDEAS; i++)
{
if(strcmp( Ideas[i], "<none>", true) != 0) { IdeaCount++; SendClientMessage(playerid,COLOR_WHITE,Ideas[i]); }
}
if(IdeaCount == 0) SendClientMessage(playerid,COLOR_WHITE,"There have been no Ideas");
} else SendClientMessage(playerid,red,"ERROR: You need to be level 1 to use this command");
return 1;
}
I also have a command that save the text to a file:
pawn Код:
forward SaveToFile(filename[],text[]);
public SaveToFile(filename[],text[])
{
#if defined SAVE_LOGS
new File:LAdminfile, filepath[256], string[256], year,month,day, hour,minute,second;
getdate(year,month,day); gettime(hour,minute,second);
format(filepath,sizeof(filepath),"ladmin/logs/%s.txt",filename);
LAdminfile = fopen(filepath,io_append);
format(string,sizeof(string),"[%d.%d.%d %d:%d:%d] %s\r\n",day,month,year,hour,minute,second,text);
fwrite(LAdminfile,string);
fclose(LAdminfile);
#endif
return 1;
}
( Note: I am not (using/dont have/dont know how to get) this in my gamemode: LAdmin, PlayerInfo, MessageToAdmins. )
My problem is that i want them in "if(strcmp(cmdtext, "/idea", true) == 0)", and "if(strcmp(cmdtext, "/ideas", true) == 0)", but when i try, nothing gets in the file...
I also think this code is too complicated, i mean it is not easy to find out what is what in that code.
So i am requersting some help to make it more simple and maybe if you also could help me to build in a load/save file function.
Thanks for your time to read this, Robin.
P.S. If theres something i havent explained, or theres something you dont understand, then just ask and i will try to explain/use other words...
Re: Help makeing a /idea command -
robin13 - 09.01.2010
How can i find out is my server running linux or windows?
Re: Help makeing a /idea command -
robin13 - 09.01.2010
It's ServerFFS... Okay i will ask then and then i will return.
Edit: Thay said "Mack: All our servers run on Linux, Debian 5.".
Re: Help makeing a /idea command -
robin13 - 09.01.2010
Do you know if theres at filterscript that can do that sort of things to linux...?
If you dont know that then i just gonna thank you for your time you spent on trying to help me.
Re: Help makeing a /idea command -
robin13 - 09.01.2010
i made a supportchat to get help. Heres the output of the chat:
Код:
Rita: Welcome to our Live Support, my name is Rita and I can assist you in english and dutch. How may I help you?
You: Hi, this is Robin Lilfelt. I was talking with mack a about that server you use is linux...
Rita: That's correct.
You: and i have heard that in a linux server running SA-MP cant save files to the server...
Rita: That is untrue. They can save files just fine.
You: i mean the sa-mp script cant save local scriptfiles to store things like the users in the server etc.
Rita: It can. There is no difference between a Windows server and a Linux server for SA-MP regarding it's functionality.
You: Source: http://forum.sa-mp.com/index.php?topic=144961.0
You: Okay, but it cant be stored... maybe thats just a flult that i scripted wrong then
Rita: That is probably it. Take into consideration that Linux is a case-sensitive operating system.
Rita: hEllo.txt is not the same as hello.txt
You: oh okay. thanks for the help, i will try to find out. And thanks for a nice support system :)
Rita: You're very welcome.
So how about that "case-sensitive" thing... could that be the answer?