\n problem or ?
#1

pawn Код:
if(strcmp(cmd, "/lockhouse", true) == 0)
{
tmp = strtok(cmdtext, idx);
new File:house1;
new pname[24];
new tmpstr[24];
house1 = fopen("house1.txt", io_read);
fread(house1,tmpstr);
GetPlayerName(playerid, pname, 24);
                if(!strcmp(pname,tmpstr,true))
                {
                  print("House1 lockcheckdone");
                  if(!strlen(tmp))
                    {
                                SendClientMessage(playerid,COLOR_WHITE,"USAGE: /lockhouse [1/0] || 1=locked, 0=unlocked");
                                return 1;
                    }
                  else if(strcmp(tmp,"0",true) == 0)
                    {
                      fclose(house1);
                      house1 = fopen("house1.txt", io_write);
                      new playername[MAX_PLAYER_NAME];
                        GetPlayerName(playerid, playername, sizeof(playername));
                        format(string, sizeof(string),"%s",playername);
                        fwrite(house1,string);
                      fwrite(house1,"Unlocked\n");
                        SendClientMessage(playerid,COLOR_HOUSE,"House is unlocked.");
                        return 1;
                    }
                    else if(strcmp(tmp,"1",true) == 0)
                    {
                      fclose(house1);
                      house1 = fopen("house1.txt", io_write);
                      new playername[MAX_PLAYER_NAME];
                        GetPlayerName(playerid, playername, sizeof(playername));
                        format(string, sizeof(string),"%s",playername);
                        fwrite(house1,string);
                        fwrite(house1,"Locked\n");
                        SendClientMessage(playerid,COLOR_HOUSE,"House is locked.");
                        return 1;
                    }else{
                      SendClientMessage(playerid,COLOR_WHITE,"USAGE: /lockhouse [1/0] || 1=locked, 0=unlocked");
                    }
                }
fclose(house1);
return 1;
}
The problem is, that when you do /lockhouse 1 - it writes :
LuxeonLocked

but it should write:
Luxeon
Locked

same shit happens with /lockhouse 0 - it writes:
LuxeonUnlocked instead of
Luxeon
Unlocked

Also i have noticed, that after i do /lockhouse 1/0 - the file house1.txt will be empty and cannot be edited till the server wont be closed. Any ideas? :S

All help is appreciated, thanks !

Your Luxeon
Reply


Messages In This Thread
\n problem or ? - by luxeon - 17.03.2009, 17:18
Re: \n problem or ? - by Rimeau - 17.03.2009, 17:21
Re: \n problem or ? - by Donny_k - 17.03.2009, 17:28
Re: \n problem or ? - by luxeon - 18.03.2009, 10:13

Forum Jump:


Users browsing this thread: 1 Guest(s)