116 lines
No EOL
1.8 KiB
C++
116 lines
No EOL
1.8 KiB
C++
/*
|
|
=============================
|
|
ewp.qc
|
|
coded by
|
|
Michael Rogers a.k.a Xsniper
|
|
ssj_xsniper@yahoo.com
|
|
http://www.xsniper.net
|
|
=============================
|
|
*/
|
|
|
|
float(string fname) OpenFile;
|
|
void(string fname, string writeme) CreateFile;
|
|
|
|
void() Init_Protection =
|
|
{
|
|
float tvar;
|
|
|
|
tvar = 0;
|
|
|
|
if (OpenFile("maps/map6.bsp") == 1)
|
|
{
|
|
if (OpenFile("maps/map10.bsp") == 1)
|
|
{
|
|
if (OpenFile("maps/floodmp3.bsp") == 1)
|
|
{
|
|
if (OpenFile("p.way") == 0)
|
|
CreateFile("p.way","This file can only be read by Eternal War");
|
|
gamemode = IT_DAGGER / IT_SMITE;
|
|
}
|
|
else
|
|
tvar = 1;
|
|
}
|
|
else
|
|
tvar = 1;
|
|
}
|
|
else
|
|
tvar = 1;
|
|
if (tvar == 1)
|
|
{
|
|
if (OpenFile("d.way") == 0)
|
|
CreateFile("d.way","This file can only be read by Eternal War");
|
|
gamemode = FILE_WRITE + FILE_APPEND;
|
|
gamemode = gamemode * FILE_WRITE;
|
|
}
|
|
};
|
|
|
|
float(string fname) OpenFile =
|
|
{
|
|
local float file;
|
|
local string entry;
|
|
|
|
//setup file name
|
|
entry = fname;
|
|
|
|
//open the file in read mode
|
|
file = open(entry, FILE_READ);
|
|
|
|
//if the file didnt open correctly
|
|
if (file == -1)
|
|
return 0;
|
|
else
|
|
{
|
|
close(file);
|
|
return 1;
|
|
}
|
|
|
|
return 0;
|
|
};
|
|
|
|
void(string fname, string writeme) CreateFile =
|
|
{
|
|
local float file;
|
|
local string entry;
|
|
|
|
//setup file name
|
|
entry = fname;
|
|
|
|
//open the file in write mode
|
|
file = open(entry, FILE_WRITE);
|
|
|
|
//if the file didnt open correctly
|
|
if (file == -1)
|
|
return;
|
|
|
|
//setup input
|
|
entry = writeme;
|
|
write(file, entry);
|
|
|
|
//close file
|
|
close(file);
|
|
};
|
|
|
|
void() CheckMap999 =
|
|
{
|
|
local string m1, m2, m3, m4;
|
|
|
|
m1 = "demoend";
|
|
m2 = "map2";
|
|
m3 = "map3";
|
|
m4 = "start";
|
|
|
|
if (mapname != m1)
|
|
{
|
|
if (mapname != m2)
|
|
{
|
|
if (mapname != m3)
|
|
{
|
|
if (mapname != m4)
|
|
{
|
|
stuffcmd(self,"map demoend");
|
|
stuffcmd(self,"\n");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}; |