Author Topic: Can't Create files  (Read 3471 times)

0 Members and 2 Guests are viewing this topic.

Offline M4Carbine

  • Street Thug
  • *
  • Posts: 2
    • View Profile
Can't Create files
« on: February 05, 2010, 06:16:01 pm »
I just wanted to try making a simplest script using Files.
I wanted to make a script that writes " mode=1" in a GameMode.ini file, which is present in GAME FILE.

The problem I face is :
Script doesn't make a GAME file and its sub-file GameMode.ini
Please help :(
Here is the code:
Code: [Select]

//files Declerations
#define GAME_FILE           "/mode/%s"
#define GameMode            "/mode/GAME/GameMode"

new file[128];

//commands starts here
if (strcmp(cmd, "modeon", true) == 0) {
format(file,sizeof(file),GAME_FILE,GameMode);
    if(dini_Exists(file)) {
    SendClientMessage(playerid, COLOR_RED, "FILE IS ALREADY CREATED");
    dini_Set(file,"mode", "1");
    }
    else {
    dini_Create(file);
    SendClientMessage(playerid, COLOR_GREEN, "FILE IS NOW CREATED");
    dini_Set(file,"mode", "1");
    }
SendClientMessage(playerid, COLOR_GREEN, "GAME MODE STARTED");
}

Offline thijn

  • LU testers
  • VC:MP Veteran
  • *
  • Posts: 667
  • Im proud to be pro.
    • View Profile
    • Vice Underdogs
Re: Can't Create files
« Reply #1 on: February 05, 2010, 07:47:21 pm »
You're sure you've created the mode folder in your Gamemodes folder? And also the GAME folder in the mode folder?

EDIT: By looking at
Code: [Select]
format(file,sizeof(file),GAME_FILE,GameMode)
I guess it will look for the file called: /mode/mode/GAME/GameMode (yes double /mode)

not /mode/GAME/GameMode.ini

(Although i've never scripted in pawno I think this is what is going wrong)
« Last Edit: February 05, 2010, 07:50:21 pm by thijn »

Offline ClaN_Tai

  • Street Thug
  • *
  • Posts: 10
    • View Profile
Re: Can't Create files
« Reply #2 on: February 05, 2010, 09:24:03 pm »
Easy... as long there is no file type it cannot make it :)
You want him to create a file without any type, so it
does not create it...

Just change:
Code: [Select]
#define GameMode            "/mode/GAME/GameMode"
To:
Code: [Select]
#define GameMode            "/mode/GAME/GameMode.ini"
And it should create the file... Just don't to forget what type it should have,
you can even found an own one... .myfile, .gm, .... etcetera.

Offline M4Carbine

  • Street Thug
  • *
  • Posts: 2
    • View Profile
Re: Can't Create files
« Reply #3 on: February 05, 2010, 10:48:58 pm »
I used .ini at the end just as you said, but its still not making files and folders.

I made GAME folder manually too but still I am not able to figure out why scripts are not making .ini file.

BTW where will it make the file in my GTA VC Folder?

1. -->in C:/GTA VC/scriptfiles/mode/GAME ?
2. -->or somewhere else?

Offline ClaN_Tai

  • Street Thug
  • *
  • Posts: 10
    • View Profile
Re: Can't Create files
« Reply #4 on: February 07, 2010, 02:46:54 am »
[...]/scriptfiles/mode/mode/GAME/GameMode.ini :)

Offline thijn

  • LU testers
  • VC:MP Veteran
  • *
  • Posts: 667
  • Im proud to be pro.
    • View Profile
    • Vice Underdogs
Re: Can't Create files
« Reply #5 on: February 07, 2010, 11:50:35 am »
Pawno is not able to create folders, Only files.
So create the folders first