Door Help!
#1

My friend asked me if I can post this, Hes having problems with this Door problem.

Errors:
Код:
H:\Users\Lockard\Desktop\Everything GTA SAMP not in GTA\Carson City Roleplay\gamemodes\CCRP.pwn(257) : error 035: argument type mismatch (argument 1)
H:\Users\Lockard\Desktop\Everything GTA SAMP not in GTA\Carson City Roleplay\gamemodes\CCRP.pwn(258) : error 035: argument type mismatch (argument 1)
H:\Users\Lockard\Desktop\Everything GTA SAMP not in GTA\Carson City Roleplay\gamemodes\CCRP.pwn(259) : error 035: argument type mismatch (argument 1)
H:\Users\Lockard\Desktop\Everything GTA SAMP not in GTA\Carson City Roleplay\gamemodes\CCRP.pwn(260) : error 035: argument type mismatch (argument 1)
H:\Users\Lockard\Desktop\Everything GTA SAMP not in GTA\Carson City Roleplay\gamemodes\CCRP.pwn(261) : error 035: argument type mismatch (argument 1)
H:\Users\Lockard\Desktop\Everything GTA SAMP not in GTA\Carson City Roleplay\gamemodes\CCRP.pwn(262) : error 035: argument type mismatch (argument 1)
H:\Users\Lockard\Desktop\Everything GTA SAMP not in GTA\Carson City Roleplay\gamemodes\CCRP.pwn(263) : error 035: argument type mismatch (argument 1)
H:\Users\Lockard\Desktop\Everything GTA SAMP not in GTA\Carson City Roleplay\gamemodes\CCRP.pwn(264) : error 035: argument type mismatch (argument 1)
H:\Users\Lockard\Desktop\Everything GTA SAMP not in GTA\Carson City Roleplay\gamemodes\CCRP.pwn(265) : error 035: argument type mismatch (argument 1)
H:\Users\Lockard\Desktop\Everything GTA SAMP not in GTA\Carson City Roleplay\gamemodes\CCRP.pwn(266) : error 035: argument type mismatch (argument 1)
H:\Users\Lockard\Desktop\Everything GTA SAMP not in GTA\Carson City Roleplay\gamemodes\CCRP.pwn(267) : error 035: argument type mismatch (argument 1)
H:\Users\Lockard\Desktop\Everything GTA SAMP not in GTA\Carson City Roleplay\gamemodes\CCRP.pwn(268) : error 035: argument type mismatch (argument 1)
H:\Users\Lockard\Desktop\Everything GTA SAMP not in GTA\Carson City Roleplay\gamemodes\CCRP.pwn(269) : error 035: argument type mismatch (argument 1)
H:\Users\Lockard\Desktop\Everything GTA SAMP not in GTA\Carson City Roleplay\gamemodes\CCRP.pwn(270) : error 017: undefined symbol "INI_Save"
Area its happening:

Код:
SaveDoors()
{
    new file[128];
	for(new i= 1; i < MAX_DOORS; i++)
	{
        if(DoorIDTaken[i] == 0) continue;
	    format(file, sizeof(file), "Doors/%d.ini", i);
	    if(INI_Open(file))
	    {
        	INI_WriteInt("PickupModel",DoorInfo[i][dPickupModel]);
        	INI_WriteFloat("EnterX",DoorInfo[i][dEnterX]);
        	INI_WriteFloat("EnterY",DoorInfo[i][dEnterY]);
        	INI_WriteFloat("EnterZ",DoorInfo[i][dEnterZ]);
        	INI_WriteFloat("ExitX",DoorInfo[i][dExitX]);
        	INI_WriteFloat("ExitY",DoorInfo[i][dExitY]);
        	INI_WriteFloat("ExitZ",DoorInfo[i][dExitZ]);
        	INI_WriteInt("Int",DoorInfo[i][dInt]);
        	INI_WriteInt("ExitVW",DoorInfo[i][dExitVW]);
        	INI_WriteInt("ExitInt",DoorInfo[i][dExitInt]);
        	INI_WriteInt("EnterVW",DoorInfo[i][dEnterVW]);
        	INI_WriteInt("EnterInt",DoorInfo[i][dEnterInt]);
                INI_WriteString("Name", DoorInfo[i][dName]);
			INI_Save();
			INI_Close();
		}
	}
	return 1;
}
Thanks!
Reply
#2

Been a long time since I've used y_INI, but I do believe that you haven't mentioned the file in which those INI functions should be executed.

pawn Код:
INI_WriteInt(file, "PickupModel", DoorInfo[i][dPickupModel]);
//And for INI_WriteString, specify the size of the array too at last argument.
INI_WriteString(file, "Example", "Blabla", 6);
Oh and BTW, INI_Save isn't a function on that library. If you've meant to save, " INI_'Write' " functions will be saving. And INI_Close too require the file which is to be executed.
Reply
#3

Coming straight from my friend:

Quote:

So I understand how I forgot to add the file name, but I dont understand what to put, I have all the doors saving in a file called Doors and each door is in a ini called [doorid].ini I tried putting Doors as for file but is there something else I put there?

- For Lordz
Reply
#4

