26.08.2010, 15:12
i change the code to somthing like this: without dini:
Still didnt work well. i get the message Load and Search for..
but its not load the insurance part.
pawn Код:
stock insurancedelete(vehicleid, playerid)
{
new house[256];
format(house, sizeof(house), "%s.ini",VehicleInfo[vehicleid][vOwner]);
printf("%s.ini", VehicleInfo[vehicleid][vOwner]);
new File: UserFile = fopen(house, io_read);
if ( UserFile )
{
new PassData[256];
new key[ 256 ];
new val[ 256 ];
new Data[ 256 ];
fread( UserFile , Data , sizeof( Data ) );
key = ini_GetKey( Data );
if( strcmp( key , "TrunkGun1" , true ) == 0 ) { val = ini_GetValue( Data ); insurance1[playerid] = strval( val ); }
if( strcmp( key , "TrunkGun2" , true ) == 0 ) { val = ini_GetValue( Data ); insurance2[playerid] = strval( val ); }
if( strcmp( key , "TrunkGun3" , true ) == 0 ) { val = ini_GetValue( Data ); insurance3[playerid] = strval( val ); }
if( strcmp( key , "TrunkGun4" , true ) == 0 ) { val = ini_GetValue( Data ); insurance4[playerid] = strval( val ); }
if( strcmp( key , "TrunkGun5" , true ) == 0 ) { val = ini_GetValue( Data ); insurance5[playerid] = strval( val ); }
fclose(UserFile);
printf("Load.....");
}
fclose(UserFile);
new str[255],str1[255];
format(str1, sizeof(str1), "vehicles/%s.cfg", VehicleInfo[vehicleid][vOwner]);
printf("vehicles/%s.cfg", VehicleInfo[vehicleid][vOwner]);
if(dini_Exists(str1))
{
printf("Search for..");
if(vehicleid == insurance1[playerid])
{
VehicleInfo[vehicleid][vW] -= 1;
SendClientMessage(playerid, COLOR_LIGHTRED, "Vehicle Destroy");
printf("Success");
}
else if(vehicleid == insurance2[playerid])
{
VehicleInfo[vehicleid][vW2] -= 1;
SendClientMessage(playerid, COLOR_LIGHTRED, "Vehicle Destroy");
printf("Success");
}
else if(vehicleid == insurance3[playerid])
{
VehicleInfo[vehicleid][vW3] -= 1;
SendClientMessage(playerid, COLOR_LIGHTRED, "Vehicle Destroy");
printf("Success");
}
else if(vehicleid == insurance4[playerid])
{
VehicleInfo[vehicleid][vW4] -= 1;
SendClientMessage(playerid, COLOR_LIGHTRED, "Vehicle Destroy");
printf("Success");
}
else if(vehicleid == insurance5[playerid])
{
VehicleInfo[vehicleid][vW5] -= 1;
SendClientMessage(playerid, COLOR_LIGHTRED, "Vehicle Destroy");
printf("Success");
}
}
}
but its not load the insurance part.