car export - problem
#1

Hi all,
i'm trying to make a function that when a player export a vehicle and the vehicle is damaged the money will be decreased according to the damage. But the following code doesn't work properly... dunno why, seems fine...
Код:
public SellExportVehicle(playerid)
{
	new string[256], i;
	new Float:vhealth;
	new GetVHealth = GetVehicleHealth(GetPlayerVehicleID(playerid), vhealth);
	new VHealthLost = (GetVHealth - 1000);
	new FirstValue = (ExportPayment / 1000);
	new SecondValue = (FirstValue * VHealthLost);
	new EndValue = (ExportPayment - SecondValue);
	
	for(i=0; i<MAX_EXPORTVEHICLES; i++) {
		if(ExportVehicles[i]==ExportVehicle) {
			wantedVehicle = i;
			break;
		}
	}
	if(wantedVehicle>=0)
	{
		if(IsPlayerInAnyVehicle(playerid))
		{
			if( GetVehicleModel( GetPlayerVehicleID(playerid) ) == ExportVehicle )
			{
				if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
				{
						format(string, sizeof(string), "Excellent, we will export your %s at once! Here is $%d for your services.", ExportVehicleNames[i], EndValue);
						SendClientMessage(playerid, COLOR_GREEN, string);
						format(string, sizeof(string), "%s has exported a %s, and earned $%d! ", pName(playerid), ExportVehicleNames[i], EndValue);
						SendClientMessageToAll(COLOR_GREEN, string);
						format(string, sizeof(string), "$%d", EndValue);
						GameTextForPlayer(playerid, string, 4000,3);
						GivePlayerPCash(playerid, EndValue);
						PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
						EndExports();
						return SetVehicleToRespawn(GetPlayerVehicleID(playerid));
				}
			} else return SendClientMessage(playerid, COLOR_YELLOW, "We aren't buying this vehicle at the time!");
  		}
  		else format(string, sizeof(string), "We are currently buying %s's for export.", ExportVehicleNames[i]);
		return SendClientMessage(playerid, COLOR_ORANGE, string);
	} else return SendClientMessage(playerid, COLOR_YELLOW, "We aren't buying any vehicle at the time!");
}
Thanks in Advance!
Reply


Messages In This Thread
car export - problem - by Mike-Chip - 25.04.2009, 02:16
Re: car export - problem - by Nubotron - 25.04.2009, 03:58
Re: car export - problem - by Mike-Chip - 25.04.2009, 04:27
Re: car export - problem - by Joe Staff - 25.04.2009, 04:30
Re: car export - problem - by Mike-Chip - 25.04.2009, 04:38
Re: car export - problem - by Nubotron - 25.04.2009, 05:03
Re: car export - problem - by Mike-Chip - 25.04.2009, 11:20

Forum Jump:


Users browsing this thread: 1 Guest(s)