PDA

View Full Version : error 035: argument type mismatch (argument 1)


Riwerry
15/11/2013, 03:19 PM
Hello guys, what's wrong here? I'm using y_ini.
Getting this error error 035: argument type mismatch (argument 1)

new INI:file = INI_Open (VehiclePath(vehicleid));//ERROR LINE

/*Stock for VehiclePath*/
stock VehiclePath (vehicleid)
{
new string[128];
format(string,sizeof(string),VEHICLE_PATH,vehiclei d);
return string;
}

/*Path*/

#define VEHICLE_PATH "%i.ini"

Konstantinos
15/11/2013, 03:27 PM
Make sure that vehicleid is an integer. The code seems fine and it compiles fine as well.


#define VEHICLE_PATH "%i.ini"

public OnFilterScriptInit( )
{
new INI:file = INI_Open (VehiclePath(1));//ERROR LINE
return 1;
}

stock VehiclePath (vehicleid)
{
new string[128];
format(string,sizeof(string),VEHICLE_PATH,vehiclei d);
return string;
}

Riwerry
15/11/2013, 03:30 PM
I am creating new ini file in dialog response.. :D

Konstantinos
15/11/2013, 03:41 PM
I am creating new ini file in dialog response.. :D

What I posted was just an example to see that it compiles fine by adding an integer value in VehiclePath; therebefore the error caused from vehicleid. Post the code that you get the vehicleid.

Riwerry
15/11/2013, 03:59 PM
Nah, same line errors..

error 035: argument type mismatch (argument 1)

new INI:file = INI_Open (vehiclepath(1));

XStormiest
15/11/2013, 04:15 PM
1. When you create a file you have to : oepn -> close
2. Creating a variable inside a callback will make that variable local so you can use that only in OnDialogResponse
3. For me it compiles , depend on what you did. i'm sure you did something bad that's make the code unreadable by the compiler.

Riwerry
15/11/2013, 04:36 PM
I have file closed, I just posted error line. And I made just this, look to it


public OnDialogResponse (playerid, dialogid, response, listitem, inputtext [])
{
switch (dialogid)
{
case DIALOG_VOZIDLO:
{
if (!response) return true;
{
if (listitem == 0)
{
if (SlotZabraty [playerid] == 1)
{
return SendClientMessage (playerid, -1, "V tomto slote uz je uložená zbran!");
}
new wSlot1[MAX_PLAYERS], wSlot1Ammo[MAX_PLAYERS];
wSlot1 [playerid] = GetPlayerWeapon(playerid);
wSlot1Ammo [playerid] = GetPlayerAmmo(playerid);
new INI:Subor = INI_Open (Umiestnenie(1));
INI_WriteInt (Subor, "Slot1Weapon", wSlot1 [playerid]);
INI_WriteInt (Subor, "Slot1WeaponAmmo", wSlot1Ammo [playerid]);
INI_Close (Subor);
SendClientMessage (playerid, -1, "Úspešne si uložil zbran do slotu 1!");
SlotZabraty [playerid] = 1;
}
else if (listitem == 1)
{
SendClientMessage (playerid, -1, "Úspešne si uložil zbran do slotu 2!");
}
else if(listitem == 2)
{
SendClientMessage (playerid, -1, "Úspešne si uložil zbran do slotu 3!");
}
}
}
return true;
}

This tabs are okay dont know why on web is it broken. :D