17.03.2009, 17:18
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;
}
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