problem with fexist - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: problem with fexist (
/showthread.php?tid=309179)
problem with fexist -
System64 - 06.01.2012
Hi guys
I have a problem, I started making my new filterscript, race system, now, in my /buildrace command I made a check if file of choose race already exist but it doesn't works, take a look on code
command:
pawn Код:
YCMD:buildrace(playerid, params[], help)
{
#pragma unused help
new name[50], rFile[128];
if(PlayerStartedBuildingRace[playerid] == true) return SendClientMessage(playerid, -1, "{F81414}> {FFFFFF}You allready started building race!");
if(sscanf(params, "s[128]", name)) return SendClientMessage(playerid, -1, "{F81414}< {FFFFFF}Usage: /buildrace [Name] {F81414}>");
format(string, sizeof(string), "S32_Race/%s.ini", name);
if(fexist(string)) return SendClientMessage(playerid, -1, "{F81414}> {FFFFFF}Race with that name already exist!");
format(rFile, sizeof(rFile), "S32_Race/%s.ini", name);
new INI: RaceFile = INI_Open(rFile);
INI_WriteString(RaceFile, "Name", name);
INI_WriteInt(RaceFile, "Type", 0);
INI_WriteInt(RaceFile, "Laps", 1);
INI_WriteFloat(RaceFile, "CP Size", 1.0);
INI_WriteInt(RaceFile, "Vehicle Model", 0);
INI_Close(RaceFile);
SendClientMessage(playerid, -1, "{B7FF00}> {FFFFFF}You started building race! {B7FF00}<");
PlayerStartedBuildingRace[playerid] = true;
return 1;
}
check:
pawn Код:
format(string, sizeof(string), "S32_Race/%s.ini", name);
if(fexist(string)) return SendClientMessage(playerid, -1, "{F81414}> {FFFFFF}Race with that name already exist!");
Re: problem with fexist -
rinori - 06.01.2012
pawn Код:
YCMD:buildrace(playerid, params[], help)
{
#pragma unused help
new name[50], rFile[128];
if(PlayerStartedBuildingRace[playerid] == true) return SendClientMessage(playerid, -1, "{F81414}> {FFFFFF}You allready started building race!");
if(sscanf(params, "s[128]", name)) return SendClientMessage(playerid, -1, "{F81414}< {FFFFFF}Usage: /buildrace [Name] {F81414}>");
format(string, sizeof(string), "S32_Race/%s.ini", name);
if(fexist(string)) return SendClientMessage(playerid, -1, "{F81414}> {FFFFFF}Race with that name already exist!");
else
{
format(rFile, sizeof(rFile), "S32_Race/%s.ini", name);
new INI: RaceFile = INI_Open(rFile);
INI_WriteString(RaceFile, "Name", name);
INI_WriteInt(RaceFile, "Type", 0);
INI_WriteInt(RaceFile, "Laps", 1);
INI_WriteFloat(RaceFile, "CP Size", 1.0);
INI_WriteInt(RaceFile, "Vehicle Model", 0);
INI_Close(RaceFile);
}
SendClientMessage(playerid, -1, "{B7FF00}> {FFFFFF}You started building race! {B7FF00}<");
PlayerStartedBuildingRace[playerid] = true;
return 1;
}
Untested
Re: problem with fexist -
System64 - 06.01.2012
thanks for help but fuck ini, MySQL ftw!!!