03.04.2013, 18:11
(
Last edited by leonardo1434; 03/04/2013 at 07:54 PM.
)
i've made that quickly, but should work properly.
For solving your second issue, about the player spawn. You should save in the players files, in which city they was in their last logins.
PHP Code:
stock GetLine(file[] , line = 0 , dest[] , size = sizeof dest) // in both errors, the passed string will be null;
{
new File:f_file = fopen(file,io_read);
if( ( !f_file || line < 0 ) && fclose(f_file) ) return 0; // When a file fails to open, it's closed.
for(new i_lines ; fread(f_file,dest,size) ; i_lines++)
{
if(line == i_lines)
{
fclose(f_file);
return 1;
}
}
fclose(f_file);
return -1;
}
// here it's an example of its usage.
switch(GetLine(file[],line,dest))
{
case -1:
{
print("line doesn't exist");
}
case 0:
{
print("couldn't handle the file or the line is invalid");
}
case 1:
{
print(dest);
}
}