pawn Код:
SaveDoors()
{
    new file[30];
    for(new i= 1; i < MAX_DOORS; i++)
    {
        if(DoorIDTaken[i] == 0) continue;
        format(file, sizeof(file), "Doors/%d.ini", i);
       
        new INI:FILE = INI_Open(file);
        INI_WriteInt(FILE, "PickupModel", DoorInfo[i][dPickupModel]);
        INI_WriteFloat(FILE, "EnterX", DoorInfo[i][dEnterX]);
        INI_WriteFloat(FILE, "EnterY", DoorInfo[i][dEnterY]);
        INI_WriteFloat(FILE, "EnterZ", DoorInfo[i][dEnterZ]);
        INI_WriteFloat(FILE, "ExitX", DoorInfo[i][dExitX]);
        INI_WriteFloat(FILE, "ExitY", DoorInfo[i][dExitY]);
        INI_WriteFloat(FILE, "ExitZ", DoorInfo[i][dExitZ]);
        INI_WriteInt(FILE, "Int", DoorInfo[i][dInt]);
        INI_WriteInt(FILE, "ExitVW", DoorInfo[i][dExitVW]);
        INI_WriteInt(FILE, "ExitInt", DoorInfo[i][dExitInt]);
        INI_WriteInt(FILE, "EnterVW", DoorInfo[i][dEnterVW]);
        INI_WriteInt(FILE, "EnterInt", DoorInfo[i][dEnterInt]);
        INI_WriteString(FILE, "Name", DoorInfo[i][dName]);
        INI_Close();
    }
    return 1;
}
Reply
#5

Quote:
Originally Posted by aaleks123
Посмотреть сообщение
Coming straight from my friend:



- For Lordz
You've mentioned the INI_Open function to open a particular file and return it to the variable you used. And so, it was used as " file = INI_Open("Destination..."); ". Now, you're executing it on writing functions and those don't know on which those should be executed. So, that's why there's a file argument in which you must specify it.

The above poster has done it, check with it.
Reply
#6

Coming from my friend:

Quote:

So the saving function seams to be working, thank you.
Now the loading isn't working, I assume it has todo with the same kind of error I had with saving.

Код:
stock LoadDoors()
{
    new dStr[128];
    new file[128];
	for(new idx=1; idx<MAX_DOORS; idx++)
	{
		format(file, sizeof(file), "Doors/%d.ini", idx);
	    if(fexist(file) && INI_Open(file))
	    {
         	DoorInfo[idx][dPickupModel] = INI_ReadInt("PickupModel");
         	DoorInfo[idx][dEnterX] = INI_ReadFloat("EnterX");
         	DoorInfo[idx][dEnterY] = INI_ReadFloat("EnterY");
         	DoorInfo[idx][dEnterZ] = INI_ReadFloat("EnterZ");
         	DoorInfo[idx][dExitX]  = INI_ReadFloat("ExitX");
         	DoorInfo[idx][dExitY]  = INI_ReadFloat("ExitY");
         	DoorInfo[idx][dExitZ]  = INI_ReadFloat("ExitZ");
         	DoorInfo[idx][dInt] = INI_ReadInt("Int");
         	DoorInfo[idx][dExitVW] = INI_ReadInt("ExitVW");
         	DoorInfo[idx][dExitInt] = INI_ReadInt("ExitInt");
         	DoorInfo[idx][dEnterVW] = INI_ReadInt("EnterVW");
         	DoorInfo[idx][dEnterInt] = INI_ReadInt("EnterInt");

         	INI_ReadString(DoorInfo[idx][dName],"Name", 128);
         	format(dStr, sizeof(dStr), "[%s]\nID: %d\nPress C to enter.",DoorInfo[idx][dName], idx);

			DoorInfo[idx][dLabel] = Create3DTextLabel(dStr, COLOR_YELLOW, DoorInfo[idx][dEnterX], DoorInfo[idx][dEnterY], DoorInfo[idx][dEnterZ], 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0);
			DoorInfo[idx][dPickup] = CreatePickup(DoorInfo[idx][dPickupModel], 23, DoorInfo[idx][dEnterX], DoorInfo[idx][dEnterY], DoorInfo[idx][dEnterZ], 0, 0, -1, 70.0);

			DoorIDTaken[idx] = 1;

			INI_Close();
		}
	}
	return 1;
}
Quote:

Also I have it set up so that it creates a text lable saying the door ID, name of door, and press C to enter, those pop up for a second then disappear I was wondering how I would fix this?

Thanks!
Reply
#7

If anyone can help please.
Reply
#8

I don't know if there's INI_ReadInt function, but if you've not defined, better define those. INI_Int is the one which is used to get integer types of data from the file and INI_Float to get float values. You can easily do it by creating it in a callback and then parsing it using INI_Parse

Here's an example:
pawn Код:
forward LoadDoorStuff(doorid, name[], value[]);

public LoadDoorStuff(doorid, name[], value[])
{
 INI_Int("DoorStuff1", DoorStuff[doorid][DoorStuff1]);
 INI_Float("DoorStuff2", DoorStuff[doorid][DoorStuff2]);
 return 1;
}
Use INI_Parse to parse them:
pawn Код:
INI_ParseFile(doorPath(doorid), "LoadDoorStuff", .bExtra = true, .extra = doorid);
Reply
#9

Quote:
Originally Posted by Lordz™
Посмотреть сообщение
I don't know if there's INI_ReadInt function, but if you've not defined, better define those. INI_Int is the one which is used to get integer types of data from the file and INI_Float to get float values. You can easily do it by creating it in a callback and then parsing it using INI_Parse

Here's an example:
pawn Код:
forward LoadDoorStuff(doorid, name[], value[]);

public LoadDoorStuff(doorid, name[], value[])
{
 INI_Int("DoorStuff1", DoorStuff[doorid][DoorStuff1]);
 INI_Float("DoorStuff2", DoorStuff[doorid][DoorStuff2]);
 return 1;
}
Use INI_Parse to parse them:
pawn Код:
INI_ParseFile(doorPath(doorid), "LoadDoorStuff", .bExtra = true, .extra = doorid);
This is the friend by the way, but so I need to have LoadDoor in a public class? Cause as of right now it is in a stock. I also do not understand what you are trying to say by all this, please excuse but I am a new scripter and have only really made more DM scripts so taking on a RP script is confusing to myself. But I do thank you very much for all the help you have given me!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)