public OnGameModeInit()
{
SetGameModeText("- City DM v1.0 -");
new string[128],File:spawnfile = fopen("CityDM/teams.ini",io_read);
while(fread(spawnfile,string))
{
sscanf(string,"p<,>s[15]dddds[30]",TeamInfo[TeamsCreated][TeamName],TeamInfo[TeamsCreated][TeamSkin],TeamInfo[TeamsCreated][TeamWeapon][0],TeamInfo[TeamsCreated][TeamWeapon][1],TeamInfo[TeamsCreated][TeamWeapon][2],TeamInfo[TeamsCreated][spawnfilename]);
TeamInfo[TeamsCreated][TeamCreated] = 1;
AddPlayerClass(TeamInfo[TeamsCreated][TeamSkin],0.0,0.0,0.0,0.0,TeamInfo[TeamsCreated][TeamWeapon][0],15000,TeamInfo[TeamsCreated][TeamWeapon][1],10000,TeamInfo[TeamsCreated][TeamWeapon][2],10000);
printf("CREATED A TEAM (Team %s) (%d)",TeamInfo[TeamsCreated][TeamName],TeamsCreated);
TeamsCreated ++;
}
fclose(spawnfile);
for(new i = 0; i < TeamsCreated; i ++)
{
new count = SpawnCount[i],file[30];
format(file,sizeof(file),"%s",TeamInfo[i][spawnfilename]);
print(file);
spawnfile = fopen(file,io_read);
while(fread(spawnfile,string))
{
sscanf(string,"p<,>ffff",Spawns[i][count][X],Spawns[i][count][Y],Spawns[i][count][Z],Spawns[i][count][A]);
printf("SPAWN ADDED (team %s) (%d) %.2f %.2f %.2f",TeamInfo[i][TeamName],i,Spawns[i][count][X],Spawns[i][count][Y],Spawns[i][count][Z]);
count ++;
}
fclose(spawnfile);
SpawnCount[i] = count;
}
return 1;
}
public OnGameModeInit()
{
SetGameModeText("- City DM v1.0 -");
new string[128],File:spawnfile = fopen("CityDM/teams.ini",io_read);
if (spawnfile)
{
while(fread(spawnfile,string))
{
sscanf(string,"p<,>s[15]dddds[30]",TeamInfo[TeamsCreated][TeamName],TeamInfo[TeamsCreated][TeamSkin],TeamInfo[TeamsCreated][TeamWeapon][0],TeamInfo[TeamsCreated][TeamWeapon][1],TeamInfo[TeamsCreated][TeamWeapon][2],TeamInfo[TeamsCreated][spawnfilename]);
TeamInfo[TeamsCreated][TeamCreated] = 1;
AddPlayerClass(TeamInfo[TeamsCreated][TeamSkin],0.0,0.0,0.0,0.0,TeamInfo[TeamsCreated][TeamWeapon][0],15000,TeamInfo[TeamsCreated][TeamWeapon][1],10000,TeamInfo[TeamsCreated][TeamWeapon][2],10000);
printf("CREATED A TEAM (Team %s) (%d)",TeamInfo[TeamsCreated][TeamName],TeamsCreated);
TeamsCreated ++;
}
fclose(spawnfile);
}
for(new i = 0; i < TeamsCreated; i ++)
{
new count = SpawnCount[i],file[30];
format(file,sizeof(file),"%s",TeamInfo[i][spawnfilename]);
print(file);
spawnfile = fopen(file,io_read);
if (spawnfile)
{
while(fread(spawnfile,string))
{
sscanf(string,"p<,>ffff",Spawns[i][count][X],Spawns[i][count][Y],Spawns[i][count][Z],Spawns[i][count][A]);
printf("SPAWN ADDED (team %s) (%d) %.2f %.2f %.2f",TeamInfo[i][TeamName],i,Spawns[i][count][X],Spawns[i][count][Y],Spawns[i][count][Z]);
count ++;
}
fclose(spawnfile);
}
SpawnCount[i] = count;
}
return 1;
}
EDIT: Make sure that scriptfiles folder is both readable/writeable (the permissions).
|
public OnGameModeInit()
{
SetGameModeText("- City DM v1.0 -");
new string[128], File:spawnfile;
if (!fexist("CityDM/teams.ini")) print("CityDM/teams.ini doesn't exist");
else
{
spawnfile = fopen("CityDM/teams.ini",io_read);
if (spawnfile)
{
while(fread(spawnfile,string))
{
sscanf(string,"p<,>s[15]dddds[30]",TeamInfo[TeamsCreated][TeamName],TeamInfo[TeamsCreated][TeamSkin],TeamInfo[TeamsCreated][TeamWeapon][0],TeamInfo[TeamsCreated][TeamWeapon][1],TeamInfo[TeamsCreated][TeamWeapon][2],TeamInfo[TeamsCreated][spawnfilename]);
TeamInfo[TeamsCreated][TeamCreated] = 1;
AddPlayerClass(TeamInfo[TeamsCreated][TeamSkin],0.0,0.0,0.0,0.0,TeamInfo[TeamsCreated][TeamWeapon][0],15000,TeamInfo[TeamsCreated][TeamWeapon][1],10000,TeamInfo[TeamsCreated][TeamWeapon][2],10000);
printf("CREATED A TEAM (Team %s) (%d)",TeamInfo[TeamsCreated][TeamName],TeamsCreated);
TeamsCreated ++;
}
fclose(spawnfile);
}
}
for(new i = 0; i < TeamsCreated; i ++)
{
new count = SpawnCount[i],file[30];
if (!fexist(TeamInfo[i][spawnfilename])) printf("%s doesn't exist", TeamInfo[i][spawnfilename]);
else
{
spawnfile = fopen(TeamInfo[i][spawnfilename],io_read);
if (spawnfile)
{
while(fread(spawnfile,string))
{
sscanf(string,"p<,>ffff",Spawns[i][count][X],Spawns[i][count][Y],Spawns[i][count][Z],Spawns[i][count][A]);
printf("SPAWN ADDED (team %s) (%d) %.2f %.2f %.2f",TeamInfo[i][TeamName],i,Spawns[i][count][X],Spawns[i][count][Y],Spawns[i][count][Z]);
count ++;
}
fclose(spawnfile);
SpawnCount[i] = count;
}
}
}
return 1;
}
public OnGameModeInit()
{
SetGameModeText("- City DM v1.0 -");
new string[128], File:spawnfile;
if (!fexist("CityDM/teams.ini")) print("CityDM/teams.ini doesn't exist");
else
{
spawnfile = fopen("CityDM/teams.ini",io_read);
if (spawnfile)
{
while(fread(spawnfile,string))
{
sscanf(string,"p<,>s[15]dddds[30]",TeamInfo[TeamsCreated][TeamName],TeamInfo[TeamsCreated][TeamSkin],TeamInfo[TeamsCreated][TeamWeapon][0],TeamInfo[TeamsCreated][TeamWeapon][1],TeamInfo[TeamsCreated][TeamWeapon][2],TeamInfo[TeamsCreated][spawnfilename]);
TeamInfo[TeamsCreated][TeamCreated] = 1;
AddPlayerClass(TeamInfo[TeamsCreated][TeamSkin],0.0,0.0,0.0,0.0,TeamInfo[TeamsCreated][TeamWeapon][0],15000,TeamInfo[TeamsCreated][TeamWeapon][1],10000,TeamInfo[TeamsCreated][TeamWeapon][2],10000);
//printf("CREATED A TEAM (Team %s) (%d)",TeamInfo[TeamsCreated][TeamName],TeamsCreated);
TeamsCreated ++;
}
fclose(spawnfile);
}
else print("invalid file handle -> CityDM/teams.ini");
}
for(new i = 0; i < TeamsCreated; i ++)
{
new count = SpawnCount[i],file[30];
if (!fexist(TeamInfo[i][spawnfilename])) printf("%s doesn't exist", TeamInfo[i][spawnfilename]);
else
{
spawnfile = fopen(TeamInfo[i][spawnfilename],io_read);
if (spawnfile)
{
while(fread(spawnfile,string))
{
sscanf(string,"p<,>ffff",Spawns[i][count][X],Spawns[i][count][Y],Spawns[i][count][Z],Spawns[i][count][A]);
//printf("SPAWN ADDED (team %s) (%d) %.2f %.2f %.2f",TeamInfo[i][TeamName],i,Spawns[i][count][X],Spawns[i][count][Y],Spawns[i][count][Z]);
count ++;
}
fclose(spawnfile);
SpawnCount[i] = count;
}
else printf("invalid file handle -> %s", TeamInfo[i][spawnfilename]);
}
}
return 1;
}