27.07.2012, 08:54
Hello! My deathmatch did not work, so I looked in my code.
Deathmatch.txt file looks like this:
The problem is, that sscanf 'thinks' that p<|>dddd can be also used for othes lines in Deathmatch.txt and not just for first one. How can I modify sscanf statement, so p<|>dddd load first line in file and p<|>dd loads the others?
Thanks.
pawn Код:
stock Load_Deathmatch(MapNumber)
{
new Count,Data[128];
new File: File = fopen("blabla//Deathmatch.txt",io_read);
while(fread(File,Data,sizeof(Data)))
{
if(!sscanf(Data,"p<|>dddd",Map[MapNumber][mDeathmatch_Mode],Map[MapNumber][mDeathmatch_Money],Map[MapNumber][mDeathmatch_Score],Map[MapNumber][mDeathmatch_Time]))
{
// 1|5000|3|3
Count = Count + 1;
Count = Count - 1;
//It is not working without these two 'useless' lines
}
else
{
if(!sscanf(Data,"p<|>dd",Map[MapNumber][mDeathmatch_Weapon_Model][Count],Map[MapNumber][mDeathmatch_Weapon_Ammo][Count]))
{
// 32,400
Count++;
}
else
{
Map[MapNumber][mError] = TRUE;
fclose(File);
return 0;
}
}
} fclose(File);
return 1;
}
Код:
0|2000|3|2 22|20 25|19 18|18 33|17 34|16
Thanks.